[Java] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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 LDKBlindedFailure LDKBlindedFailure_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 BlindedFailure.ordinal() from rust threw an exception.");
255         }
256         switch (ord) {
257                 case 0: return LDKBlindedFailure_FromIntroductionNode;
258                 case 1: return LDKBlindedFailure_FromBlindedNode;
259         }
260         (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust returned an invalid value.");
261         abort(); // Unreachable, but will let the compiler know we don't return here
262 }
263 static jclass BlindedFailure_class = NULL;
264 static jfieldID BlindedFailure_LDKBlindedFailure_FromIntroductionNode = NULL;
265 static jfieldID BlindedFailure_LDKBlindedFailure_FromBlindedNode = NULL;
266 JNIEXPORT void JNICALL Java_org_ldk_enums_BlindedFailure_init (JNIEnv *env, jclass clz) {
267         BlindedFailure_class = (*env)->NewGlobalRef(env, clz);
268         CHECK(BlindedFailure_class != NULL);
269         BlindedFailure_LDKBlindedFailure_FromIntroductionNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromIntroductionNode", "Lorg/ldk/enums/BlindedFailure;");
270         CHECK(BlindedFailure_LDKBlindedFailure_FromIntroductionNode != NULL);
271         BlindedFailure_LDKBlindedFailure_FromBlindedNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromBlindedNode", "Lorg/ldk/enums/BlindedFailure;");
272         CHECK(BlindedFailure_LDKBlindedFailure_FromBlindedNode != NULL);
273 }
274 static inline jclass LDKBlindedFailure_to_java(JNIEnv *env, LDKBlindedFailure val) {
275         switch (val) {
276                 case LDKBlindedFailure_FromIntroductionNode:
277                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromIntroductionNode);
278                 case LDKBlindedFailure_FromBlindedNode:
279                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromBlindedNode);
280                 default: abort();
281         }
282 }
283
284 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
285         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
286         if (UNLIKELY((*env)->ExceptionCheck(env))) {
287                 (*env)->ExceptionDescribe(env);
288                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
289         }
290         switch (ord) {
291                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
292                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
293                 case 2: return LDKBolt11SemanticError_NoDescription;
294                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
295                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
296                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
297                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
298                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
299                 case 8: return LDKBolt11SemanticError_InvalidSignature;
300                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
301         }
302         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
303         abort(); // Unreachable, but will let the compiler know we don't return here
304 }
305 static jclass Bolt11SemanticError_class = NULL;
306 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
307 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
308 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
309 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
310 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
311 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
312 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
313 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
314 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
315 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
316 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
317         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
318         CHECK(Bolt11SemanticError_class != NULL);
319         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
320         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
321         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
322         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
323         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
324         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
325         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
326         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
327         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
328         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
329         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
330         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
331         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
332         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
333         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
334         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
335         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
336         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
337         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
338         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
339 }
340 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
341         switch (val) {
342                 case LDKBolt11SemanticError_NoPaymentHash:
343                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
344                 case LDKBolt11SemanticError_MultiplePaymentHashes:
345                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
346                 case LDKBolt11SemanticError_NoDescription:
347                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
348                 case LDKBolt11SemanticError_MultipleDescriptions:
349                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
350                 case LDKBolt11SemanticError_NoPaymentSecret:
351                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
352                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
353                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
354                 case LDKBolt11SemanticError_InvalidFeatures:
355                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
356                 case LDKBolt11SemanticError_InvalidRecoveryId:
357                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
358                 case LDKBolt11SemanticError_InvalidSignature:
359                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
360                 case LDKBolt11SemanticError_ImpreciseAmount:
361                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
362                 default: abort();
363         }
364 }
365
366 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
367         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
368         if (UNLIKELY((*env)->ExceptionCheck(env))) {
369                 (*env)->ExceptionDescribe(env);
370                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
371         }
372         switch (ord) {
373                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
374                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
375                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
376                 case 3: return LDKBolt12SemanticError_MissingAmount;
377                 case 4: return LDKBolt12SemanticError_InvalidAmount;
378                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
379                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
380                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
381                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
382                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
383                 case 10: return LDKBolt12SemanticError_MissingDescription;
384                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
385                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
386                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
387                 case 14: return LDKBolt12SemanticError_MissingQuantity;
388                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
389                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
390                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
391                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
392                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
393                 case 20: return LDKBolt12SemanticError_MissingPayerId;
394                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
395                 case 22: return LDKBolt12SemanticError_MissingPaths;
396                 case 23: return LDKBolt12SemanticError_UnexpectedPaths;
397                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
398                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
399                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
400                 case 27: return LDKBolt12SemanticError_MissingSignature;
401         }
402         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
403         abort(); // Unreachable, but will let the compiler know we don't return here
404 }
405 static jclass Bolt12SemanticError_class = NULL;
406 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
407 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
408 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
409 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
410 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
411 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
412 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
413 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
414 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
415 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
416 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
417 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
418 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
419 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
420 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
421 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
422 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
423 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
424 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
425 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
426 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
427 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
428 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
429 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths = NULL;
430 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
431 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
432 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
433 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
434 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
435         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
436         CHECK(Bolt12SemanticError_class != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
451         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
452         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
453         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
454         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
455         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
456         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
457         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
458         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
459         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
460         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
461         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
462         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
463         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
464         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
465         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
466         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
467         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
468         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
469         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
470         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
471         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
472         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
473         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
474         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
475         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
476         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
477         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
478         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
479         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
480         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
481         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
482         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
483         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
484         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths != NULL);
485         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
486         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
487         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
488         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
489         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
490         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
491         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
492         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
493 }
494 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
495         switch (val) {
496                 case LDKBolt12SemanticError_AlreadyExpired:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
498                 case LDKBolt12SemanticError_UnsupportedChain:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
500                 case LDKBolt12SemanticError_UnexpectedChain:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
502                 case LDKBolt12SemanticError_MissingAmount:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
504                 case LDKBolt12SemanticError_InvalidAmount:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
506                 case LDKBolt12SemanticError_InsufficientAmount:
507                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
508                 case LDKBolt12SemanticError_UnexpectedAmount:
509                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
510                 case LDKBolt12SemanticError_UnsupportedCurrency:
511                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
512                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
513                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
514                 case LDKBolt12SemanticError_UnexpectedFeatures:
515                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
516                 case LDKBolt12SemanticError_MissingDescription:
517                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
518                 case LDKBolt12SemanticError_MissingSigningPubkey:
519                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
520                 case LDKBolt12SemanticError_InvalidSigningPubkey:
521                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
522                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
523                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
524                 case LDKBolt12SemanticError_MissingQuantity:
525                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
526                 case LDKBolt12SemanticError_InvalidQuantity:
527                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
528                 case LDKBolt12SemanticError_UnexpectedQuantity:
529                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
530                 case LDKBolt12SemanticError_InvalidMetadata:
531                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
532                 case LDKBolt12SemanticError_UnexpectedMetadata:
533                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
534                 case LDKBolt12SemanticError_MissingPayerMetadata:
535                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
536                 case LDKBolt12SemanticError_MissingPayerId:
537                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
538                 case LDKBolt12SemanticError_DuplicatePaymentId:
539                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId);
540                 case LDKBolt12SemanticError_MissingPaths:
541                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
542                 case LDKBolt12SemanticError_UnexpectedPaths:
543                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths);
544                 case LDKBolt12SemanticError_InvalidPayInfo:
545                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
546                 case LDKBolt12SemanticError_MissingCreationTime:
547                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
548                 case LDKBolt12SemanticError_MissingPaymentHash:
549                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
550                 case LDKBolt12SemanticError_MissingSignature:
551                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
552                 default: abort();
553         }
554 }
555
556 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
557         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
558         if (UNLIKELY((*env)->ExceptionCheck(env))) {
559                 (*env)->ExceptionDescribe(env);
560                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
561         }
562         switch (ord) {
563                 case 0: return LDKCOption_NoneZ_Some;
564                 case 1: return LDKCOption_NoneZ_None;
565         }
566         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
567         abort(); // Unreachable, but will let the compiler know we don't return here
568 }
569 static jclass COption_NoneZ_class = NULL;
570 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
571 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
572 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
573         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
574         CHECK(COption_NoneZ_class != NULL);
575         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
576         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
577         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
578         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
579 }
580 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
581         switch (val) {
582                 case LDKCOption_NoneZ_Some:
583                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
584                 case LDKCOption_NoneZ_None:
585                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
586                 default: abort();
587         }
588 }
589
590 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
591         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
592         if (UNLIKELY((*env)->ExceptionCheck(env))) {
593                 (*env)->ExceptionDescribe(env);
594                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
595         }
596         switch (ord) {
597                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
598                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
599                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
600         }
601         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
602         abort(); // Unreachable, but will let the compiler know we don't return here
603 }
604 static jclass ChannelMonitorUpdateStatus_class = NULL;
605 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
606 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
607 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
608 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
609         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
610         CHECK(ChannelMonitorUpdateStatus_class != NULL);
611         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
612         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
613         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
614         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
615         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
616         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
617 }
618 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
619         switch (val) {
620                 case LDKChannelMonitorUpdateStatus_Completed:
621                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
622                 case LDKChannelMonitorUpdateStatus_InProgress:
623                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
624                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
625                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
626                 default: abort();
627         }
628 }
629
630 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
631         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
632         if (UNLIKELY((*env)->ExceptionCheck(env))) {
633                 (*env)->ExceptionDescribe(env);
634                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
635         }
636         switch (ord) {
637                 case 0: return LDKChannelShutdownState_NotShuttingDown;
638                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
639                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
640                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
641                 case 4: return LDKChannelShutdownState_ShutdownComplete;
642         }
643         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
644         abort(); // Unreachable, but will let the compiler know we don't return here
645 }
646 static jclass ChannelShutdownState_class = NULL;
647 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
648 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
649 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
650 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
651 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
653         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
654         CHECK(ChannelShutdownState_class != NULL);
655         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
656         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
657         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
658         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
659         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
660         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
661         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
662         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
663         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
664         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
665 }
666 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
667         switch (val) {
668                 case LDKChannelShutdownState_NotShuttingDown:
669                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
670                 case LDKChannelShutdownState_ShutdownInitiated:
671                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
672                 case LDKChannelShutdownState_ResolvingHTLCs:
673                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
674                 case LDKChannelShutdownState_NegotiatingClosingFee:
675                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
676                 case LDKChannelShutdownState_ShutdownComplete:
677                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
678                 default: abort();
679         }
680 }
681
682 static inline LDKConfirmationTarget LDKConfirmationTarget_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 ConfirmationTarget.ordinal() from rust threw an exception.");
687         }
688         switch (ord) {
689                 case 0: return LDKConfirmationTarget_OnChainSweep;
690                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
691                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
692                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
693                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
694                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
695                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
696         }
697         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
698         abort(); // Unreachable, but will let the compiler know we don't return here
699 }
700 static jclass ConfirmationTarget_class = NULL;
701 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
702 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
703 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
704 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
705 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
706 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
707 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee = NULL;
708 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
709         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
710         CHECK(ConfirmationTarget_class != NULL);
711         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
712         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
713         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
714         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
715         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
716         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
717         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
718         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
719         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
720         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
721         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
722         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
723         ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OutputSpendingFee", "Lorg/ldk/enums/ConfirmationTarget;");
724         CHECK(ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee != NULL);
725 }
726 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
727         switch (val) {
728                 case LDKConfirmationTarget_OnChainSweep:
729                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
730                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
731                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
732                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
733                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
734                 case LDKConfirmationTarget_AnchorChannelFee:
735                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
736                 case LDKConfirmationTarget_NonAnchorChannelFee:
737                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
738                 case LDKConfirmationTarget_ChannelCloseMinimum:
739                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
740                 case LDKConfirmationTarget_OutputSpendingFee:
741                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee);
742                 default: abort();
743         }
744 }
745
746 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
747         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
748         if (UNLIKELY((*env)->ExceptionCheck(env))) {
749                 (*env)->ExceptionDescribe(env);
750                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
751         }
752         switch (ord) {
753                 case 0: return LDKCreationError_DescriptionTooLong;
754                 case 1: return LDKCreationError_RouteTooLong;
755                 case 2: return LDKCreationError_TimestampOutOfBounds;
756                 case 3: return LDKCreationError_InvalidAmount;
757                 case 4: return LDKCreationError_MissingRouteHints;
758                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
759         }
760         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
761         abort(); // Unreachable, but will let the compiler know we don't return here
762 }
763 static jclass CreationError_class = NULL;
764 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
765 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
766 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
767 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
768 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
769 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
770 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
771         CreationError_class = (*env)->NewGlobalRef(env, clz);
772         CHECK(CreationError_class != NULL);
773         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
774         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
775         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
776         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
777         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
778         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
779         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
780         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
781         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
782         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
783         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
784         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
785 }
786 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
787         switch (val) {
788                 case LDKCreationError_DescriptionTooLong:
789                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
790                 case LDKCreationError_RouteTooLong:
791                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
792                 case LDKCreationError_TimestampOutOfBounds:
793                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
794                 case LDKCreationError_InvalidAmount:
795                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
796                 case LDKCreationError_MissingRouteHints:
797                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
798                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
799                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
800                 default: abort();
801         }
802 }
803
804 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
805         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
807                 (*env)->ExceptionDescribe(env);
808                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
809         }
810         switch (ord) {
811                 case 0: return LDKCurrency_Bitcoin;
812                 case 1: return LDKCurrency_BitcoinTestnet;
813                 case 2: return LDKCurrency_Regtest;
814                 case 3: return LDKCurrency_Simnet;
815                 case 4: return LDKCurrency_Signet;
816         }
817         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
818         abort(); // Unreachable, but will let the compiler know we don't return here
819 }
820 static jclass Currency_class = NULL;
821 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
822 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
823 static jfieldID Currency_LDKCurrency_Regtest = NULL;
824 static jfieldID Currency_LDKCurrency_Simnet = NULL;
825 static jfieldID Currency_LDKCurrency_Signet = NULL;
826 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
827         Currency_class = (*env)->NewGlobalRef(env, clz);
828         CHECK(Currency_class != NULL);
829         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
830         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
831         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
832         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
833         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
834         CHECK(Currency_LDKCurrency_Regtest != NULL);
835         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
836         CHECK(Currency_LDKCurrency_Simnet != NULL);
837         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
838         CHECK(Currency_LDKCurrency_Signet != NULL);
839 }
840 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
841         switch (val) {
842                 case LDKCurrency_Bitcoin:
843                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
844                 case LDKCurrency_BitcoinTestnet:
845                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
846                 case LDKCurrency_Regtest:
847                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
848                 case LDKCurrency_Simnet:
849                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
850                 case LDKCurrency_Signet:
851                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
852                 default: abort();
853         }
854 }
855
856 static inline LDKDirection LDKDirection_from_java(JNIEnv *env, jclass clz) {
857         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
858         if (UNLIKELY((*env)->ExceptionCheck(env))) {
859                 (*env)->ExceptionDescribe(env);
860                 (*env)->FatalError(env, "A call to Direction.ordinal() from rust threw an exception.");
861         }
862         switch (ord) {
863                 case 0: return LDKDirection_NodeOne;
864                 case 1: return LDKDirection_NodeTwo;
865         }
866         (*env)->FatalError(env, "A call to Direction.ordinal() from rust returned an invalid value.");
867         abort(); // Unreachable, but will let the compiler know we don't return here
868 }
869 static jclass Direction_class = NULL;
870 static jfieldID Direction_LDKDirection_NodeOne = NULL;
871 static jfieldID Direction_LDKDirection_NodeTwo = NULL;
872 JNIEXPORT void JNICALL Java_org_ldk_enums_Direction_init (JNIEnv *env, jclass clz) {
873         Direction_class = (*env)->NewGlobalRef(env, clz);
874         CHECK(Direction_class != NULL);
875         Direction_LDKDirection_NodeOne = (*env)->GetStaticFieldID(env, Direction_class, "LDKDirection_NodeOne", "Lorg/ldk/enums/Direction;");
876         CHECK(Direction_LDKDirection_NodeOne != NULL);
877         Direction_LDKDirection_NodeTwo = (*env)->GetStaticFieldID(env, Direction_class, "LDKDirection_NodeTwo", "Lorg/ldk/enums/Direction;");
878         CHECK(Direction_LDKDirection_NodeTwo != NULL);
879 }
880 static inline jclass LDKDirection_to_java(JNIEnv *env, LDKDirection val) {
881         switch (val) {
882                 case LDKDirection_NodeOne:
883                         return (*env)->GetStaticObjectField(env, Direction_class, Direction_LDKDirection_NodeOne);
884                 case LDKDirection_NodeTwo:
885                         return (*env)->GetStaticObjectField(env, Direction_class, Direction_LDKDirection_NodeTwo);
886                 default: abort();
887         }
888 }
889
890 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
891         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
892         if (UNLIKELY((*env)->ExceptionCheck(env))) {
893                 (*env)->ExceptionDescribe(env);
894                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
895         }
896         switch (ord) {
897                 case 0: return LDKHTLCClaim_OfferedTimeout;
898                 case 1: return LDKHTLCClaim_OfferedPreimage;
899                 case 2: return LDKHTLCClaim_AcceptedTimeout;
900                 case 3: return LDKHTLCClaim_AcceptedPreimage;
901                 case 4: return LDKHTLCClaim_Revocation;
902         }
903         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
904         abort(); // Unreachable, but will let the compiler know we don't return here
905 }
906 static jclass HTLCClaim_class = NULL;
907 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
908 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
909 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
910 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
911 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
912 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
913         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
914         CHECK(HTLCClaim_class != NULL);
915         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
916         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
917         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
918         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
919         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
920         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
921         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
922         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
923         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
924         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
925 }
926 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
927         switch (val) {
928                 case LDKHTLCClaim_OfferedTimeout:
929                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
930                 case LDKHTLCClaim_OfferedPreimage:
931                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
932                 case LDKHTLCClaim_AcceptedTimeout:
933                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
934                 case LDKHTLCClaim_AcceptedPreimage:
935                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
936                 case LDKHTLCClaim_Revocation:
937                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
938                 default: abort();
939         }
940 }
941
942 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
943         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
944         if (UNLIKELY((*env)->ExceptionCheck(env))) {
945                 (*env)->ExceptionDescribe(env);
946                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
947         }
948         switch (ord) {
949                 case 0: return LDKIOError_NotFound;
950                 case 1: return LDKIOError_PermissionDenied;
951                 case 2: return LDKIOError_ConnectionRefused;
952                 case 3: return LDKIOError_ConnectionReset;
953                 case 4: return LDKIOError_ConnectionAborted;
954                 case 5: return LDKIOError_NotConnected;
955                 case 6: return LDKIOError_AddrInUse;
956                 case 7: return LDKIOError_AddrNotAvailable;
957                 case 8: return LDKIOError_BrokenPipe;
958                 case 9: return LDKIOError_AlreadyExists;
959                 case 10: return LDKIOError_WouldBlock;
960                 case 11: return LDKIOError_InvalidInput;
961                 case 12: return LDKIOError_InvalidData;
962                 case 13: return LDKIOError_TimedOut;
963                 case 14: return LDKIOError_WriteZero;
964                 case 15: return LDKIOError_Interrupted;
965                 case 16: return LDKIOError_Other;
966                 case 17: return LDKIOError_UnexpectedEof;
967         }
968         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
969         abort(); // Unreachable, but will let the compiler know we don't return here
970 }
971 static jclass IOError_class = NULL;
972 static jfieldID IOError_LDKIOError_NotFound = NULL;
973 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
974 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
975 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
976 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
977 static jfieldID IOError_LDKIOError_NotConnected = NULL;
978 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
979 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
980 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
981 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
982 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
983 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
984 static jfieldID IOError_LDKIOError_InvalidData = NULL;
985 static jfieldID IOError_LDKIOError_TimedOut = NULL;
986 static jfieldID IOError_LDKIOError_WriteZero = NULL;
987 static jfieldID IOError_LDKIOError_Interrupted = NULL;
988 static jfieldID IOError_LDKIOError_Other = NULL;
989 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
990 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
991         IOError_class = (*env)->NewGlobalRef(env, clz);
992         CHECK(IOError_class != NULL);
993         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
994         CHECK(IOError_LDKIOError_NotFound != NULL);
995         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
996         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
997         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
998         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
999         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
1000         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
1001         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
1002         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
1003         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
1004         CHECK(IOError_LDKIOError_NotConnected != NULL);
1005         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
1006         CHECK(IOError_LDKIOError_AddrInUse != NULL);
1007         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
1008         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
1009         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
1010         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
1011         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
1012         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
1013         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
1014         CHECK(IOError_LDKIOError_WouldBlock != NULL);
1015         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
1016         CHECK(IOError_LDKIOError_InvalidInput != NULL);
1017         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
1018         CHECK(IOError_LDKIOError_InvalidData != NULL);
1019         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
1020         CHECK(IOError_LDKIOError_TimedOut != NULL);
1021         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
1022         CHECK(IOError_LDKIOError_WriteZero != NULL);
1023         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
1024         CHECK(IOError_LDKIOError_Interrupted != NULL);
1025         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
1026         CHECK(IOError_LDKIOError_Other != NULL);
1027         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
1028         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
1029 }
1030 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
1031         switch (val) {
1032                 case LDKIOError_NotFound:
1033                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
1034                 case LDKIOError_PermissionDenied:
1035                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
1036                 case LDKIOError_ConnectionRefused:
1037                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
1038                 case LDKIOError_ConnectionReset:
1039                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
1040                 case LDKIOError_ConnectionAborted:
1041                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
1042                 case LDKIOError_NotConnected:
1043                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
1044                 case LDKIOError_AddrInUse:
1045                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
1046                 case LDKIOError_AddrNotAvailable:
1047                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
1048                 case LDKIOError_BrokenPipe:
1049                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
1050                 case LDKIOError_AlreadyExists:
1051                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
1052                 case LDKIOError_WouldBlock:
1053                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
1054                 case LDKIOError_InvalidInput:
1055                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
1056                 case LDKIOError_InvalidData:
1057                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
1058                 case LDKIOError_TimedOut:
1059                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
1060                 case LDKIOError_WriteZero:
1061                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
1062                 case LDKIOError_Interrupted:
1063                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
1064                 case LDKIOError_Other:
1065                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
1066                 case LDKIOError_UnexpectedEof:
1067                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
1068                 default: abort();
1069         }
1070 }
1071
1072 static inline LDKInboundHTLCStateDetails LDKInboundHTLCStateDetails_from_java(JNIEnv *env, jclass clz) {
1073         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1074         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1075                 (*env)->ExceptionDescribe(env);
1076                 (*env)->FatalError(env, "A call to InboundHTLCStateDetails.ordinal() from rust threw an exception.");
1077         }
1078         switch (ord) {
1079                 case 0: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd;
1080                 case 1: return LDKInboundHTLCStateDetails_Committed;
1081                 case 2: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill;
1082                 case 3: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail;
1083         }
1084         (*env)->FatalError(env, "A call to InboundHTLCStateDetails.ordinal() from rust returned an invalid value.");
1085         abort(); // Unreachable, but will let the compiler know we don't return here
1086 }
1087 static jclass InboundHTLCStateDetails_class = NULL;
1088 static jfieldID InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd = NULL;
1089 static jfieldID InboundHTLCStateDetails_LDKInboundHTLCStateDetails_Committed = NULL;
1090 static jfieldID InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill = NULL;
1091 static jfieldID InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail = NULL;
1092 JNIEXPORT void JNICALL Java_org_ldk_enums_InboundHTLCStateDetails_init (JNIEnv *env, jclass clz) {
1093         InboundHTLCStateDetails_class = (*env)->NewGlobalRef(env, clz);
1094         CHECK(InboundHTLCStateDetails_class != NULL);
1095         InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd = (*env)->GetStaticFieldID(env, InboundHTLCStateDetails_class, "LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd", "Lorg/ldk/enums/InboundHTLCStateDetails;");
1096         CHECK(InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd != NULL);
1097         InboundHTLCStateDetails_LDKInboundHTLCStateDetails_Committed = (*env)->GetStaticFieldID(env, InboundHTLCStateDetails_class, "LDKInboundHTLCStateDetails_Committed", "Lorg/ldk/enums/InboundHTLCStateDetails;");
1098         CHECK(InboundHTLCStateDetails_LDKInboundHTLCStateDetails_Committed != NULL);
1099         InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill = (*env)->GetStaticFieldID(env, InboundHTLCStateDetails_class, "LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill", "Lorg/ldk/enums/InboundHTLCStateDetails;");
1100         CHECK(InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill != NULL);
1101         InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail = (*env)->GetStaticFieldID(env, InboundHTLCStateDetails_class, "LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail", "Lorg/ldk/enums/InboundHTLCStateDetails;");
1102         CHECK(InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail != NULL);
1103 }
1104 static inline jclass LDKInboundHTLCStateDetails_to_java(JNIEnv *env, LDKInboundHTLCStateDetails val) {
1105         switch (val) {
1106                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd:
1107                         return (*env)->GetStaticObjectField(env, InboundHTLCStateDetails_class, InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd);
1108                 case LDKInboundHTLCStateDetails_Committed:
1109                         return (*env)->GetStaticObjectField(env, InboundHTLCStateDetails_class, InboundHTLCStateDetails_LDKInboundHTLCStateDetails_Committed);
1110                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill:
1111                         return (*env)->GetStaticObjectField(env, InboundHTLCStateDetails_class, InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill);
1112                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail:
1113                         return (*env)->GetStaticObjectField(env, InboundHTLCStateDetails_class, InboundHTLCStateDetails_LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail);
1114                 default: abort();
1115         }
1116 }
1117
1118 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
1119         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1120         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1121                 (*env)->ExceptionDescribe(env);
1122                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
1123         }
1124         switch (ord) {
1125                 case 0: return LDKLevel_Gossip;
1126                 case 1: return LDKLevel_Trace;
1127                 case 2: return LDKLevel_Debug;
1128                 case 3: return LDKLevel_Info;
1129                 case 4: return LDKLevel_Warn;
1130                 case 5: return LDKLevel_Error;
1131         }
1132         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1133         abort(); // Unreachable, but will let the compiler know we don't return here
1134 }
1135 static jclass Level_class = NULL;
1136 static jfieldID Level_LDKLevel_Gossip = NULL;
1137 static jfieldID Level_LDKLevel_Trace = NULL;
1138 static jfieldID Level_LDKLevel_Debug = NULL;
1139 static jfieldID Level_LDKLevel_Info = NULL;
1140 static jfieldID Level_LDKLevel_Warn = NULL;
1141 static jfieldID Level_LDKLevel_Error = NULL;
1142 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1143         Level_class = (*env)->NewGlobalRef(env, clz);
1144         CHECK(Level_class != NULL);
1145         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1146         CHECK(Level_LDKLevel_Gossip != NULL);
1147         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1148         CHECK(Level_LDKLevel_Trace != NULL);
1149         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1150         CHECK(Level_LDKLevel_Debug != NULL);
1151         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1152         CHECK(Level_LDKLevel_Info != NULL);
1153         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1154         CHECK(Level_LDKLevel_Warn != NULL);
1155         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1156         CHECK(Level_LDKLevel_Error != NULL);
1157 }
1158 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1159         switch (val) {
1160                 case LDKLevel_Gossip:
1161                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1162                 case LDKLevel_Trace:
1163                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1164                 case LDKLevel_Debug:
1165                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1166                 case LDKLevel_Info:
1167                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1168                 case LDKLevel_Warn:
1169                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1170                 case LDKLevel_Error:
1171                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1172                 default: abort();
1173         }
1174 }
1175
1176 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1177         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1178         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1179                 (*env)->ExceptionDescribe(env);
1180                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1181         }
1182         switch (ord) {
1183                 case 0: return LDKNetwork_Bitcoin;
1184                 case 1: return LDKNetwork_Testnet;
1185                 case 2: return LDKNetwork_Regtest;
1186                 case 3: return LDKNetwork_Signet;
1187         }
1188         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1189         abort(); // Unreachable, but will let the compiler know we don't return here
1190 }
1191 static jclass Network_class = NULL;
1192 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1193 static jfieldID Network_LDKNetwork_Testnet = NULL;
1194 static jfieldID Network_LDKNetwork_Regtest = NULL;
1195 static jfieldID Network_LDKNetwork_Signet = NULL;
1196 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1197         Network_class = (*env)->NewGlobalRef(env, clz);
1198         CHECK(Network_class != NULL);
1199         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1200         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1201         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1202         CHECK(Network_LDKNetwork_Testnet != NULL);
1203         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1204         CHECK(Network_LDKNetwork_Regtest != NULL);
1205         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1206         CHECK(Network_LDKNetwork_Signet != NULL);
1207 }
1208 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1209         switch (val) {
1210                 case LDKNetwork_Bitcoin:
1211                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1212                 case LDKNetwork_Testnet:
1213                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1214                 case LDKNetwork_Regtest:
1215                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1216                 case LDKNetwork_Signet:
1217                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1218                 default: abort();
1219         }
1220 }
1221
1222 static inline LDKOutboundHTLCStateDetails LDKOutboundHTLCStateDetails_from_java(JNIEnv *env, jclass clz) {
1223         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1224         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1225                 (*env)->ExceptionDescribe(env);
1226                 (*env)->FatalError(env, "A call to OutboundHTLCStateDetails.ordinal() from rust threw an exception.");
1227         }
1228         switch (ord) {
1229                 case 0: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd;
1230                 case 1: return LDKOutboundHTLCStateDetails_Committed;
1231                 case 2: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess;
1232                 case 3: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure;
1233         }
1234         (*env)->FatalError(env, "A call to OutboundHTLCStateDetails.ordinal() from rust returned an invalid value.");
1235         abort(); // Unreachable, but will let the compiler know we don't return here
1236 }
1237 static jclass OutboundHTLCStateDetails_class = NULL;
1238 static jfieldID OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd = NULL;
1239 static jfieldID OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_Committed = NULL;
1240 static jfieldID OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess = NULL;
1241 static jfieldID OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure = NULL;
1242 JNIEXPORT void JNICALL Java_org_ldk_enums_OutboundHTLCStateDetails_init (JNIEnv *env, jclass clz) {
1243         OutboundHTLCStateDetails_class = (*env)->NewGlobalRef(env, clz);
1244         CHECK(OutboundHTLCStateDetails_class != NULL);
1245         OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd = (*env)->GetStaticFieldID(env, OutboundHTLCStateDetails_class, "LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd", "Lorg/ldk/enums/OutboundHTLCStateDetails;");
1246         CHECK(OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd != NULL);
1247         OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_Committed = (*env)->GetStaticFieldID(env, OutboundHTLCStateDetails_class, "LDKOutboundHTLCStateDetails_Committed", "Lorg/ldk/enums/OutboundHTLCStateDetails;");
1248         CHECK(OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_Committed != NULL);
1249         OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess = (*env)->GetStaticFieldID(env, OutboundHTLCStateDetails_class, "LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess", "Lorg/ldk/enums/OutboundHTLCStateDetails;");
1250         CHECK(OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess != NULL);
1251         OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure = (*env)->GetStaticFieldID(env, OutboundHTLCStateDetails_class, "LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure", "Lorg/ldk/enums/OutboundHTLCStateDetails;");
1252         CHECK(OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure != NULL);
1253 }
1254 static inline jclass LDKOutboundHTLCStateDetails_to_java(JNIEnv *env, LDKOutboundHTLCStateDetails val) {
1255         switch (val) {
1256                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd:
1257                         return (*env)->GetStaticObjectField(env, OutboundHTLCStateDetails_class, OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd);
1258                 case LDKOutboundHTLCStateDetails_Committed:
1259                         return (*env)->GetStaticObjectField(env, OutboundHTLCStateDetails_class, OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_Committed);
1260                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess:
1261                         return (*env)->GetStaticObjectField(env, OutboundHTLCStateDetails_class, OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess);
1262                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure:
1263                         return (*env)->GetStaticObjectField(env, OutboundHTLCStateDetails_class, OutboundHTLCStateDetails_LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure);
1264                 default: abort();
1265         }
1266 }
1267
1268 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1269         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1270         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1271                 (*env)->ExceptionDescribe(env);
1272                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1273         }
1274         switch (ord) {
1275                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1276                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1277                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1278                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1279                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1280                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1281         }
1282         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1283         abort(); // Unreachable, but will let the compiler know we don't return here
1284 }
1285 static jclass PaymentFailureReason_class = NULL;
1286 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1287 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1288 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1289 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1290 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1291 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1292 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1293         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1294         CHECK(PaymentFailureReason_class != NULL);
1295         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1296         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1297         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1298         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1299         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1300         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1301         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1302         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1303         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1304         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1305         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1306         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1307 }
1308 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1309         switch (val) {
1310                 case LDKPaymentFailureReason_RecipientRejected:
1311                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1312                 case LDKPaymentFailureReason_UserAbandoned:
1313                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1314                 case LDKPaymentFailureReason_RetriesExhausted:
1315                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1316                 case LDKPaymentFailureReason_PaymentExpired:
1317                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1318                 case LDKPaymentFailureReason_RouteNotFound:
1319                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1320                 case LDKPaymentFailureReason_UnexpectedError:
1321                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1322                 default: abort();
1323         }
1324 }
1325
1326 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1327         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1328         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1329                 (*env)->ExceptionDescribe(env);
1330                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1331         }
1332         switch (ord) {
1333                 case 0: return LDKRecipient_Node;
1334                 case 1: return LDKRecipient_PhantomNode;
1335         }
1336         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1337         abort(); // Unreachable, but will let the compiler know we don't return here
1338 }
1339 static jclass Recipient_class = NULL;
1340 static jfieldID Recipient_LDKRecipient_Node = NULL;
1341 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1342 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1343         Recipient_class = (*env)->NewGlobalRef(env, clz);
1344         CHECK(Recipient_class != NULL);
1345         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1346         CHECK(Recipient_LDKRecipient_Node != NULL);
1347         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1348         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1349 }
1350 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1351         switch (val) {
1352                 case LDKRecipient_Node:
1353                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1354                 case LDKRecipient_PhantomNode:
1355                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1356                 default: abort();
1357         }
1358 }
1359
1360 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1361         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1362         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1363                 (*env)->ExceptionDescribe(env);
1364                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1365         }
1366         switch (ord) {
1367                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1368                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1369                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1370         }
1371         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1372         abort(); // Unreachable, but will let the compiler know we don't return here
1373 }
1374 static jclass RetryableSendFailure_class = NULL;
1375 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1376 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1377 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1378 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1379         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1380         CHECK(RetryableSendFailure_class != NULL);
1381         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1382         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1383         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1384         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1385         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1386         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1387 }
1388 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1389         switch (val) {
1390                 case LDKRetryableSendFailure_PaymentExpired:
1391                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1392                 case LDKRetryableSendFailure_RouteNotFound:
1393                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1394                 case LDKRetryableSendFailure_DuplicatePayment:
1395                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1396                 default: abort();
1397         }
1398 }
1399
1400 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1401         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1402         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1403                 (*env)->ExceptionDescribe(env);
1404                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1405         }
1406         switch (ord) {
1407                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1408                 case 1: return LDKSecp256k1Error_InvalidMessage;
1409                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1410                 case 3: return LDKSecp256k1Error_InvalidSignature;
1411                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1412                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1413                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1414                 case 7: return LDKSecp256k1Error_InvalidTweak;
1415                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1416                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1417                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1418         }
1419         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1420         abort(); // Unreachable, but will let the compiler know we don't return here
1421 }
1422 static jclass Secp256k1Error_class = NULL;
1423 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1424 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1425 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1426 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1427 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1428 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1429 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1430 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1431 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1432 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1433 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1434 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1435         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1436         CHECK(Secp256k1Error_class != NULL);
1437         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1438         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1439         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1440         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1441         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1442         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1443         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1444         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1445         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1446         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1447         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1448         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1449         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1450         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1451         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1452         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1453         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1454         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1455         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1456         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1457         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1458         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1459 }
1460 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1461         switch (val) {
1462                 case LDKSecp256k1Error_IncorrectSignature:
1463                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1464                 case LDKSecp256k1Error_InvalidMessage:
1465                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1466                 case LDKSecp256k1Error_InvalidPublicKey:
1467                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1468                 case LDKSecp256k1Error_InvalidSignature:
1469                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1470                 case LDKSecp256k1Error_InvalidSecretKey:
1471                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1472                 case LDKSecp256k1Error_InvalidSharedSecret:
1473                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1474                 case LDKSecp256k1Error_InvalidRecoveryId:
1475                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1476                 case LDKSecp256k1Error_InvalidTweak:
1477                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1478                 case LDKSecp256k1Error_NotEnoughMemory:
1479                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1480                 case LDKSecp256k1Error_InvalidPublicKeySum:
1481                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1482                 case LDKSecp256k1Error_InvalidParityValue:
1483                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1484                 default: abort();
1485         }
1486 }
1487
1488 static inline LDKShortChannelIdError LDKShortChannelIdError_from_java(JNIEnv *env, jclass clz) {
1489         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1490         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1491                 (*env)->ExceptionDescribe(env);
1492                 (*env)->FatalError(env, "A call to ShortChannelIdError.ordinal() from rust threw an exception.");
1493         }
1494         switch (ord) {
1495                 case 0: return LDKShortChannelIdError_BlockOverflow;
1496                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
1497                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
1498         }
1499         (*env)->FatalError(env, "A call to ShortChannelIdError.ordinal() from rust returned an invalid value.");
1500         abort(); // Unreachable, but will let the compiler know we don't return here
1501 }
1502 static jclass ShortChannelIdError_class = NULL;
1503 static jfieldID ShortChannelIdError_LDKShortChannelIdError_BlockOverflow = NULL;
1504 static jfieldID ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow = NULL;
1505 static jfieldID ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow = NULL;
1506 JNIEXPORT void JNICALL Java_org_ldk_enums_ShortChannelIdError_init (JNIEnv *env, jclass clz) {
1507         ShortChannelIdError_class = (*env)->NewGlobalRef(env, clz);
1508         CHECK(ShortChannelIdError_class != NULL);
1509         ShortChannelIdError_LDKShortChannelIdError_BlockOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_BlockOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1510         CHECK(ShortChannelIdError_LDKShortChannelIdError_BlockOverflow != NULL);
1511         ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_TxIndexOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1512         CHECK(ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow != NULL);
1513         ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_VoutIndexOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1514         CHECK(ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow != NULL);
1515 }
1516 static inline jclass LDKShortChannelIdError_to_java(JNIEnv *env, LDKShortChannelIdError val) {
1517         switch (val) {
1518                 case LDKShortChannelIdError_BlockOverflow:
1519                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_BlockOverflow);
1520                 case LDKShortChannelIdError_TxIndexOverflow:
1521                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow);
1522                 case LDKShortChannelIdError_VoutIndexOverflow:
1523                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow);
1524                 default: abort();
1525         }
1526 }
1527
1528 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1529         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1530         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1531                 (*env)->ExceptionDescribe(env);
1532                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1533         }
1534         switch (ord) {
1535                 case 0: return LDKSiPrefix_Milli;
1536                 case 1: return LDKSiPrefix_Micro;
1537                 case 2: return LDKSiPrefix_Nano;
1538                 case 3: return LDKSiPrefix_Pico;
1539         }
1540         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1541         abort(); // Unreachable, but will let the compiler know we don't return here
1542 }
1543 static jclass SiPrefix_class = NULL;
1544 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1545 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1546 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1547 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1548 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1549         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1550         CHECK(SiPrefix_class != NULL);
1551         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1552         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1553         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1554         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1555         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1556         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1557         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1558         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1559 }
1560 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1561         switch (val) {
1562                 case LDKSiPrefix_Milli:
1563                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1564                 case LDKSiPrefix_Micro:
1565                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1566                 case LDKSiPrefix_Nano:
1567                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1568                 case LDKSiPrefix_Pico:
1569                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1570                 default: abort();
1571         }
1572 }
1573
1574 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1575         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1576         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1577                 (*env)->ExceptionDescribe(env);
1578                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1579         }
1580         switch (ord) {
1581                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1582                 case 1: return LDKSocketAddressParseError_InvalidInput;
1583                 case 2: return LDKSocketAddressParseError_InvalidPort;
1584                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1585         }
1586         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1587         abort(); // Unreachable, but will let the compiler know we don't return here
1588 }
1589 static jclass SocketAddressParseError_class = NULL;
1590 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1591 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1592 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1593 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1594 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1595         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1596         CHECK(SocketAddressParseError_class != NULL);
1597         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1598         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1599         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1600         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1601         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1602         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1603         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1604         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1605 }
1606 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1607         switch (val) {
1608                 case LDKSocketAddressParseError_SocketAddrParse:
1609                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1610                 case LDKSocketAddressParseError_InvalidInput:
1611                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1612                 case LDKSocketAddressParseError_InvalidPort:
1613                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1614                 case LDKSocketAddressParseError_InvalidOnionV3:
1615                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1616                 default: abort();
1617         }
1618 }
1619
1620 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1621         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1622         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1623                 (*env)->ExceptionDescribe(env);
1624                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1625         }
1626         switch (ord) {
1627                 case 0: return LDKUtxoLookupError_UnknownChain;
1628                 case 1: return LDKUtxoLookupError_UnknownTx;
1629         }
1630         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1631         abort(); // Unreachable, but will let the compiler know we don't return here
1632 }
1633 static jclass UtxoLookupError_class = NULL;
1634 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1635 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1636 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1637         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1638         CHECK(UtxoLookupError_class != NULL);
1639         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1640         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1641         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1642         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1643 }
1644 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1645         switch (val) {
1646                 case LDKUtxoLookupError_UnknownChain:
1647                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1648                 case LDKUtxoLookupError_UnknownTx:
1649                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1650                 default: abort();
1651         }
1652 }
1653
1654 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1655         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1656         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1657         return ret;
1658 }
1659 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1660         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1661         return ret;
1662 }
1663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1664         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1665         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1666         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1667         return ret_arr;
1668 }
1669
1670 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1672         if (!ptr_is_owned(thing)) return;
1673         void* thing_ptr = untag_ptr(thing);
1674         CHECK_ACCESS(thing_ptr);
1675         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1676         FREE(untag_ptr(thing));
1677         BigEndianScalar_free(thing_conv);
1678 }
1679
1680 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1681 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1682 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1683 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1684 static jclass LDKBech32Error_InvalidLength_class = NULL;
1685 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1686 static jclass LDKBech32Error_InvalidChar_class = NULL;
1687 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1688 static jclass LDKBech32Error_InvalidData_class = NULL;
1689 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1690 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1691 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1692 static jclass LDKBech32Error_MixedCase_class = NULL;
1693 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1695         LDKBech32Error_MissingSeparator_class =
1696                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1697         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1698         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1699         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1700         LDKBech32Error_InvalidChecksum_class =
1701                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1702         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1703         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1704         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1705         LDKBech32Error_InvalidLength_class =
1706                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1707         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1708         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1709         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1710         LDKBech32Error_InvalidChar_class =
1711                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1712         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1713         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1714         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1715         LDKBech32Error_InvalidData_class =
1716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1717         CHECK(LDKBech32Error_InvalidData_class != NULL);
1718         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1719         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1720         LDKBech32Error_InvalidPadding_class =
1721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1722         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1723         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1724         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1725         LDKBech32Error_MixedCase_class =
1726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1727         CHECK(LDKBech32Error_MixedCase_class != NULL);
1728         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1729         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1730 }
1731 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1732         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1733         switch(obj->tag) {
1734                 case LDKBech32Error_MissingSeparator: {
1735                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1736                 }
1737                 case LDKBech32Error_InvalidChecksum: {
1738                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1739                 }
1740                 case LDKBech32Error_InvalidLength: {
1741                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1742                 }
1743                 case LDKBech32Error_InvalidChar: {
1744                         int32_t invalid_char_conv = obj->invalid_char;
1745                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1746                 }
1747                 case LDKBech32Error_InvalidData: {
1748                         int8_t invalid_data_conv = obj->invalid_data;
1749                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1750                 }
1751                 case LDKBech32Error_InvalidPadding: {
1752                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1753                 }
1754                 case LDKBech32Error_MixedCase: {
1755                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1756                 }
1757                 default: abort();
1758         }
1759 }
1760 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
1761         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
1762         ret.is_owned = false;
1763         return ret;
1764 }
1765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1766         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
1767         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
1768         int64_t ret_ref = 0;
1769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1771         return ret_ref;
1772 }
1773
1774 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
1775 CHECK(!owner->result_ok);
1776         return Bolt12SemanticError_clone(&*owner->contents.err);
1777 }
1778 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1779         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
1780         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
1781         return ret_conv;
1782 }
1783
1784 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
1785         LDKRefund ret = *owner->contents.result;
1786         ret.is_owned = false;
1787         return ret;
1788 }
1789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1790         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
1791         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
1792         int64_t ret_ref = 0;
1793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1795         return ret_ref;
1796 }
1797
1798 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
1799 CHECK(!owner->result_ok);
1800         return Bolt12SemanticError_clone(&*owner->contents.err);
1801 }
1802 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1803         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
1804         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
1805         return ret_conv;
1806 }
1807
1808 static jclass LDKCOption_u64Z_Some_class = NULL;
1809 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1810 static jclass LDKCOption_u64Z_None_class = NULL;
1811 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1813         LDKCOption_u64Z_Some_class =
1814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1815         CHECK(LDKCOption_u64Z_Some_class != NULL);
1816         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1817         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1818         LDKCOption_u64Z_None_class =
1819                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1820         CHECK(LDKCOption_u64Z_None_class != NULL);
1821         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1822         CHECK(LDKCOption_u64Z_None_meth != NULL);
1823 }
1824 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1825         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1826         switch(obj->tag) {
1827                 case LDKCOption_u64Z_Some: {
1828                         int64_t some_conv = obj->some;
1829                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1830                 }
1831                 case LDKCOption_u64Z_None: {
1832                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1833                 }
1834                 default: abort();
1835         }
1836 }
1837 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1838         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1839         for (size_t i = 0; i < ret.datalen; i++) {
1840                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1841         }
1842         return ret;
1843 }
1844 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1845         LDKRefund ret = *owner->contents.result;
1846         ret.is_owned = false;
1847         return ret;
1848 }
1849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1850         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1851         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1852         int64_t ret_ref = 0;
1853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1855         return ret_ref;
1856 }
1857
1858 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1859         LDKBolt12ParseError ret = *owner->contents.err;
1860         ret.is_owned = false;
1861         return ret;
1862 }
1863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1864         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1865         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1866         int64_t ret_ref = 0;
1867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1869         return ret_ref;
1870 }
1871
1872 static jclass LDKRetry_Attempts_class = NULL;
1873 static jmethodID LDKRetry_Attempts_meth = NULL;
1874 static jclass LDKRetry_Timeout_class = NULL;
1875 static jmethodID LDKRetry_Timeout_meth = NULL;
1876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1877         LDKRetry_Attempts_class =
1878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1879         CHECK(LDKRetry_Attempts_class != NULL);
1880         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1881         CHECK(LDKRetry_Attempts_meth != NULL);
1882         LDKRetry_Timeout_class =
1883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1884         CHECK(LDKRetry_Timeout_class != NULL);
1885         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1886         CHECK(LDKRetry_Timeout_meth != NULL);
1887 }
1888 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1889         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1890         switch(obj->tag) {
1891                 case LDKRetry_Attempts: {
1892                         int32_t attempts_conv = obj->attempts;
1893                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1894                 }
1895                 case LDKRetry_Timeout: {
1896                         int64_t timeout_conv = obj->timeout;
1897                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1898                 }
1899                 default: abort();
1900         }
1901 }
1902 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1903 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1904 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1905 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1906 static jclass LDKDecodeError_InvalidValue_class = NULL;
1907 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1908 static jclass LDKDecodeError_ShortRead_class = NULL;
1909 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1910 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1911 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1912 static jclass LDKDecodeError_Io_class = NULL;
1913 static jmethodID LDKDecodeError_Io_meth = NULL;
1914 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1915 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1916 static jclass LDKDecodeError_DangerousValue_class = NULL;
1917 static jmethodID LDKDecodeError_DangerousValue_meth = NULL;
1918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1919         LDKDecodeError_UnknownVersion_class =
1920                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1921         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1922         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1923         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1924         LDKDecodeError_UnknownRequiredFeature_class =
1925                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1926         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1927         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1928         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1929         LDKDecodeError_InvalidValue_class =
1930                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1931         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1932         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1933         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1934         LDKDecodeError_ShortRead_class =
1935                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1936         CHECK(LDKDecodeError_ShortRead_class != NULL);
1937         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1938         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1939         LDKDecodeError_BadLengthDescriptor_class =
1940                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1941         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1942         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1943         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1944         LDKDecodeError_Io_class =
1945                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1946         CHECK(LDKDecodeError_Io_class != NULL);
1947         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1948         CHECK(LDKDecodeError_Io_meth != NULL);
1949         LDKDecodeError_UnsupportedCompression_class =
1950                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1951         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1952         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1953         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1954         LDKDecodeError_DangerousValue_class =
1955                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$DangerousValue"));
1956         CHECK(LDKDecodeError_DangerousValue_class != NULL);
1957         LDKDecodeError_DangerousValue_meth = (*env)->GetMethodID(env, LDKDecodeError_DangerousValue_class, "<init>", "()V");
1958         CHECK(LDKDecodeError_DangerousValue_meth != NULL);
1959 }
1960 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1961         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1962         switch(obj->tag) {
1963                 case LDKDecodeError_UnknownVersion: {
1964                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1965                 }
1966                 case LDKDecodeError_UnknownRequiredFeature: {
1967                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1968                 }
1969                 case LDKDecodeError_InvalidValue: {
1970                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1971                 }
1972                 case LDKDecodeError_ShortRead: {
1973                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1974                 }
1975                 case LDKDecodeError_BadLengthDescriptor: {
1976                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1977                 }
1978                 case LDKDecodeError_Io: {
1979                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1980                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1981                 }
1982                 case LDKDecodeError_UnsupportedCompression: {
1983                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1984                 }
1985                 case LDKDecodeError_DangerousValue: {
1986                         return (*env)->NewObject(env, LDKDecodeError_DangerousValue_class, LDKDecodeError_DangerousValue_meth);
1987                 }
1988                 default: abort();
1989         }
1990 }
1991 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1992 CHECK(owner->result_ok);
1993         return Retry_clone(&*owner->contents.result);
1994 }
1995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1996         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1997         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1998         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1999         int64_t ret_ref = tag_ptr(ret_copy, true);
2000         return ret_ref;
2001 }
2002
2003 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
2004 CHECK(!owner->result_ok);
2005         return DecodeError_clone(&*owner->contents.err);
2006 }
2007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2008         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
2009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2010         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
2011         int64_t ret_ref = tag_ptr(ret_copy, true);
2012         return ret_ref;
2013 }
2014
2015 static jclass LDKAPIError_APIMisuseError_class = NULL;
2016 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2017 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2018 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2019 static jclass LDKAPIError_InvalidRoute_class = NULL;
2020 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
2021 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2022 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2023 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
2024 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
2025 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
2026 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
2027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2028         LDKAPIError_APIMisuseError_class =
2029                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
2030         CHECK(LDKAPIError_APIMisuseError_class != NULL);
2031         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2032         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2033         LDKAPIError_FeeRateTooHigh_class =
2034                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
2035         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2036         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2037         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2038         LDKAPIError_InvalidRoute_class =
2039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
2040         CHECK(LDKAPIError_InvalidRoute_class != NULL);
2041         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
2042         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
2043         LDKAPIError_ChannelUnavailable_class =
2044                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
2045         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2046         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2047         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2048         LDKAPIError_MonitorUpdateInProgress_class =
2049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
2050         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
2051         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
2052         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
2053         LDKAPIError_IncompatibleShutdownScript_class =
2054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
2055         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
2056         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
2057         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
2058 }
2059 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2060         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
2061         switch(obj->tag) {
2062                 case LDKAPIError_APIMisuseError: {
2063                         LDKStr err_str = obj->api_misuse_error.err;
2064                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2065                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2066                 }
2067                 case LDKAPIError_FeeRateTooHigh: {
2068                         LDKStr err_str = obj->fee_rate_too_high.err;
2069                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2070                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
2071                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
2072                 }
2073                 case LDKAPIError_InvalidRoute: {
2074                         LDKStr err_str = obj->invalid_route.err;
2075                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2076                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
2077                 }
2078                 case LDKAPIError_ChannelUnavailable: {
2079                         LDKStr err_str = obj->channel_unavailable.err;
2080                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2081                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
2082                 }
2083                 case LDKAPIError_MonitorUpdateInProgress: {
2084                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
2085                 }
2086                 case LDKAPIError_IncompatibleShutdownScript: {
2087                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
2088                         int64_t script_ref = 0;
2089                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
2090                         script_ref = tag_ptr(script_var.inner, false);
2091                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
2092                 }
2093                 default: abort();
2094         }
2095 }
2096 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
2097 CHECK(owner->result_ok);
2098         return *owner->contents.result;
2099 }
2100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2101         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
2102         CResult_NoneAPIErrorZ_get_ok(owner_conv);
2103 }
2104
2105 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
2106 CHECK(!owner->result_ok);
2107         return APIError_clone(&*owner->contents.err);
2108 }
2109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2110         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
2111         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
2112         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
2113         int64_t ret_ref = tag_ptr(ret_copy, true);
2114         return ret_ref;
2115 }
2116
2117 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2118         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2119         for (size_t i = 0; i < ret.datalen; i++) {
2120                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2121         }
2122         return ret;
2123 }
2124 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2125         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2126         for (size_t i = 0; i < ret.datalen; i++) {
2127                 ret.data[i] = APIError_clone(&orig->data[i]);
2128         }
2129         return ret;
2130 }
2131 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
2132 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
2133 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
2134 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
2135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
2136         LDKCOption_ThirtyTwoBytesZ_Some_class =
2137                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
2138         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
2139         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
2140         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
2141         LDKCOption_ThirtyTwoBytesZ_None_class =
2142                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
2143         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
2144         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
2145         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
2146 }
2147 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2148         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
2149         switch(obj->tag) {
2150                 case LDKCOption_ThirtyTwoBytesZ_Some: {
2151                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
2152                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
2153                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
2154                 }
2155                 case LDKCOption_ThirtyTwoBytesZ_None: {
2156                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
2157                 }
2158                 default: abort();
2159         }
2160 }
2161 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
2162 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
2163 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
2164 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
2165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
2166         LDKCOption_CVec_u8ZZ_Some_class =
2167                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
2168         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
2169         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
2170         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
2171         LDKCOption_CVec_u8ZZ_None_class =
2172                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
2173         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
2174         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
2175         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
2176 }
2177 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2178         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
2179         switch(obj->tag) {
2180                 case LDKCOption_CVec_u8ZZ_Some: {
2181                         LDKCVec_u8Z some_var = obj->some;
2182                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
2183                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
2184                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
2185                 }
2186                 case LDKCOption_CVec_u8ZZ_None: {
2187                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
2188                 }
2189                 default: abort();
2190         }
2191 }
2192 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
2193         LDKRecipientOnionFields ret = *owner->contents.result;
2194         ret.is_owned = false;
2195         return ret;
2196 }
2197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2198         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2199         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
2200         int64_t ret_ref = 0;
2201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2203         return ret_ref;
2204 }
2205
2206 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
2207 CHECK(!owner->result_ok);
2208         return DecodeError_clone(&*owner->contents.err);
2209 }
2210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2211         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2212         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2213         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
2214         int64_t ret_ref = tag_ptr(ret_copy, true);
2215         return ret_ref;
2216 }
2217
2218 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2219         return owner->a;
2220 }
2221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2222         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2223         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
2224         return ret_conv;
2225 }
2226
2227 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2228         return CVec_u8Z_clone(&owner->b);
2229 }
2230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2231         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2232         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
2233         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2234         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2235         CVec_u8Z_free(ret_var);
2236         return ret_arr;
2237 }
2238
2239 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2240         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2241         for (size_t i = 0; i < ret.datalen; i++) {
2242                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2243         }
2244         return ret;
2245 }
2246 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2247         LDKRecipientOnionFields ret = *owner->contents.result;
2248         ret.is_owned = false;
2249         return ret;
2250 }
2251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2252         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2253         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2254         int64_t ret_ref = 0;
2255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2257         return ret_ref;
2258 }
2259
2260 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2261 CHECK(!owner->result_ok);
2262         return *owner->contents.err;
2263 }
2264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2265         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2266         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2267 }
2268
2269 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2270         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
2271         ret.is_owned = false;
2272         return ret;
2273 }
2274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2275         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2276         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
2277         int64_t ret_ref = 0;
2278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2280         return ret_ref;
2281 }
2282
2283 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2284 CHECK(!owner->result_ok);
2285         return Bolt12SemanticError_clone(&*owner->contents.err);
2286 }
2287 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2288         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2289         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
2290         return ret_conv;
2291 }
2292
2293 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2294         LDKBolt12Invoice ret = *owner->contents.result;
2295         ret.is_owned = false;
2296         return ret;
2297 }
2298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2299         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2300         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
2301         int64_t ret_ref = 0;
2302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2304         return ret_ref;
2305 }
2306
2307 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2308 CHECK(!owner->result_ok);
2309         return Bolt12SemanticError_clone(&*owner->contents.err);
2310 }
2311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2312         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2313         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
2314         return ret_conv;
2315 }
2316
2317 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2318 CHECK(owner->result_ok);
2319         return *owner->contents.result;
2320 }
2321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2322         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2323         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2324         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2325         return ret_arr;
2326 }
2327
2328 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2329 CHECK(!owner->result_ok);
2330         return *owner->contents.err;
2331 }
2332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2333         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2334         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2335 }
2336
2337 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2338         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2339         for (size_t i = 0; i < ret.datalen; i++) {
2340                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2341         }
2342         return ret;
2343 }
2344 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2345 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2346 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2347 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2349         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2351         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2352         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2353         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2354         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2356         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2357         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2358         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2359 }
2360 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2361         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2362         switch(obj->tag) {
2363                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2364                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2365                         jobjectArray some_arr = NULL;
2366                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2367                         ;
2368                         for (size_t i = 0; i < some_var.datalen; i++) {
2369                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2370                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2371                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2372                         }
2373                         
2374                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2375                 }
2376                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2377                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2378                 }
2379                 default: abort();
2380         }
2381 }
2382 static jclass LDKAmount_Bitcoin_class = NULL;
2383 static jmethodID LDKAmount_Bitcoin_meth = NULL;
2384 static jclass LDKAmount_Currency_class = NULL;
2385 static jmethodID LDKAmount_Currency_meth = NULL;
2386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAmount_init (JNIEnv *env, jclass clz) {
2387         LDKAmount_Bitcoin_class =
2388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAmount$Bitcoin"));
2389         CHECK(LDKAmount_Bitcoin_class != NULL);
2390         LDKAmount_Bitcoin_meth = (*env)->GetMethodID(env, LDKAmount_Bitcoin_class, "<init>", "(J)V");
2391         CHECK(LDKAmount_Bitcoin_meth != NULL);
2392         LDKAmount_Currency_class =
2393                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAmount$Currency"));
2394         CHECK(LDKAmount_Currency_class != NULL);
2395         LDKAmount_Currency_meth = (*env)->GetMethodID(env, LDKAmount_Currency_class, "<init>", "([BJ)V");
2396         CHECK(LDKAmount_Currency_meth != NULL);
2397 }
2398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAmount_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2399         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
2400         switch(obj->tag) {
2401                 case LDKAmount_Bitcoin: {
2402                         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
2403                         return (*env)->NewObject(env, LDKAmount_Bitcoin_class, LDKAmount_Bitcoin_meth, amount_msats_conv);
2404                 }
2405                 case LDKAmount_Currency: {
2406                         int8_tArray iso4217_code_arr = (*env)->NewByteArray(env, 3);
2407                         (*env)->SetByteArrayRegion(env, iso4217_code_arr, 0, 3, obj->currency.iso4217_code.data);
2408                         int64_t amount_conv = obj->currency.amount;
2409                         return (*env)->NewObject(env, LDKAmount_Currency_class, LDKAmount_Currency_meth, iso4217_code_arr, amount_conv);
2410                 }
2411                 default: abort();
2412         }
2413 }
2414 static jclass LDKCOption_AmountZ_Some_class = NULL;
2415 static jmethodID LDKCOption_AmountZ_Some_meth = NULL;
2416 static jclass LDKCOption_AmountZ_None_class = NULL;
2417 static jmethodID LDKCOption_AmountZ_None_meth = NULL;
2418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AmountZ_init (JNIEnv *env, jclass clz) {
2419         LDKCOption_AmountZ_Some_class =
2420                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AmountZ$Some"));
2421         CHECK(LDKCOption_AmountZ_Some_class != NULL);
2422         LDKCOption_AmountZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AmountZ_Some_class, "<init>", "(J)V");
2423         CHECK(LDKCOption_AmountZ_Some_meth != NULL);
2424         LDKCOption_AmountZ_None_class =
2425                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AmountZ$None"));
2426         CHECK(LDKCOption_AmountZ_None_class != NULL);
2427         LDKCOption_AmountZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AmountZ_None_class, "<init>", "()V");
2428         CHECK(LDKCOption_AmountZ_None_meth != NULL);
2429 }
2430 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AmountZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2431         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
2432         switch(obj->tag) {
2433                 case LDKCOption_AmountZ_Some: {
2434                         int64_t some_ref = tag_ptr(&obj->some, false);
2435                         return (*env)->NewObject(env, LDKCOption_AmountZ_Some_class, LDKCOption_AmountZ_Some_meth, some_ref);
2436                 }
2437                 case LDKCOption_AmountZ_None: {
2438                         return (*env)->NewObject(env, LDKCOption_AmountZ_None_class, LDKCOption_AmountZ_None_meth);
2439                 }
2440                 default: abort();
2441         }
2442 }
2443 static jclass LDKQuantity_Bounded_class = NULL;
2444 static jmethodID LDKQuantity_Bounded_meth = NULL;
2445 static jclass LDKQuantity_Unbounded_class = NULL;
2446 static jmethodID LDKQuantity_Unbounded_meth = NULL;
2447 static jclass LDKQuantity_One_class = NULL;
2448 static jmethodID LDKQuantity_One_meth = NULL;
2449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKQuantity_init (JNIEnv *env, jclass clz) {
2450         LDKQuantity_Bounded_class =
2451                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$Bounded"));
2452         CHECK(LDKQuantity_Bounded_class != NULL);
2453         LDKQuantity_Bounded_meth = (*env)->GetMethodID(env, LDKQuantity_Bounded_class, "<init>", "(J)V");
2454         CHECK(LDKQuantity_Bounded_meth != NULL);
2455         LDKQuantity_Unbounded_class =
2456                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$Unbounded"));
2457         CHECK(LDKQuantity_Unbounded_class != NULL);
2458         LDKQuantity_Unbounded_meth = (*env)->GetMethodID(env, LDKQuantity_Unbounded_class, "<init>", "()V");
2459         CHECK(LDKQuantity_Unbounded_meth != NULL);
2460         LDKQuantity_One_class =
2461                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$One"));
2462         CHECK(LDKQuantity_One_class != NULL);
2463         LDKQuantity_One_meth = (*env)->GetMethodID(env, LDKQuantity_One_class, "<init>", "()V");
2464         CHECK(LDKQuantity_One_meth != NULL);
2465 }
2466 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKQuantity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2467         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
2468         switch(obj->tag) {
2469                 case LDKQuantity_Bounded: {
2470                         int64_t bounded_conv = obj->bounded;
2471                         return (*env)->NewObject(env, LDKQuantity_Bounded_class, LDKQuantity_Bounded_meth, bounded_conv);
2472                 }
2473                 case LDKQuantity_Unbounded: {
2474                         return (*env)->NewObject(env, LDKQuantity_Unbounded_class, LDKQuantity_Unbounded_meth);
2475                 }
2476                 case LDKQuantity_One: {
2477                         return (*env)->NewObject(env, LDKQuantity_One_class, LDKQuantity_One_meth);
2478                 }
2479                 default: abort();
2480         }
2481 }
2482 static jclass LDKCOption_QuantityZ_Some_class = NULL;
2483 static jmethodID LDKCOption_QuantityZ_Some_meth = NULL;
2484 static jclass LDKCOption_QuantityZ_None_class = NULL;
2485 static jmethodID LDKCOption_QuantityZ_None_meth = NULL;
2486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1QuantityZ_init (JNIEnv *env, jclass clz) {
2487         LDKCOption_QuantityZ_Some_class =
2488                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_QuantityZ$Some"));
2489         CHECK(LDKCOption_QuantityZ_Some_class != NULL);
2490         LDKCOption_QuantityZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_QuantityZ_Some_class, "<init>", "(J)V");
2491         CHECK(LDKCOption_QuantityZ_Some_meth != NULL);
2492         LDKCOption_QuantityZ_None_class =
2493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_QuantityZ$None"));
2494         CHECK(LDKCOption_QuantityZ_None_class != NULL);
2495         LDKCOption_QuantityZ_None_meth = (*env)->GetMethodID(env, LDKCOption_QuantityZ_None_class, "<init>", "()V");
2496         CHECK(LDKCOption_QuantityZ_None_meth != NULL);
2497 }
2498 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1QuantityZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2499         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
2500         switch(obj->tag) {
2501                 case LDKCOption_QuantityZ_Some: {
2502                         int64_t some_ref = tag_ptr(&obj->some, false);
2503                         return (*env)->NewObject(env, LDKCOption_QuantityZ_Some_class, LDKCOption_QuantityZ_Some_meth, some_ref);
2504                 }
2505                 case LDKCOption_QuantityZ_None: {
2506                         return (*env)->NewObject(env, LDKCOption_QuantityZ_None_class, LDKCOption_QuantityZ_None_meth);
2507                 }
2508                 default: abort();
2509         }
2510 }
2511 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2512 CHECK(owner->result_ok);
2513         return ThirtyTwoBytes_clone(&*owner->contents.result);
2514 }
2515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2516         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2517         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2518         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2519         return ret_arr;
2520 }
2521
2522 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2523 CHECK(!owner->result_ok);
2524         return *owner->contents.err;
2525 }
2526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2527         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2528         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2529 }
2530
2531 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2532         LDKBlindedPayInfo ret = *owner->contents.result;
2533         ret.is_owned = false;
2534         return ret;
2535 }
2536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2537         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2538         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2539         int64_t ret_ref = 0;
2540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2542         return ret_ref;
2543 }
2544
2545 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2546 CHECK(!owner->result_ok);
2547         return DecodeError_clone(&*owner->contents.err);
2548 }
2549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2550         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2551         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2552         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2553         int64_t ret_ref = tag_ptr(ret_copy, true);
2554         return ret_ref;
2555 }
2556
2557 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2558         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2559         ret.is_owned = false;
2560         return ret;
2561 }
2562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2563         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2564         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2565         int64_t ret_ref = 0;
2566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2568         return ret_ref;
2569 }
2570
2571 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2572 CHECK(!owner->result_ok);
2573         return DecodeError_clone(&*owner->contents.err);
2574 }
2575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2576         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2577         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2578         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2579         int64_t ret_ref = tag_ptr(ret_copy, true);
2580         return ret_ref;
2581 }
2582
2583 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2584         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2585         ret.is_owned = false;
2586         return ret;
2587 }
2588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2589         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2590         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2591         int64_t ret_ref = 0;
2592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2594         return ret_ref;
2595 }
2596
2597 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2598 CHECK(!owner->result_ok);
2599         return DecodeError_clone(&*owner->contents.err);
2600 }
2601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2602         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2604         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2605         int64_t ret_ref = tag_ptr(ret_copy, true);
2606         return ret_ref;
2607 }
2608
2609 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2610 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2611 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2612 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2613 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2614 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2616         LDKSpendableOutputDescriptor_StaticOutput_class =
2617                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2618         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2619         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ[B)V");
2620         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2621         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2622                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2623         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2624         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2625         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2626         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2627                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2628         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2629         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2630         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2631 }
2632 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2633         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2634         switch(obj->tag) {
2635                 case LDKSpendableOutputDescriptor_StaticOutput: {
2636                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2637                         int64_t outpoint_ref = 0;
2638                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2639                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2640                         LDKTxOut* output_ref = &obj->static_output.output;
2641                         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
2642                         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, obj->static_output.channel_keys_id.data);
2643                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false), channel_keys_id_arr);
2644                 }
2645                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2646                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2647                         int64_t delayed_payment_output_ref = 0;
2648                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2649                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2650                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2651                 }
2652                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2653                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2654                         int64_t static_payment_output_ref = 0;
2655                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2656                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2657                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2658                 }
2659                 default: abort();
2660         }
2661 }
2662 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2663 CHECK(owner->result_ok);
2664         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2665 }
2666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2667         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2668         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2669         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2670         int64_t ret_ref = tag_ptr(ret_copy, true);
2671         return ret_ref;
2672 }
2673
2674 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2675 CHECK(!owner->result_ok);
2676         return DecodeError_clone(&*owner->contents.err);
2677 }
2678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2679         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2680         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2681         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2682         int64_t ret_ref = tag_ptr(ret_copy, true);
2683         return ret_ref;
2684 }
2685
2686 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2687         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2688         for (size_t i = 0; i < ret.datalen; i++) {
2689                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2690         }
2691         return ret;
2692 }
2693 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2694         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2695         for (size_t i = 0; i < ret.datalen; i++) {
2696                 ret.data[i] = TxOut_clone(&orig->data[i]);
2697         }
2698         return ret;
2699 }
2700 static jclass LDKCOption_u32Z_Some_class = NULL;
2701 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2702 static jclass LDKCOption_u32Z_None_class = NULL;
2703 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2705         LDKCOption_u32Z_Some_class =
2706                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2707         CHECK(LDKCOption_u32Z_Some_class != NULL);
2708         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2709         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2710         LDKCOption_u32Z_None_class =
2711                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2712         CHECK(LDKCOption_u32Z_None_class != NULL);
2713         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2714         CHECK(LDKCOption_u32Z_None_meth != NULL);
2715 }
2716 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2717         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2718         switch(obj->tag) {
2719                 case LDKCOption_u32Z_Some: {
2720                         int32_t some_conv = obj->some;
2721                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2722                 }
2723                 case LDKCOption_u32Z_None: {
2724                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2725                 }
2726                 default: abort();
2727         }
2728 }
2729 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2730         return CVec_u8Z_clone(&owner->a);
2731 }
2732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2733         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2734         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
2735         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2736         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2737         CVec_u8Z_free(ret_var);
2738         return ret_arr;
2739 }
2740
2741 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2742         return owner->b;
2743 }
2744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2745         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2746         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
2747         return ret_conv;
2748 }
2749
2750 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2751 CHECK(owner->result_ok);
2752         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
2753 }
2754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2755         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2756         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
2757         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
2758         return tag_ptr(ret_conv, true);
2759 }
2760
2761 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2762 CHECK(!owner->result_ok);
2763         return *owner->contents.err;
2764 }
2765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2766         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2767         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
2768 }
2769
2770 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2771         LDKChannelDerivationParameters ret = *owner->contents.result;
2772         ret.is_owned = false;
2773         return ret;
2774 }
2775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2776         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2777         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2778         int64_t ret_ref = 0;
2779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2781         return ret_ref;
2782 }
2783
2784 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2785 CHECK(!owner->result_ok);
2786         return DecodeError_clone(&*owner->contents.err);
2787 }
2788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2789         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2790         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2791         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2792         int64_t ret_ref = tag_ptr(ret_copy, true);
2793         return ret_ref;
2794 }
2795
2796 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2797         LDKHTLCDescriptor ret = *owner->contents.result;
2798         ret.is_owned = false;
2799         return ret;
2800 }
2801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2802         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2803         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2804         int64_t ret_ref = 0;
2805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2807         return ret_ref;
2808 }
2809
2810 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2811 CHECK(!owner->result_ok);
2812         return DecodeError_clone(&*owner->contents.err);
2813 }
2814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2815         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2816         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2817         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2818         int64_t ret_ref = tag_ptr(ret_copy, true);
2819         return ret_ref;
2820 }
2821
2822 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2823 CHECK(owner->result_ok);
2824         return *owner->contents.result;
2825 }
2826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2827         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2828         CResult_NoneNoneZ_get_ok(owner_conv);
2829 }
2830
2831 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2832 CHECK(!owner->result_ok);
2833         return *owner->contents.err;
2834 }
2835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2836         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2837         CResult_NoneNoneZ_get_err(owner_conv);
2838 }
2839
2840 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2841 CHECK(owner->result_ok);
2842         return *owner->contents.result;
2843 }
2844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2845         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2846         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2847         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2848         return ret_arr;
2849 }
2850
2851 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2852 CHECK(!owner->result_ok);
2853         return *owner->contents.err;
2854 }
2855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2856         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2857         CResult_PublicKeyNoneZ_get_err(owner_conv);
2858 }
2859
2860 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2861 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2862 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2863 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2865         LDKCOption_BigEndianScalarZ_Some_class =
2866                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2867         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2868         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2869         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2870         LDKCOption_BigEndianScalarZ_None_class =
2871                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2872         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2873         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2874         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2875 }
2876 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2877         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2878         switch(obj->tag) {
2879                 case LDKCOption_BigEndianScalarZ_Some: {
2880                         LDKBigEndianScalar* some_ref = &obj->some;
2881                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2882                 }
2883                 case LDKCOption_BigEndianScalarZ_None: {
2884                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2885                 }
2886                 default: abort();
2887         }
2888 }
2889 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2890 CHECK(owner->result_ok);
2891         return *owner->contents.result;
2892 }
2893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2894         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2895         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2896         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2897         return ret_arr;
2898 }
2899
2900 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2901 CHECK(!owner->result_ok);
2902         return *owner->contents.err;
2903 }
2904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2905         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2906         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2907 }
2908
2909 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2910 CHECK(owner->result_ok);
2911         return *owner->contents.result;
2912 }
2913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2914         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2915         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2916         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2917         return ret_arr;
2918 }
2919
2920 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2921 CHECK(!owner->result_ok);
2922         return *owner->contents.err;
2923 }
2924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2925         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2926         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2927 }
2928
2929 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2930 CHECK(owner->result_ok);
2931         return *owner->contents.result;
2932 }
2933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2934         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2935         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2936         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2937         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2938         return ret_arr;
2939 }
2940
2941 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2942 CHECK(!owner->result_ok);
2943         return *owner->contents.err;
2944 }
2945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2946         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2947         CResult_TransactionNoneZ_get_err(owner_conv);
2948 }
2949
2950 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2951         return owner->a;
2952 }
2953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2954         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2955         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2956         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2957         return ret_arr;
2958 }
2959
2960 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2961         return owner->b;
2962 }
2963 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2964         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2965         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2966         jobjectArray ret_arr = NULL;
2967         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2968         ;
2969         for (size_t i = 0; i < ret_var.datalen; i++) {
2970                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2971                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2972                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2973         }
2974         
2975         return ret_arr;
2976 }
2977
2978 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2979 CHECK(owner->result_ok);
2980         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2981 }
2982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2983         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2984         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2985         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2986         return tag_ptr(ret_conv, true);
2987 }
2988
2989 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2990 CHECK(!owner->result_ok);
2991         return *owner->contents.err;
2992 }
2993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2994         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2995         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2996 }
2997
2998 typedef struct LDKChannelSigner_JCalls {
2999         atomic_size_t refcnt;
3000         JavaVM *vm;
3001         jweak o;
3002         jmethodID get_per_commitment_point_meth;
3003         jmethodID release_commitment_secret_meth;
3004         jmethodID validate_holder_commitment_meth;
3005         jmethodID validate_counterparty_revocation_meth;
3006         jmethodID channel_keys_id_meth;
3007         jmethodID provide_channel_parameters_meth;
3008 } LDKChannelSigner_JCalls;
3009 static void LDKChannelSigner_JCalls_free(void* this_arg) {
3010         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3011         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3012                 JNIEnv *env;
3013                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3014                 if (get_jenv_res == JNI_EDETACHED) {
3015                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3016                 } else {
3017                         DO_ASSERT(get_jenv_res == JNI_OK);
3018                 }
3019                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3020                 if (get_jenv_res == JNI_EDETACHED) {
3021                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3022                 }
3023                 FREE(j_calls);
3024         }
3025 }
3026 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
3027         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3028         JNIEnv *env;
3029         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3030         if (get_jenv_res == JNI_EDETACHED) {
3031                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3032         } else {
3033                 DO_ASSERT(get_jenv_res == JNI_OK);
3034         }
3035         int64_t idx_conv = idx;
3036         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3037         CHECK(obj != NULL);
3038         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
3039         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3040                 (*env)->ExceptionDescribe(env);
3041                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
3042         }
3043         LDKPublicKey ret_ref;
3044         CHECK((*env)->GetArrayLength(env, ret) == 33);
3045         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3046         if (get_jenv_res == JNI_EDETACHED) {
3047                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3048         }
3049         return ret_ref;
3050 }
3051 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
3052         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3053         JNIEnv *env;
3054         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3055         if (get_jenv_res == JNI_EDETACHED) {
3056                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3057         } else {
3058                 DO_ASSERT(get_jenv_res == JNI_OK);
3059         }
3060         int64_t idx_conv = idx;
3061         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3062         CHECK(obj != NULL);
3063         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
3064         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3065                 (*env)->ExceptionDescribe(env);
3066                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
3067         }
3068         LDKThirtyTwoBytes ret_ref;
3069         CHECK((*env)->GetArrayLength(env, ret) == 32);
3070         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3071         if (get_jenv_res == JNI_EDETACHED) {
3072                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3073         }
3074         return ret_ref;
3075 }
3076 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
3077         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3086         int64_t holder_tx_ref = 0;
3087         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3088         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3089         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3090         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
3091         jobjectArray outbound_htlc_preimages_arr = NULL;
3092         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3093         ;
3094         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
3095                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3096                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
3097                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
3098         }
3099         
3100         FREE(outbound_htlc_preimages_var.data);
3101         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3102         CHECK(obj != NULL);
3103         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, outbound_htlc_preimages_arr);
3104         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3105                 (*env)->ExceptionDescribe(env);
3106                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
3107         }
3108         void* ret_ptr = untag_ptr(ret);
3109         CHECK_ACCESS(ret_ptr);
3110         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3111         FREE(untag_ptr(ret));
3112         if (get_jenv_res == JNI_EDETACHED) {
3113                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3114         }
3115         return ret_conv;
3116 }
3117 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3118         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3119         JNIEnv *env;
3120         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3121         if (get_jenv_res == JNI_EDETACHED) {
3122                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3123         } else {
3124                 DO_ASSERT(get_jenv_res == JNI_OK);
3125         }
3126         int64_t idx_conv = idx;
3127         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3128         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3129         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3130         CHECK(obj != NULL);
3131         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
3132         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3133                 (*env)->ExceptionDescribe(env);
3134                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKChannelSigner from rust threw an exception.");
3135         }
3136         void* ret_ptr = untag_ptr(ret);
3137         CHECK_ACCESS(ret_ptr);
3138         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3139         FREE(untag_ptr(ret));
3140         if (get_jenv_res == JNI_EDETACHED) {
3141                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3142         }
3143         return ret_conv;
3144 }
3145 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
3146         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3147         JNIEnv *env;
3148         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3149         if (get_jenv_res == JNI_EDETACHED) {
3150                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3151         } else {
3152                 DO_ASSERT(get_jenv_res == JNI_OK);
3153         }
3154         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3155         CHECK(obj != NULL);
3156         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3157         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3158                 (*env)->ExceptionDescribe(env);
3159                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
3160         }
3161         LDKThirtyTwoBytes ret_ref;
3162         CHECK((*env)->GetArrayLength(env, ret) == 32);
3163         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3164         if (get_jenv_res == JNI_EDETACHED) {
3165                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3166         }
3167         return ret_ref;
3168 }
3169 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3170         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3171         JNIEnv *env;
3172         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3173         if (get_jenv_res == JNI_EDETACHED) {
3174                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3175         } else {
3176                 DO_ASSERT(get_jenv_res == JNI_OK);
3177         }
3178         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3179         int64_t channel_parameters_ref = 0;
3180         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3181         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3182         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3183         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3184         CHECK(obj != NULL);
3185         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
3186         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3187                 (*env)->ExceptionDescribe(env);
3188                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
3189         }
3190         if (get_jenv_res == JNI_EDETACHED) {
3191                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3192         }
3193 }
3194 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3195         jclass c = (*env)->GetObjectClass(env, o);
3196         CHECK(c != NULL);
3197         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
3198         atomic_init(&calls->refcnt, 1);
3199         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3200         calls->o = (*env)->NewWeakGlobalRef(env, o);
3201         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
3202         CHECK(calls->get_per_commitment_point_meth != NULL);
3203         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
3204         CHECK(calls->release_commitment_secret_meth != NULL);
3205         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
3206         CHECK(calls->validate_holder_commitment_meth != NULL);
3207         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3208         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3209         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
3210         CHECK(calls->channel_keys_id_meth != NULL);
3211         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
3212         CHECK(calls->provide_channel_parameters_meth != NULL);
3213
3214         LDKChannelPublicKeys pubkeys_conv;
3215         pubkeys_conv.inner = untag_ptr(pubkeys);
3216         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3217         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3218
3219         LDKChannelSigner ret = {
3220                 .this_arg = (void*) calls,
3221                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
3222                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
3223                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
3224                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
3225                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
3226                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
3227                 .free = LDKChannelSigner_JCalls_free,
3228                 .pubkeys = pubkeys_conv,
3229                 .set_pubkeys = NULL,
3230         };
3231         return ret;
3232 }
3233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3234         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
3235         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
3236         return tag_ptr(res_ptr, true);
3237 }
3238 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) {
3239         void* this_arg_ptr = untag_ptr(this_arg);
3240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3241         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3242         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3243         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
3244         return ret_arr;
3245 }
3246
3247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
3248         void* this_arg_ptr = untag_ptr(this_arg);
3249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3250         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3251         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3252         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
3253         return ret_arr;
3254 }
3255
3256 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 outbound_htlc_preimages) {
3257         void* this_arg_ptr = untag_ptr(this_arg);
3258         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3259         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3260         LDKHolderCommitmentTransaction holder_tx_conv;
3261         holder_tx_conv.inner = untag_ptr(holder_tx);
3262         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3263         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3264         holder_tx_conv.is_owned = false;
3265         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3266         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3267         if (outbound_htlc_preimages_constr.datalen > 0)
3268                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3269         else
3270                 outbound_htlc_preimages_constr.data = NULL;
3271         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3272                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3273                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3274                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3275                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3276                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3277         }
3278         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3279         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
3280         return tag_ptr(ret_conv, true);
3281 }
3282
3283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3284         void* this_arg_ptr = untag_ptr(this_arg);
3285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3286         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3287         uint8_t secret_arr[32];
3288         CHECK((*env)->GetArrayLength(env, secret) == 32);
3289         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3290         uint8_t (*secret_ref)[32] = &secret_arr;
3291         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3292         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3293         return tag_ptr(ret_conv, true);
3294 }
3295
3296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
3297         void* this_arg_ptr = untag_ptr(this_arg);
3298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3299         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3300         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3301         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
3302         return ret_arr;
3303 }
3304
3305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
3306         void* this_arg_ptr = untag_ptr(this_arg);
3307         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3308         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3309         LDKChannelTransactionParameters channel_parameters_conv;
3310         channel_parameters_conv.inner = untag_ptr(channel_parameters);
3311         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
3312         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3313         channel_parameters_conv.is_owned = false;
3314         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
3315 }
3316
3317 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
3318         if (this_arg->set_pubkeys != NULL)
3319                 this_arg->set_pubkeys(this_arg);
3320         return this_arg->pubkeys;
3321 }
3322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
3323         void* this_arg_ptr = untag_ptr(this_arg);
3324         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3325         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3326         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
3327         int64_t ret_ref = 0;
3328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3330         return ret_ref;
3331 }
3332
3333 typedef struct LDKEcdsaChannelSigner_JCalls {
3334         atomic_size_t refcnt;
3335         JavaVM *vm;
3336         jweak o;
3337         LDKChannelSigner_JCalls* ChannelSigner;
3338         jmethodID sign_counterparty_commitment_meth;
3339         jmethodID sign_holder_commitment_meth;
3340         jmethodID sign_justice_revoked_output_meth;
3341         jmethodID sign_justice_revoked_htlc_meth;
3342         jmethodID sign_holder_htlc_transaction_meth;
3343         jmethodID sign_counterparty_htlc_transaction_meth;
3344         jmethodID sign_closing_transaction_meth;
3345         jmethodID sign_holder_anchor_input_meth;
3346         jmethodID sign_channel_announcement_with_funding_key_meth;
3347 } LDKEcdsaChannelSigner_JCalls;
3348 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
3349         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3350         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3351                 JNIEnv *env;
3352                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3353                 if (get_jenv_res == JNI_EDETACHED) {
3354                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3355                 } else {
3356                         DO_ASSERT(get_jenv_res == JNI_OK);
3357                 }
3358                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3359                 if (get_jenv_res == JNI_EDETACHED) {
3360                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3361                 }
3362                 FREE(j_calls);
3363         }
3364 }
3365 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
3366         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3367         JNIEnv *env;
3368         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3369         if (get_jenv_res == JNI_EDETACHED) {
3370                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3371         } else {
3372                 DO_ASSERT(get_jenv_res == JNI_OK);
3373         }
3374         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3375         int64_t commitment_tx_ref = 0;
3376         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3377         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3378         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3379         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
3380         jobjectArray inbound_htlc_preimages_arr = NULL;
3381         inbound_htlc_preimages_arr = (*env)->NewObjectArray(env, inbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3382         ;
3383         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
3384                 int8_tArray inbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3385                 (*env)->SetByteArrayRegion(env, inbound_htlc_preimages_conv_8_arr, 0, 32, inbound_htlc_preimages_var.data[i].data);
3386                 (*env)->SetObjectArrayElement(env, inbound_htlc_preimages_arr, i, inbound_htlc_preimages_conv_8_arr);
3387         }
3388         
3389         FREE(inbound_htlc_preimages_var.data);
3390         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
3391         jobjectArray outbound_htlc_preimages_arr = NULL;
3392         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3393         ;
3394         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
3395                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3396                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
3397                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
3398         }
3399         
3400         FREE(outbound_htlc_preimages_var.data);
3401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3402         CHECK(obj != NULL);
3403         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, inbound_htlc_preimages_arr, outbound_htlc_preimages_arr);
3404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3405                 (*env)->ExceptionDescribe(env);
3406                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3407         }
3408         void* ret_ptr = untag_ptr(ret);
3409         CHECK_ACCESS(ret_ptr);
3410         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
3411         FREE(untag_ptr(ret));
3412         if (get_jenv_res == JNI_EDETACHED) {
3413                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3414         }
3415         return ret_conv;
3416 }
3417 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3418         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3419         JNIEnv *env;
3420         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3421         if (get_jenv_res == JNI_EDETACHED) {
3422                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3423         } else {
3424                 DO_ASSERT(get_jenv_res == JNI_OK);
3425         }
3426         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3427         int64_t commitment_tx_ref = 0;
3428         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3429         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3430         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3431         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3432         CHECK(obj != NULL);
3433         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
3434         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3435                 (*env)->ExceptionDescribe(env);
3436                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3437         }
3438         void* ret_ptr = untag_ptr(ret);
3439         CHECK_ACCESS(ret_ptr);
3440         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3441         FREE(untag_ptr(ret));
3442         if (get_jenv_res == JNI_EDETACHED) {
3443                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3444         }
3445         return ret_conv;
3446 }
3447 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]) {
3448         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3449         JNIEnv *env;
3450         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3451         if (get_jenv_res == JNI_EDETACHED) {
3452                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3453         } else {
3454                 DO_ASSERT(get_jenv_res == JNI_OK);
3455         }
3456         LDKTransaction justice_tx_var = justice_tx;
3457         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3458         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3459         Transaction_free(justice_tx_var);
3460         int64_t input_conv = input;
3461         int64_t amount_conv = amount;
3462         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3463         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3464         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3465         CHECK(obj != NULL);
3466         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);
3467         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3468                 (*env)->ExceptionDescribe(env);
3469                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3470         }
3471         void* ret_ptr = untag_ptr(ret);
3472         CHECK_ACCESS(ret_ptr);
3473         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3474         FREE(untag_ptr(ret));
3475         if (get_jenv_res == JNI_EDETACHED) {
3476                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3477         }
3478         return ret_conv;
3479 }
3480 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) {
3481         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3482         JNIEnv *env;
3483         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3484         if (get_jenv_res == JNI_EDETACHED) {
3485                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3486         } else {
3487                 DO_ASSERT(get_jenv_res == JNI_OK);
3488         }
3489         LDKTransaction justice_tx_var = justice_tx;
3490         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3491         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3492         Transaction_free(justice_tx_var);
3493         int64_t input_conv = input;
3494         int64_t amount_conv = amount;
3495         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3496         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3497         LDKHTLCOutputInCommitment htlc_var = *htlc;
3498         int64_t htlc_ref = 0;
3499         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3500         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3501         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3502         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3503         CHECK(obj != NULL);
3504         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);
3505         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3506                 (*env)->ExceptionDescribe(env);
3507                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3508         }
3509         void* ret_ptr = untag_ptr(ret);
3510         CHECK_ACCESS(ret_ptr);
3511         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3512         FREE(untag_ptr(ret));
3513         if (get_jenv_res == JNI_EDETACHED) {
3514                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3515         }
3516         return ret_conv;
3517 }
3518 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3519         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3520         JNIEnv *env;
3521         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3522         if (get_jenv_res == JNI_EDETACHED) {
3523                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3524         } else {
3525                 DO_ASSERT(get_jenv_res == JNI_OK);
3526         }
3527         LDKTransaction htlc_tx_var = htlc_tx;
3528         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3529         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3530         Transaction_free(htlc_tx_var);
3531         int64_t input_conv = input;
3532         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3533         int64_t htlc_descriptor_ref = 0;
3534         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3535         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3536         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3537         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3538         CHECK(obj != NULL);
3539         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3540         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3541                 (*env)->ExceptionDescribe(env);
3542                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3543         }
3544         void* ret_ptr = untag_ptr(ret);
3545         CHECK_ACCESS(ret_ptr);
3546         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3547         FREE(untag_ptr(ret));
3548         if (get_jenv_res == JNI_EDETACHED) {
3549                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3550         }
3551         return ret_conv;
3552 }
3553 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) {
3554         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3555         JNIEnv *env;
3556         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3557         if (get_jenv_res == JNI_EDETACHED) {
3558                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3559         } else {
3560                 DO_ASSERT(get_jenv_res == JNI_OK);
3561         }
3562         LDKTransaction htlc_tx_var = htlc_tx;
3563         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3564         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3565         Transaction_free(htlc_tx_var);
3566         int64_t input_conv = input;
3567         int64_t amount_conv = amount;
3568         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3569         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3570         LDKHTLCOutputInCommitment htlc_var = *htlc;
3571         int64_t htlc_ref = 0;
3572         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3573         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3574         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3575         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3576         CHECK(obj != NULL);
3577         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);
3578         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3579                 (*env)->ExceptionDescribe(env);
3580                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3581         }
3582         void* ret_ptr = untag_ptr(ret);
3583         CHECK_ACCESS(ret_ptr);
3584         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3585         FREE(untag_ptr(ret));
3586         if (get_jenv_res == JNI_EDETACHED) {
3587                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3588         }
3589         return ret_conv;
3590 }
3591 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3592         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3593         JNIEnv *env;
3594         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3595         if (get_jenv_res == JNI_EDETACHED) {
3596                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3597         } else {
3598                 DO_ASSERT(get_jenv_res == JNI_OK);
3599         }
3600         LDKClosingTransaction closing_tx_var = *closing_tx;
3601         int64_t closing_tx_ref = 0;
3602         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3603         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3604         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3605         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3606         CHECK(obj != NULL);
3607         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3608         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3609                 (*env)->ExceptionDescribe(env);
3610                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3611         }
3612         void* ret_ptr = untag_ptr(ret);
3613         CHECK_ACCESS(ret_ptr);
3614         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3615         FREE(untag_ptr(ret));
3616         if (get_jenv_res == JNI_EDETACHED) {
3617                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3618         }
3619         return ret_conv;
3620 }
3621 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3622         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3623         JNIEnv *env;
3624         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3625         if (get_jenv_res == JNI_EDETACHED) {
3626                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3627         } else {
3628                 DO_ASSERT(get_jenv_res == JNI_OK);
3629         }
3630         LDKTransaction anchor_tx_var = anchor_tx;
3631         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3632         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3633         Transaction_free(anchor_tx_var);
3634         int64_t input_conv = input;
3635         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3636         CHECK(obj != NULL);
3637         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3638         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3639                 (*env)->ExceptionDescribe(env);
3640                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3641         }
3642         void* ret_ptr = untag_ptr(ret);
3643         CHECK_ACCESS(ret_ptr);
3644         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3645         FREE(untag_ptr(ret));
3646         if (get_jenv_res == JNI_EDETACHED) {
3647                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3648         }
3649         return ret_conv;
3650 }
3651 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3652         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3653         JNIEnv *env;
3654         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3655         if (get_jenv_res == JNI_EDETACHED) {
3656                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3657         } else {
3658                 DO_ASSERT(get_jenv_res == JNI_OK);
3659         }
3660         LDKUnsignedChannelAnnouncement msg_var = *msg;
3661         int64_t msg_ref = 0;
3662         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3663         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3664         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3665         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3666         CHECK(obj != NULL);
3667         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3668         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3669                 (*env)->ExceptionDescribe(env);
3670                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3671         }
3672         void* ret_ptr = untag_ptr(ret);
3673         CHECK_ACCESS(ret_ptr);
3674         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3675         FREE(untag_ptr(ret));
3676         if (get_jenv_res == JNI_EDETACHED) {
3677                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3678         }
3679         return ret_conv;
3680 }
3681 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3682         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3683         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3684         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3685 }
3686 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3687         jclass c = (*env)->GetObjectClass(env, o);
3688         CHECK(c != NULL);
3689         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3690         atomic_init(&calls->refcnt, 1);
3691         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3692         calls->o = (*env)->NewWeakGlobalRef(env, o);
3693         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B[[B)J");
3694         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3695         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3696         CHECK(calls->sign_holder_commitment_meth != NULL);
3697         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3698         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3699         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3700         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3701         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3702         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3703         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3704         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3705         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3706         CHECK(calls->sign_closing_transaction_meth != NULL);
3707         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3708         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3709         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3710         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3711
3712         LDKChannelPublicKeys pubkeys_conv;
3713         pubkeys_conv.inner = untag_ptr(pubkeys);
3714         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3715         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3716
3717         LDKEcdsaChannelSigner ret = {
3718                 .this_arg = (void*) calls,
3719                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3720                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3721                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3722                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3723                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3724                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3725                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3726                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3727                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3728                 .free = LDKEcdsaChannelSigner_JCalls_free,
3729                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3730         };
3731         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3732         return ret;
3733 }
3734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3735         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3736         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3737         return tag_ptr(res_ptr, true);
3738 }
3739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3740         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3741         return tag_ptr(&inp->ChannelSigner, false);
3742 }
3743 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 inbound_htlc_preimages, jobjectArray outbound_htlc_preimages) {
3744         void* this_arg_ptr = untag_ptr(this_arg);
3745         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3746         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3747         LDKCommitmentTransaction commitment_tx_conv;
3748         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3749         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3750         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3751         commitment_tx_conv.is_owned = false;
3752         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
3753         inbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, inbound_htlc_preimages);
3754         if (inbound_htlc_preimages_constr.datalen > 0)
3755                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3756         else
3757                 inbound_htlc_preimages_constr.data = NULL;
3758         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
3759                 int8_tArray inbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, inbound_htlc_preimages, i);
3760                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
3761                 CHECK((*env)->GetArrayLength(env, inbound_htlc_preimages_conv_8) == 32);
3762                 (*env)->GetByteArrayRegion(env, inbound_htlc_preimages_conv_8, 0, 32, inbound_htlc_preimages_conv_8_ref.data);
3763                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
3764         }
3765         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3766         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3767         if (outbound_htlc_preimages_constr.datalen > 0)
3768                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3769         else
3770                 outbound_htlc_preimages_constr.data = NULL;
3771         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3772                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3773                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3774                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3775                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3776                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3777         }
3778         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3779         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
3780         return tag_ptr(ret_conv, true);
3781 }
3782
3783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
3784         void* this_arg_ptr = untag_ptr(this_arg);
3785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3786         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3787         LDKHolderCommitmentTransaction commitment_tx_conv;
3788         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3789         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3790         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3791         commitment_tx_conv.is_owned = false;
3792         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3793         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3794         return tag_ptr(ret_conv, true);
3795 }
3796
3797 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) {
3798         void* this_arg_ptr = untag_ptr(this_arg);
3799         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3800         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3801         LDKTransaction justice_tx_ref;
3802         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3803         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3804         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3805         justice_tx_ref.data_is_owned = true;
3806         uint8_t per_commitment_key_arr[32];
3807         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3808         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3809         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3810         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3811         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3812         return tag_ptr(ret_conv, true);
3813 }
3814
3815 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) {
3816         void* this_arg_ptr = untag_ptr(this_arg);
3817         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3818         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3819         LDKTransaction justice_tx_ref;
3820         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3821         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3822         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3823         justice_tx_ref.data_is_owned = true;
3824         uint8_t per_commitment_key_arr[32];
3825         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3826         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3827         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3828         LDKHTLCOutputInCommitment htlc_conv;
3829         htlc_conv.inner = untag_ptr(htlc);
3830         htlc_conv.is_owned = ptr_is_owned(htlc);
3831         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3832         htlc_conv.is_owned = false;
3833         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3834         *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);
3835         return tag_ptr(ret_conv, true);
3836 }
3837
3838 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) {
3839         void* this_arg_ptr = untag_ptr(this_arg);
3840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3841         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3842         LDKTransaction htlc_tx_ref;
3843         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3844         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3845         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3846         htlc_tx_ref.data_is_owned = true;
3847         LDKHTLCDescriptor htlc_descriptor_conv;
3848         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3849         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3850         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3851         htlc_descriptor_conv.is_owned = false;
3852         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3853         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3854         return tag_ptr(ret_conv, true);
3855 }
3856
3857 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) {
3858         void* this_arg_ptr = untag_ptr(this_arg);
3859         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3860         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3861         LDKTransaction htlc_tx_ref;
3862         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3863         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3864         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3865         htlc_tx_ref.data_is_owned = true;
3866         LDKPublicKey per_commitment_point_ref;
3867         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3868         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3869         LDKHTLCOutputInCommitment htlc_conv;
3870         htlc_conv.inner = untag_ptr(htlc);
3871         htlc_conv.is_owned = ptr_is_owned(htlc);
3872         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3873         htlc_conv.is_owned = false;
3874         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3875         *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);
3876         return tag_ptr(ret_conv, true);
3877 }
3878
3879 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) {
3880         void* this_arg_ptr = untag_ptr(this_arg);
3881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3882         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3883         LDKClosingTransaction closing_tx_conv;
3884         closing_tx_conv.inner = untag_ptr(closing_tx);
3885         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3886         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3887         closing_tx_conv.is_owned = false;
3888         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3889         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3890         return tag_ptr(ret_conv, true);
3891 }
3892
3893 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) {
3894         void* this_arg_ptr = untag_ptr(this_arg);
3895         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3896         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3897         LDKTransaction anchor_tx_ref;
3898         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3899         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3900         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3901         anchor_tx_ref.data_is_owned = true;
3902         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3903         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3904         return tag_ptr(ret_conv, true);
3905 }
3906
3907 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) {
3908         void* this_arg_ptr = untag_ptr(this_arg);
3909         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3910         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3911         LDKUnsignedChannelAnnouncement msg_conv;
3912         msg_conv.inner = untag_ptr(msg);
3913         msg_conv.is_owned = ptr_is_owned(msg);
3914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3915         msg_conv.is_owned = false;
3916         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3917         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3918         return tag_ptr(ret_conv, true);
3919 }
3920
3921 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3922         atomic_size_t refcnt;
3923         JavaVM *vm;
3924         jweak o;
3925         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3926         LDKChannelSigner_JCalls* ChannelSigner;
3927         jmethodID write_meth;
3928 } LDKWriteableEcdsaChannelSigner_JCalls;
3929 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3930         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3931         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3932                 JNIEnv *env;
3933                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3934                 if (get_jenv_res == JNI_EDETACHED) {
3935                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3936                 } else {
3937                         DO_ASSERT(get_jenv_res == JNI_OK);
3938                 }
3939                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3940                 if (get_jenv_res == JNI_EDETACHED) {
3941                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3942                 }
3943                 FREE(j_calls);
3944         }
3945 }
3946 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3947         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3948         JNIEnv *env;
3949         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3950         if (get_jenv_res == JNI_EDETACHED) {
3951                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3952         } else {
3953                 DO_ASSERT(get_jenv_res == JNI_OK);
3954         }
3955         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3956         CHECK(obj != NULL);
3957         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3958         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3959                 (*env)->ExceptionDescribe(env);
3960                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3961         }
3962         LDKCVec_u8Z ret_ref;
3963         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3964         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3965         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3966         if (get_jenv_res == JNI_EDETACHED) {
3967                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3968         }
3969         return ret_ref;
3970 }
3971 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3972         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3973         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3974         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3975         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3976 }
3977 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3978         jclass c = (*env)->GetObjectClass(env, o);
3979         CHECK(c != NULL);
3980         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3981         atomic_init(&calls->refcnt, 1);
3982         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3983         calls->o = (*env)->NewWeakGlobalRef(env, o);
3984         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3985         CHECK(calls->write_meth != NULL);
3986
3987         LDKChannelPublicKeys pubkeys_conv;
3988         pubkeys_conv.inner = untag_ptr(pubkeys);
3989         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3990         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3991
3992         LDKWriteableEcdsaChannelSigner ret = {
3993                 .this_arg = (void*) calls,
3994                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3995                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3996                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3997                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3998         };
3999         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
4000         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
4001         return ret;
4002 }
4003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
4004         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4005         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
4006         return tag_ptr(res_ptr, true);
4007 }
4008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
4009         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
4010         return tag_ptr(&inp->EcdsaChannelSigner, false);
4011 }
4012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
4013         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
4014         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
4015 }
4016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4017         void* this_arg_ptr = untag_ptr(this_arg);
4018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4019         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
4020         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4021         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4022         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4023         CVec_u8Z_free(ret_var);
4024         return ret_arr;
4025 }
4026
4027 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4028 CHECK(owner->result_ok);
4029         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
4030 }
4031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4032         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4033         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
4034         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
4035         return tag_ptr(ret_ret, true);
4036 }
4037
4038 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
4039 CHECK(!owner->result_ok);
4040         return DecodeError_clone(&*owner->contents.err);
4041 }
4042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4043         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
4044         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4045         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
4046         int64_t ret_ref = tag_ptr(ret_copy, true);
4047         return ret_ref;
4048 }
4049
4050 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
4051 CHECK(owner->result_ok);
4052         return CVec_u8Z_clone(&*owner->contents.result);
4053 }
4054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4055         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
4056         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
4057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4059         CVec_u8Z_free(ret_var);
4060         return ret_arr;
4061 }
4062
4063 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
4064 CHECK(!owner->result_ok);
4065         return *owner->contents.err;
4066 }
4067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4068         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
4069         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
4070 }
4071
4072 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
4073         LDKShutdownScript ret = *owner->contents.result;
4074         ret.is_owned = false;
4075         return ret;
4076 }
4077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4078         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
4079         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
4080         int64_t ret_ref = 0;
4081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4083         return ret_ref;
4084 }
4085
4086 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
4087 CHECK(!owner->result_ok);
4088         return *owner->contents.err;
4089 }
4090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4091         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
4092         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
4093 }
4094
4095 static jclass LDKCOption_u16Z_Some_class = NULL;
4096 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4097 static jclass LDKCOption_u16Z_None_class = NULL;
4098 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4100         LDKCOption_u16Z_Some_class =
4101                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4102         CHECK(LDKCOption_u16Z_Some_class != NULL);
4103         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4104         CHECK(LDKCOption_u16Z_Some_meth != NULL);
4105         LDKCOption_u16Z_None_class =
4106                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4107         CHECK(LDKCOption_u16Z_None_class != NULL);
4108         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4109         CHECK(LDKCOption_u16Z_None_meth != NULL);
4110 }
4111 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4112         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4113         switch(obj->tag) {
4114                 case LDKCOption_u16Z_Some: {
4115                         int16_t some_conv = obj->some;
4116                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
4117                 }
4118                 case LDKCOption_u16Z_None: {
4119                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4120                 }
4121                 default: abort();
4122         }
4123 }
4124 static jclass LDKCOption_boolZ_Some_class = NULL;
4125 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
4126 static jclass LDKCOption_boolZ_None_class = NULL;
4127 static jmethodID LDKCOption_boolZ_None_meth = NULL;
4128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
4129         LDKCOption_boolZ_Some_class =
4130                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
4131         CHECK(LDKCOption_boolZ_Some_class != NULL);
4132         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
4133         CHECK(LDKCOption_boolZ_Some_meth != NULL);
4134         LDKCOption_boolZ_None_class =
4135                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
4136         CHECK(LDKCOption_boolZ_None_class != NULL);
4137         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
4138         CHECK(LDKCOption_boolZ_None_meth != NULL);
4139 }
4140 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4141         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
4142         switch(obj->tag) {
4143                 case LDKCOption_boolZ_Some: {
4144                         jboolean some_conv = obj->some;
4145                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
4146                 }
4147                 case LDKCOption_boolZ_None: {
4148                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
4149                 }
4150                 default: abort();
4151         }
4152 }
4153 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
4154 CHECK(owner->result_ok);
4155         return Witness_clone(&*owner->contents.result);
4156 }
4157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4158         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
4159         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
4160         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4161         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4162         Witness_free(ret_var);
4163         return ret_arr;
4164 }
4165
4166 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
4167 CHECK(!owner->result_ok);
4168         return *owner->contents.err;
4169 }
4170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4171         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
4172         CResult_WitnessNoneZ_get_err(owner_conv);
4173 }
4174
4175 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4176         LDKInMemorySigner ret = *owner->contents.result;
4177         ret.is_owned = false;
4178         return ret;
4179 }
4180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4181         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4182         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4183         int64_t ret_ref = 0;
4184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4186         return ret_ref;
4187 }
4188
4189 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4190 CHECK(!owner->result_ok);
4191         return DecodeError_clone(&*owner->contents.err);
4192 }
4193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4194         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4195         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4196         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4197         int64_t ret_ref = tag_ptr(ret_copy, true);
4198         return ret_ref;
4199 }
4200
4201 static jclass LDKCandidateRouteHop_FirstHop_class = NULL;
4202 static jmethodID LDKCandidateRouteHop_FirstHop_meth = NULL;
4203 static jclass LDKCandidateRouteHop_PublicHop_class = NULL;
4204 static jmethodID LDKCandidateRouteHop_PublicHop_meth = NULL;
4205 static jclass LDKCandidateRouteHop_PrivateHop_class = NULL;
4206 static jmethodID LDKCandidateRouteHop_PrivateHop_meth = NULL;
4207 static jclass LDKCandidateRouteHop_Blinded_class = NULL;
4208 static jmethodID LDKCandidateRouteHop_Blinded_meth = NULL;
4209 static jclass LDKCandidateRouteHop_OneHopBlinded_class = NULL;
4210 static jmethodID LDKCandidateRouteHop_OneHopBlinded_meth = NULL;
4211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCandidateRouteHop_init (JNIEnv *env, jclass clz) {
4212         LDKCandidateRouteHop_FirstHop_class =
4213                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$FirstHop"));
4214         CHECK(LDKCandidateRouteHop_FirstHop_class != NULL);
4215         LDKCandidateRouteHop_FirstHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_FirstHop_class, "<init>", "(J)V");
4216         CHECK(LDKCandidateRouteHop_FirstHop_meth != NULL);
4217         LDKCandidateRouteHop_PublicHop_class =
4218                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PublicHop"));
4219         CHECK(LDKCandidateRouteHop_PublicHop_class != NULL);
4220         LDKCandidateRouteHop_PublicHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PublicHop_class, "<init>", "(J)V");
4221         CHECK(LDKCandidateRouteHop_PublicHop_meth != NULL);
4222         LDKCandidateRouteHop_PrivateHop_class =
4223                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PrivateHop"));
4224         CHECK(LDKCandidateRouteHop_PrivateHop_class != NULL);
4225         LDKCandidateRouteHop_PrivateHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PrivateHop_class, "<init>", "(J)V");
4226         CHECK(LDKCandidateRouteHop_PrivateHop_meth != NULL);
4227         LDKCandidateRouteHop_Blinded_class =
4228                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$Blinded"));
4229         CHECK(LDKCandidateRouteHop_Blinded_class != NULL);
4230         LDKCandidateRouteHop_Blinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_Blinded_class, "<init>", "(J)V");
4231         CHECK(LDKCandidateRouteHop_Blinded_meth != NULL);
4232         LDKCandidateRouteHop_OneHopBlinded_class =
4233                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$OneHopBlinded"));
4234         CHECK(LDKCandidateRouteHop_OneHopBlinded_class != NULL);
4235         LDKCandidateRouteHop_OneHopBlinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_OneHopBlinded_class, "<init>", "(J)V");
4236         CHECK(LDKCandidateRouteHop_OneHopBlinded_meth != NULL);
4237 }
4238 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCandidateRouteHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4239         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
4240         switch(obj->tag) {
4241                 case LDKCandidateRouteHop_FirstHop: {
4242                         LDKFirstHopCandidate first_hop_var = obj->first_hop;
4243                         int64_t first_hop_ref = 0;
4244                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
4245                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
4246                         return (*env)->NewObject(env, LDKCandidateRouteHop_FirstHop_class, LDKCandidateRouteHop_FirstHop_meth, first_hop_ref);
4247                 }
4248                 case LDKCandidateRouteHop_PublicHop: {
4249                         LDKPublicHopCandidate public_hop_var = obj->public_hop;
4250                         int64_t public_hop_ref = 0;
4251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
4252                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
4253                         return (*env)->NewObject(env, LDKCandidateRouteHop_PublicHop_class, LDKCandidateRouteHop_PublicHop_meth, public_hop_ref);
4254                 }
4255                 case LDKCandidateRouteHop_PrivateHop: {
4256                         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
4257                         int64_t private_hop_ref = 0;
4258                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
4259                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
4260                         return (*env)->NewObject(env, LDKCandidateRouteHop_PrivateHop_class, LDKCandidateRouteHop_PrivateHop_meth, private_hop_ref);
4261                 }
4262                 case LDKCandidateRouteHop_Blinded: {
4263                         LDKBlindedPathCandidate blinded_var = obj->blinded;
4264                         int64_t blinded_ref = 0;
4265                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
4266                         blinded_ref = tag_ptr(blinded_var.inner, false);
4267                         return (*env)->NewObject(env, LDKCandidateRouteHop_Blinded_class, LDKCandidateRouteHop_Blinded_meth, blinded_ref);
4268                 }
4269                 case LDKCandidateRouteHop_OneHopBlinded: {
4270                         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
4271                         int64_t one_hop_blinded_ref = 0;
4272                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
4273                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
4274                         return (*env)->NewObject(env, LDKCandidateRouteHop_OneHopBlinded_class, LDKCandidateRouteHop_OneHopBlinded_meth, one_hop_blinded_ref);
4275                 }
4276                 default: abort();
4277         }
4278 }
4279 typedef struct LDKScoreLookUp_JCalls {
4280         atomic_size_t refcnt;
4281         JavaVM *vm;
4282         jweak o;
4283         jmethodID channel_penalty_msat_meth;
4284 } LDKScoreLookUp_JCalls;
4285 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
4286         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
4287         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4288                 JNIEnv *env;
4289                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4290                 if (get_jenv_res == JNI_EDETACHED) {
4291                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4292                 } else {
4293                         DO_ASSERT(get_jenv_res == JNI_OK);
4294                 }
4295                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4296                 if (get_jenv_res == JNI_EDETACHED) {
4297                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4298                 }
4299                 FREE(j_calls);
4300         }
4301 }
4302 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
4303         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
4304         JNIEnv *env;
4305         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4306         if (get_jenv_res == JNI_EDETACHED) {
4307                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4308         } else {
4309                 DO_ASSERT(get_jenv_res == JNI_OK);
4310         }
4311         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
4312         *ret_candidate = CandidateRouteHop_clone(candidate);
4313         int64_t ref_candidate = tag_ptr(ret_candidate, true);
4314         LDKChannelUsage usage_var = usage;
4315         int64_t usage_ref = 0;
4316         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
4317         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
4318         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
4319         int64_t score_params_ref = 0;
4320         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
4321         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
4322         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
4323         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4324         CHECK(obj != NULL);
4325         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, ref_candidate, usage_ref, score_params_ref);
4326         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4327                 (*env)->ExceptionDescribe(env);
4328                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
4329         }
4330         if (get_jenv_res == JNI_EDETACHED) {
4331                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4332         }
4333         return ret;
4334 }
4335 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
4336         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
4337         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4338 }
4339 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
4340         jclass c = (*env)->GetObjectClass(env, o);
4341         CHECK(c != NULL);
4342         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
4343         atomic_init(&calls->refcnt, 1);
4344         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4345         calls->o = (*env)->NewWeakGlobalRef(env, o);
4346         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J");
4347         CHECK(calls->channel_penalty_msat_meth != NULL);
4348
4349         LDKScoreLookUp ret = {
4350                 .this_arg = (void*) calls,
4351                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
4352                 .free = LDKScoreLookUp_JCalls_free,
4353         };
4354         return ret;
4355 }
4356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
4357         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4358         *res_ptr = LDKScoreLookUp_init(env, clz, o);
4359         return tag_ptr(res_ptr, true);
4360 }
4361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
4362         void* this_arg_ptr = untag_ptr(this_arg);
4363         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4364         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
4365         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
4366         LDKChannelUsage usage_conv;
4367         usage_conv.inner = untag_ptr(usage);
4368         usage_conv.is_owned = ptr_is_owned(usage);
4369         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
4370         usage_conv = ChannelUsage_clone(&usage_conv);
4371         LDKProbabilisticScoringFeeParameters score_params_conv;
4372         score_params_conv.inner = untag_ptr(score_params);
4373         score_params_conv.is_owned = ptr_is_owned(score_params);
4374         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
4375         score_params_conv.is_owned = false;
4376         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
4377         return ret_conv;
4378 }
4379
4380 typedef struct LDKScoreUpdate_JCalls {
4381         atomic_size_t refcnt;
4382         JavaVM *vm;
4383         jweak o;
4384         jmethodID payment_path_failed_meth;
4385         jmethodID payment_path_successful_meth;
4386         jmethodID probe_failed_meth;
4387         jmethodID probe_successful_meth;
4388         jmethodID time_passed_meth;
4389 } LDKScoreUpdate_JCalls;
4390 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
4391         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4392         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4393                 JNIEnv *env;
4394                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4395                 if (get_jenv_res == JNI_EDETACHED) {
4396                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4397                 } else {
4398                         DO_ASSERT(get_jenv_res == JNI_OK);
4399                 }
4400                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4401                 if (get_jenv_res == JNI_EDETACHED) {
4402                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4403                 }
4404                 FREE(j_calls);
4405         }
4406 }
4407 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4408         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4409         JNIEnv *env;
4410         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4411         if (get_jenv_res == JNI_EDETACHED) {
4412                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4413         } else {
4414                 DO_ASSERT(get_jenv_res == JNI_OK);
4415         }
4416         LDKPath path_var = *path;
4417         int64_t path_ref = 0;
4418         path_var = Path_clone(&path_var);
4419         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4420         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4421         int64_t short_channel_id_conv = short_channel_id;
4422         int64_t duration_since_epoch_conv = duration_since_epoch;
4423         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4424         CHECK(obj != NULL);
4425         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4426         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4427                 (*env)->ExceptionDescribe(env);
4428                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
4429         }
4430         if (get_jenv_res == JNI_EDETACHED) {
4431                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4432         }
4433 }
4434 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4435         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4436         JNIEnv *env;
4437         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4438         if (get_jenv_res == JNI_EDETACHED) {
4439                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4440         } else {
4441                 DO_ASSERT(get_jenv_res == JNI_OK);
4442         }
4443         LDKPath path_var = *path;
4444         int64_t path_ref = 0;
4445         path_var = Path_clone(&path_var);
4446         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4447         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4448         int64_t duration_since_epoch_conv = duration_since_epoch;
4449         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4450         CHECK(obj != NULL);
4451         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref, duration_since_epoch_conv);
4452         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4453                 (*env)->ExceptionDescribe(env);
4454                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
4455         }
4456         if (get_jenv_res == JNI_EDETACHED) {
4457                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4458         }
4459 }
4460 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4461         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4462         JNIEnv *env;
4463         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4464         if (get_jenv_res == JNI_EDETACHED) {
4465                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4466         } else {
4467                 DO_ASSERT(get_jenv_res == JNI_OK);
4468         }
4469         LDKPath path_var = *path;
4470         int64_t path_ref = 0;
4471         path_var = Path_clone(&path_var);
4472         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4473         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4474         int64_t short_channel_id_conv = short_channel_id;
4475         int64_t duration_since_epoch_conv = duration_since_epoch;
4476         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4477         CHECK(obj != NULL);
4478         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4479         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4480                 (*env)->ExceptionDescribe(env);
4481                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4482         }
4483         if (get_jenv_res == JNI_EDETACHED) {
4484                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4485         }
4486 }
4487 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4488         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4489         JNIEnv *env;
4490         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4491         if (get_jenv_res == JNI_EDETACHED) {
4492                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4493         } else {
4494                 DO_ASSERT(get_jenv_res == JNI_OK);
4495         }
4496         LDKPath path_var = *path;
4497         int64_t path_ref = 0;
4498         path_var = Path_clone(&path_var);
4499         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4500         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4501         int64_t duration_since_epoch_conv = duration_since_epoch;
4502         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4503         CHECK(obj != NULL);
4504         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref, duration_since_epoch_conv);
4505         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4506                 (*env)->ExceptionDescribe(env);
4507                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4508         }
4509         if (get_jenv_res == JNI_EDETACHED) {
4510                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4511         }
4512 }
4513 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
4514         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4515         JNIEnv *env;
4516         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4517         if (get_jenv_res == JNI_EDETACHED) {
4518                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4519         } else {
4520                 DO_ASSERT(get_jenv_res == JNI_OK);
4521         }
4522         int64_t duration_since_epoch_conv = duration_since_epoch;
4523         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4524         CHECK(obj != NULL);
4525         (*env)->CallVoidMethod(env, obj, j_calls->time_passed_meth, duration_since_epoch_conv);
4526         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4527                 (*env)->ExceptionDescribe(env);
4528                 (*env)->FatalError(env, "A call to time_passed in LDKScoreUpdate from rust threw an exception.");
4529         }
4530         if (get_jenv_res == JNI_EDETACHED) {
4531                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4532         }
4533 }
4534 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4535         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4536         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4537 }
4538 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4539         jclass c = (*env)->GetObjectClass(env, o);
4540         CHECK(c != NULL);
4541         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4542         atomic_init(&calls->refcnt, 1);
4543         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4544         calls->o = (*env)->NewWeakGlobalRef(env, o);
4545         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJJ)V");
4546         CHECK(calls->payment_path_failed_meth != NULL);
4547         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(JJ)V");
4548         CHECK(calls->payment_path_successful_meth != NULL);
4549         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJJ)V");
4550         CHECK(calls->probe_failed_meth != NULL);
4551         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(JJ)V");
4552         CHECK(calls->probe_successful_meth != NULL);
4553         calls->time_passed_meth = (*env)->GetMethodID(env, c, "time_passed", "(J)V");
4554         CHECK(calls->time_passed_meth != NULL);
4555
4556         LDKScoreUpdate ret = {
4557                 .this_arg = (void*) calls,
4558                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4559                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4560                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4561                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4562                 .time_passed = time_passed_LDKScoreUpdate_jcall,
4563                 .free = LDKScoreUpdate_JCalls_free,
4564         };
4565         return ret;
4566 }
4567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4568         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4569         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4570         return tag_ptr(res_ptr, true);
4571 }
4572 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, int64_t duration_since_epoch) {
4573         void* this_arg_ptr = untag_ptr(this_arg);
4574         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4575         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4576         LDKPath path_conv;
4577         path_conv.inner = untag_ptr(path);
4578         path_conv.is_owned = ptr_is_owned(path);
4579         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4580         path_conv.is_owned = false;
4581         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4582 }
4583
4584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
4585         void* this_arg_ptr = untag_ptr(this_arg);
4586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4587         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4588         LDKPath path_conv;
4589         path_conv.inner = untag_ptr(path);
4590         path_conv.is_owned = ptr_is_owned(path);
4591         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4592         path_conv.is_owned = false;
4593         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4594 }
4595
4596 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, int64_t duration_since_epoch) {
4597         void* this_arg_ptr = untag_ptr(this_arg);
4598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4599         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4600         LDKPath path_conv;
4601         path_conv.inner = untag_ptr(path);
4602         path_conv.is_owned = ptr_is_owned(path);
4603         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4604         path_conv.is_owned = false;
4605         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4606 }
4607
4608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
4609         void* this_arg_ptr = untag_ptr(this_arg);
4610         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4611         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4612         LDKPath path_conv;
4613         path_conv.inner = untag_ptr(path);
4614         path_conv.is_owned = ptr_is_owned(path);
4615         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4616         path_conv.is_owned = false;
4617         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4618 }
4619
4620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1time_1passed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
4621         void* this_arg_ptr = untag_ptr(this_arg);
4622         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4623         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4624         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
4625 }
4626
4627 typedef struct LDKLockableScore_JCalls {
4628         atomic_size_t refcnt;
4629         JavaVM *vm;
4630         jweak o;
4631         jmethodID read_lock_meth;
4632         jmethodID write_lock_meth;
4633 } LDKLockableScore_JCalls;
4634 static void LDKLockableScore_JCalls_free(void* this_arg) {
4635         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4636         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4637                 JNIEnv *env;
4638                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4639                 if (get_jenv_res == JNI_EDETACHED) {
4640                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4641                 } else {
4642                         DO_ASSERT(get_jenv_res == JNI_OK);
4643                 }
4644                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4645                 if (get_jenv_res == JNI_EDETACHED) {
4646                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4647                 }
4648                 FREE(j_calls);
4649         }
4650 }
4651 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4652         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4653         JNIEnv *env;
4654         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4655         if (get_jenv_res == JNI_EDETACHED) {
4656                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4657         } else {
4658                 DO_ASSERT(get_jenv_res == JNI_OK);
4659         }
4660         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4661         CHECK(obj != NULL);
4662         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4663         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4664                 (*env)->ExceptionDescribe(env);
4665                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4666         }
4667         void* ret_ptr = untag_ptr(ret);
4668         CHECK_ACCESS(ret_ptr);
4669         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4670         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4671                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4672                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4673         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4674         
4675         if (get_jenv_res == JNI_EDETACHED) {
4676                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4677         }
4678         return ret_conv;
4679 }
4680 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4681         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4682         JNIEnv *env;
4683         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4684         if (get_jenv_res == JNI_EDETACHED) {
4685                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4686         } else {
4687                 DO_ASSERT(get_jenv_res == JNI_OK);
4688         }
4689         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4690         CHECK(obj != NULL);
4691         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4692         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4693                 (*env)->ExceptionDescribe(env);
4694                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4695         }
4696         void* ret_ptr = untag_ptr(ret);
4697         CHECK_ACCESS(ret_ptr);
4698         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4699         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4701                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4702         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4703         
4704         if (get_jenv_res == JNI_EDETACHED) {
4705                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4706         }
4707         return ret_conv;
4708 }
4709 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4710         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4711         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4712 }
4713 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4714         jclass c = (*env)->GetObjectClass(env, o);
4715         CHECK(c != NULL);
4716         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4717         atomic_init(&calls->refcnt, 1);
4718         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4719         calls->o = (*env)->NewWeakGlobalRef(env, o);
4720         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4721         CHECK(calls->read_lock_meth != NULL);
4722         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4723         CHECK(calls->write_lock_meth != NULL);
4724
4725         LDKLockableScore ret = {
4726                 .this_arg = (void*) calls,
4727                 .read_lock = read_lock_LDKLockableScore_jcall,
4728                 .write_lock = write_lock_LDKLockableScore_jcall,
4729                 .free = LDKLockableScore_JCalls_free,
4730         };
4731         return ret;
4732 }
4733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4734         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4735         *res_ptr = LDKLockableScore_init(env, clz, o);
4736         return tag_ptr(res_ptr, true);
4737 }
4738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4739         void* this_arg_ptr = untag_ptr(this_arg);
4740         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4741         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4742         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4743         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4744         return tag_ptr(ret_ret, true);
4745 }
4746
4747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4748         void* this_arg_ptr = untag_ptr(this_arg);
4749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4750         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4751         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4752         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4753         return tag_ptr(ret_ret, true);
4754 }
4755
4756 typedef struct LDKWriteableScore_JCalls {
4757         atomic_size_t refcnt;
4758         JavaVM *vm;
4759         jweak o;
4760         LDKLockableScore_JCalls* LockableScore;
4761         jmethodID write_meth;
4762 } LDKWriteableScore_JCalls;
4763 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4764         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4765         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4766                 JNIEnv *env;
4767                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4768                 if (get_jenv_res == JNI_EDETACHED) {
4769                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4770                 } else {
4771                         DO_ASSERT(get_jenv_res == JNI_OK);
4772                 }
4773                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4774                 if (get_jenv_res == JNI_EDETACHED) {
4775                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4776                 }
4777                 FREE(j_calls);
4778         }
4779 }
4780 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4781         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4782         JNIEnv *env;
4783         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4784         if (get_jenv_res == JNI_EDETACHED) {
4785                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4786         } else {
4787                 DO_ASSERT(get_jenv_res == JNI_OK);
4788         }
4789         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4790         CHECK(obj != NULL);
4791         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4792         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4793                 (*env)->ExceptionDescribe(env);
4794                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4795         }
4796         LDKCVec_u8Z ret_ref;
4797         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4798         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4799         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4800         if (get_jenv_res == JNI_EDETACHED) {
4801                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4802         }
4803         return ret_ref;
4804 }
4805 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4806         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4807         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4808         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4809 }
4810 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4811         jclass c = (*env)->GetObjectClass(env, o);
4812         CHECK(c != NULL);
4813         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4814         atomic_init(&calls->refcnt, 1);
4815         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4816         calls->o = (*env)->NewWeakGlobalRef(env, o);
4817         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4818         CHECK(calls->write_meth != NULL);
4819
4820         LDKWriteableScore ret = {
4821                 .this_arg = (void*) calls,
4822                 .write = write_LDKWriteableScore_jcall,
4823                 .free = LDKWriteableScore_JCalls_free,
4824                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4825         };
4826         calls->LockableScore = ret.LockableScore.this_arg;
4827         return ret;
4828 }
4829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4830         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4831         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4832         return tag_ptr(res_ptr, true);
4833 }
4834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4835         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4836         return tag_ptr(&inp->LockableScore, false);
4837 }
4838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4839         void* this_arg_ptr = untag_ptr(this_arg);
4840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4841         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4842         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4843         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4844         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4845         CVec_u8Z_free(ret_var);
4846         return ret_arr;
4847 }
4848
4849 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4850 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4851 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4852 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4854         LDKCOption_WriteableScoreZ_Some_class =
4855                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4856         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4857         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4858         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4859         LDKCOption_WriteableScoreZ_None_class =
4860                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4861         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4862         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4863         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4864 }
4865 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4866         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4867         switch(obj->tag) {
4868                 case LDKCOption_WriteableScoreZ_Some: {
4869                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4870                         *some_ret = obj->some;
4871                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4872                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4873                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4874                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4875                         }
4876                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4877                 }
4878                 case LDKCOption_WriteableScoreZ_None: {
4879                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4880                 }
4881                 default: abort();
4882         }
4883 }
4884 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4885 CHECK(owner->result_ok);
4886         return *owner->contents.result;
4887 }
4888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4889         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4890         CResult_NoneIOErrorZ_get_ok(owner_conv);
4891 }
4892
4893 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4894 CHECK(!owner->result_ok);
4895         return *owner->contents.err;
4896 }
4897 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4898         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4899         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4900         return ret_conv;
4901 }
4902
4903 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4904         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4905         for (size_t i = 0; i < ret.datalen; i++) {
4906                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4907         }
4908         return ret;
4909 }
4910 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4911         LDKRoute ret = *owner->contents.result;
4912         ret.is_owned = false;
4913         return ret;
4914 }
4915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4916         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4917         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4918         int64_t ret_ref = 0;
4919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4921         return ret_ref;
4922 }
4923
4924 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4925         LDKLightningError ret = *owner->contents.err;
4926         ret.is_owned = false;
4927         return ret;
4928 }
4929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4930         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4931         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4932         int64_t ret_ref = 0;
4933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4935         return ret_ref;
4936 }
4937
4938 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4939         LDKBlindedPayInfo ret = owner->a;
4940         ret.is_owned = false;
4941         return ret;
4942 }
4943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4944         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4945         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4946         int64_t ret_ref = 0;
4947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4949         return ret_ref;
4950 }
4951
4952 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4953         LDKBlindedPath ret = owner->b;
4954         ret.is_owned = false;
4955         return ret;
4956 }
4957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4958         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4959         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4960         int64_t ret_ref = 0;
4961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4963         return ret_ref;
4964 }
4965
4966 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4967         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4968         for (size_t i = 0; i < ret.datalen; i++) {
4969                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4970         }
4971         return ret;
4972 }
4973 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4974 CHECK(owner->result_ok);
4975         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
4976 }
4977 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4978         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4979         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
4980         int64_tArray ret_arr = NULL;
4981         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4982         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4983         for (size_t l = 0; l < ret_var.datalen; l++) {
4984                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
4985                 *ret_conv_37_conv = ret_var.data[l];
4986                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
4987         }
4988         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4989         FREE(ret_var.data);
4990         return ret_arr;
4991 }
4992
4993 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4994 CHECK(!owner->result_ok);
4995         return *owner->contents.err;
4996 }
4997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4998         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4999         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
5000 }
5001
5002 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
5003         LDKOnionMessagePath ret = *owner->contents.result;
5004         ret.is_owned = false;
5005         return ret;
5006 }
5007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5008         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
5009         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
5010         int64_t ret_ref = 0;
5011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5013         return ret_ref;
5014 }
5015
5016 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
5017 CHECK(!owner->result_ok);
5018         return *owner->contents.err;
5019 }
5020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5021         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
5022         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
5023 }
5024
5025 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
5026 CHECK(owner->result_ok);
5027         return CVec_BlindedPathZ_clone(&*owner->contents.result);
5028 }
5029 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5030         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
5031         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
5032         int64_tArray ret_arr = NULL;
5033         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5034         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5035         for (size_t n = 0; n < ret_var.datalen; n++) {
5036                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
5037                 int64_t ret_conv_13_ref = 0;
5038                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
5039                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
5040                 ret_arr_ptr[n] = ret_conv_13_ref;
5041         }
5042         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5043         FREE(ret_var.data);
5044         return ret_arr;
5045 }
5046
5047 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
5048 CHECK(!owner->result_ok);
5049         return *owner->contents.err;
5050 }
5051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5052         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
5053         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
5054 }
5055
5056 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5057         LDKInFlightHtlcs ret = *owner->contents.result;
5058         ret.is_owned = false;
5059         return ret;
5060 }
5061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5062         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5063         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
5064         int64_t ret_ref = 0;
5065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5067         return ret_ref;
5068 }
5069
5070 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5071 CHECK(!owner->result_ok);
5072         return DecodeError_clone(&*owner->contents.err);
5073 }
5074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5075         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5076         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5077         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
5078         int64_t ret_ref = tag_ptr(ret_copy, true);
5079         return ret_ref;
5080 }
5081
5082 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
5083         LDKRouteHop ret = *owner->contents.result;
5084         ret.is_owned = false;
5085         return ret;
5086 }
5087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5088         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
5089         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
5090         int64_t ret_ref = 0;
5091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5093         return ret_ref;
5094 }
5095
5096 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
5097 CHECK(!owner->result_ok);
5098         return DecodeError_clone(&*owner->contents.err);
5099 }
5100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5101         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
5102         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5103         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
5104         int64_t ret_ref = tag_ptr(ret_copy, true);
5105         return ret_ref;
5106 }
5107
5108 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
5109         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
5110         for (size_t i = 0; i < ret.datalen; i++) {
5111                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
5112         }
5113         return ret;
5114 }
5115 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
5116         LDKBlindedTail ret = *owner->contents.result;
5117         ret.is_owned = false;
5118         return ret;
5119 }
5120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5121         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
5122         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
5123         int64_t ret_ref = 0;
5124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5126         return ret_ref;
5127 }
5128
5129 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
5130 CHECK(!owner->result_ok);
5131         return DecodeError_clone(&*owner->contents.err);
5132 }
5133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5134         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
5135         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5136         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
5137         int64_t ret_ref = tag_ptr(ret_copy, true);
5138         return ret_ref;
5139 }
5140
5141 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
5142         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
5143         for (size_t i = 0; i < ret.datalen; i++) {
5144                 ret.data[i] = RouteHop_clone(&orig->data[i]);
5145         }
5146         return ret;
5147 }
5148 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
5149         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
5150         for (size_t i = 0; i < ret.datalen; i++) {
5151                 ret.data[i] = Path_clone(&orig->data[i]);
5152         }
5153         return ret;
5154 }
5155 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
5156         LDKRoute ret = *owner->contents.result;
5157         ret.is_owned = false;
5158         return ret;
5159 }
5160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5161         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
5162         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
5163         int64_t ret_ref = 0;
5164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5166         return ret_ref;
5167 }
5168
5169 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
5170 CHECK(!owner->result_ok);
5171         return DecodeError_clone(&*owner->contents.err);
5172 }
5173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5174         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
5175         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5176         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
5177         int64_t ret_ref = tag_ptr(ret_copy, true);
5178         return ret_ref;
5179 }
5180
5181 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
5182         LDKRouteParameters ret = *owner->contents.result;
5183         ret.is_owned = false;
5184         return ret;
5185 }
5186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5187         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
5188         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
5189         int64_t ret_ref = 0;
5190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5192         return ret_ref;
5193 }
5194
5195 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
5196 CHECK(!owner->result_ok);
5197         return DecodeError_clone(&*owner->contents.err);
5198 }
5199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5200         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
5201         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5202         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
5203         int64_t ret_ref = tag_ptr(ret_copy, true);
5204         return ret_ref;
5205 }
5206
5207 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5208         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5209         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5210         return ret;
5211 }
5212 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
5213         LDKPaymentParameters ret = *owner->contents.result;
5214         ret.is_owned = false;
5215         return ret;
5216 }
5217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5218         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
5219         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
5220         int64_t ret_ref = 0;
5221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5223         return ret_ref;
5224 }
5225
5226 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
5227 CHECK(!owner->result_ok);
5228         return DecodeError_clone(&*owner->contents.err);
5229 }
5230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5231         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
5232         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5233         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
5234         int64_t ret_ref = tag_ptr(ret_copy, true);
5235         return ret_ref;
5236 }
5237
5238 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
5239         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
5240         for (size_t i = 0; i < ret.datalen; i++) {
5241                 ret.data[i] = RouteHint_clone(&orig->data[i]);
5242         }
5243         return ret;
5244 }
5245 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
5246         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
5247         for (size_t i = 0; i < ret.datalen; i++) {
5248                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
5249         }
5250         return ret;
5251 }
5252 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
5253         LDKRouteHint ret = *owner->contents.result;
5254         ret.is_owned = false;
5255         return ret;
5256 }
5257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5258         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
5259         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
5260         int64_t ret_ref = 0;
5261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5263         return ret_ref;
5264 }
5265
5266 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
5267 CHECK(!owner->result_ok);
5268         return DecodeError_clone(&*owner->contents.err);
5269 }
5270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5271         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
5272         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5273         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
5274         int64_t ret_ref = tag_ptr(ret_copy, true);
5275         return ret_ref;
5276 }
5277
5278 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
5279         LDKRouteHintHop ret = *owner->contents.result;
5280         ret.is_owned = false;
5281         return ret;
5282 }
5283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5284         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
5285         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
5286         int64_t ret_ref = 0;
5287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5289         return ret_ref;
5290 }
5291
5292 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
5293 CHECK(!owner->result_ok);
5294         return DecodeError_clone(&*owner->contents.err);
5295 }
5296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5297         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
5298         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5299         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
5300         int64_t ret_ref = tag_ptr(ret_copy, true);
5301         return ret_ref;
5302 }
5303
5304 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
5305         LDKFixedPenaltyScorer ret = *owner->contents.result;
5306         ret.is_owned = false;
5307         return ret;
5308 }
5309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5310         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
5311         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
5312         int64_t ret_ref = 0;
5313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5315         return ret_ref;
5316 }
5317
5318 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
5319 CHECK(!owner->result_ok);
5320         return DecodeError_clone(&*owner->contents.err);
5321 }
5322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5323         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
5324         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5325         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
5326         int64_t ret_ref = tag_ptr(ret_copy, true);
5327         return ret_ref;
5328 }
5329
5330 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
5331         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
5332         for (size_t i = 0; i < ret.datalen; i++) {
5333                 ret.data[i] = NodeId_clone(&orig->data[i]);
5334         }
5335         return ret;
5336 }
5337 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
5338         return owner->a;
5339 }
5340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5341         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
5342         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
5343         return ret_conv;
5344 }
5345
5346 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
5347         return owner->b;
5348 }
5349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5350         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
5351         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
5352         return ret_conv;
5353 }
5354
5355 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
5356 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
5357 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
5358 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
5359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
5360         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
5361                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
5362         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
5363         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
5364         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
5365         LDKCOption_C2Tuple_u64u64ZZ_None_class =
5366                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
5367         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
5368         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
5369         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
5370 }
5371 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5372         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
5373         switch(obj->tag) {
5374                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
5375                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5376                         *some_conv = obj->some;
5377                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
5378                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
5379                 }
5380                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
5381                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
5382                 }
5383                 default: abort();
5384         }
5385 }
5386 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
5387         return owner->a;
5388 }
5389 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5390         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
5391         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5392         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
5393         return ret_arr;
5394 }
5395
5396 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
5397         return owner->b;
5398 }
5399 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5400         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
5401         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5402         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
5403         return ret_arr;
5404 }
5405
5406 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5407         return owner->a;
5408 }
5409 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5410         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5411         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5412         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
5413         return ret_arr;
5414 }
5415
5416 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5417         return owner->b;
5418 }
5419 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5420         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5421         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5422         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
5423         return ret_arr;
5424 }
5425
5426 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
5427 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
5428 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
5429 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
5430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
5431         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
5432                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
5433         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
5434         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
5435         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
5436         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
5437                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
5438         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
5439         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
5440         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
5441 }
5442 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5443         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
5444         switch(obj->tag) {
5445                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
5446                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
5447                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
5448                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
5449                 }
5450                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
5451                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
5452                 }
5453                 default: abort();
5454         }
5455 }
5456 static jclass LDKCOption_f64Z_Some_class = NULL;
5457 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
5458 static jclass LDKCOption_f64Z_None_class = NULL;
5459 static jmethodID LDKCOption_f64Z_None_meth = NULL;
5460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
5461         LDKCOption_f64Z_Some_class =
5462                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
5463         CHECK(LDKCOption_f64Z_Some_class != NULL);
5464         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
5465         CHECK(LDKCOption_f64Z_Some_meth != NULL);
5466         LDKCOption_f64Z_None_class =
5467                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
5468         CHECK(LDKCOption_f64Z_None_class != NULL);
5469         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
5470         CHECK(LDKCOption_f64Z_None_meth != NULL);
5471 }
5472 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5473         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
5474         switch(obj->tag) {
5475                 case LDKCOption_f64Z_Some: {
5476                         double some_conv = obj->some;
5477                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
5478                 }
5479                 case LDKCOption_f64Z_None: {
5480                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
5481                 }
5482                 default: abort();
5483         }
5484 }
5485 typedef struct LDKLogger_JCalls {
5486         atomic_size_t refcnt;
5487         JavaVM *vm;
5488         jweak o;
5489         jmethodID log_meth;
5490 } LDKLogger_JCalls;
5491 static void LDKLogger_JCalls_free(void* this_arg) {
5492         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5493         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5494                 JNIEnv *env;
5495                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5496                 if (get_jenv_res == JNI_EDETACHED) {
5497                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5498                 } else {
5499                         DO_ASSERT(get_jenv_res == JNI_OK);
5500                 }
5501                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5502                 if (get_jenv_res == JNI_EDETACHED) {
5503                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5504                 }
5505                 FREE(j_calls);
5506         }
5507 }
5508 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
5509         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5510         JNIEnv *env;
5511         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5512         if (get_jenv_res == JNI_EDETACHED) {
5513                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5514         } else {
5515                 DO_ASSERT(get_jenv_res == JNI_OK);
5516         }
5517         LDKRecord record_var = record;
5518         int64_t record_ref = 0;
5519         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5520         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
5521         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5522         CHECK(obj != NULL);
5523         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5524         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5525                 (*env)->ExceptionDescribe(env);
5526                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5527         }
5528         if (get_jenv_res == JNI_EDETACHED) {
5529                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5530         }
5531 }
5532 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5533         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5534         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5535 }
5536 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5537         jclass c = (*env)->GetObjectClass(env, o);
5538         CHECK(c != NULL);
5539         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5540         atomic_init(&calls->refcnt, 1);
5541         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5542         calls->o = (*env)->NewWeakGlobalRef(env, o);
5543         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5544         CHECK(calls->log_meth != NULL);
5545
5546         LDKLogger ret = {
5547                 .this_arg = (void*) calls,
5548                 .log = log_LDKLogger_jcall,
5549                 .free = LDKLogger_JCalls_free,
5550         };
5551         return ret;
5552 }
5553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5554         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5555         *res_ptr = LDKLogger_init(env, clz, o);
5556         return tag_ptr(res_ptr, true);
5557 }
5558 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5559         LDKProbabilisticScorer ret = *owner->contents.result;
5560         ret.is_owned = false;
5561         return ret;
5562 }
5563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5564         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5565         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
5566         int64_t ret_ref = 0;
5567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5569         return ret_ref;
5570 }
5571
5572 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5573 CHECK(!owner->result_ok);
5574         return DecodeError_clone(&*owner->contents.err);
5575 }
5576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5577         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5578         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5579         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
5580         int64_t ret_ref = tag_ptr(ret_copy, true);
5581         return ret_ref;
5582 }
5583
5584 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
5585         LDKBestBlock ret = *owner->contents.result;
5586         ret.is_owned = false;
5587         return ret;
5588 }
5589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5590         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
5591         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
5592         int64_t ret_ref = 0;
5593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5595         return ret_ref;
5596 }
5597
5598 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
5599 CHECK(!owner->result_ok);
5600         return DecodeError_clone(&*owner->contents.err);
5601 }
5602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5603         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
5604         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5605         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
5606         int64_t ret_ref = tag_ptr(ret_copy, true);
5607         return ret_ref;
5608 }
5609
5610 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5611         return owner->a;
5612 }
5613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5614         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5615         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5616         return ret_conv;
5617 }
5618
5619 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5620         return owner->b;
5621 }
5622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5623         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5624         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5625         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5626         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5627         return ret_arr;
5628 }
5629
5630 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5631         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5632         for (size_t i = 0; i < ret.datalen; i++) {
5633                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5634         }
5635         return ret;
5636 }
5637 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5638         return ThirtyTwoBytes_clone(&owner->a);
5639 }
5640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5641         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5642         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5643         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5644         return ret_arr;
5645 }
5646
5647 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5648         return owner->b;
5649 }
5650 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5651         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5652         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
5653         return ret_conv;
5654 }
5655
5656 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5657         return COption_ThirtyTwoBytesZ_clone(&owner->c);
5658 }
5659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5660         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5661         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5662         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
5663         int64_t ret_ref = tag_ptr(ret_copy, true);
5664         return ret_ref;
5665 }
5666
5667 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
5668         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5669         for (size_t i = 0; i < ret.datalen; i++) {
5670                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5671         }
5672         return ret;
5673 }
5674 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5675 CHECK(owner->result_ok);
5676         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5677 }
5678 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5679         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5680         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5681         return ret_conv;
5682 }
5683
5684 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5685 CHECK(!owner->result_ok);
5686         return *owner->contents.err;
5687 }
5688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5689         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5690         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5691 }
5692
5693 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5694 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5695 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5696 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5697 static jclass LDKClosureReason_LegacyCooperativeClosure_class = NULL;
5698 static jmethodID LDKClosureReason_LegacyCooperativeClosure_meth = NULL;
5699 static jclass LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class = NULL;
5700 static jmethodID LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth = NULL;
5701 static jclass LDKClosureReason_LocallyInitiatedCooperativeClosure_class = NULL;
5702 static jmethodID LDKClosureReason_LocallyInitiatedCooperativeClosure_meth = NULL;
5703 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5704 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5705 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
5706 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
5707 static jclass LDKClosureReason_ProcessingError_class = NULL;
5708 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5709 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5710 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5711 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5712 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5713 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
5714 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
5715 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
5716 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
5717 static jclass LDKClosureReason_HTLCsTimedOut_class = NULL;
5718 static jmethodID LDKClosureReason_HTLCsTimedOut_meth = NULL;
5719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5720         LDKClosureReason_CounterpartyForceClosed_class =
5721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
5722         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5723         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
5724         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5725         LDKClosureReason_HolderForceClosed_class =
5726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
5727         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5728         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5729         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5730         LDKClosureReason_LegacyCooperativeClosure_class =
5731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$LegacyCooperativeClosure"));
5732         CHECK(LDKClosureReason_LegacyCooperativeClosure_class != NULL);
5733         LDKClosureReason_LegacyCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_LegacyCooperativeClosure_class, "<init>", "()V");
5734         CHECK(LDKClosureReason_LegacyCooperativeClosure_meth != NULL);
5735         LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class =
5736                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyInitiatedCooperativeClosure"));
5737         CHECK(LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class != NULL);
5738         LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class, "<init>", "()V");
5739         CHECK(LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth != NULL);
5740         LDKClosureReason_LocallyInitiatedCooperativeClosure_class =
5741                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$LocallyInitiatedCooperativeClosure"));
5742         CHECK(LDKClosureReason_LocallyInitiatedCooperativeClosure_class != NULL);
5743         LDKClosureReason_LocallyInitiatedCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_LocallyInitiatedCooperativeClosure_class, "<init>", "()V");
5744         CHECK(LDKClosureReason_LocallyInitiatedCooperativeClosure_meth != NULL);
5745         LDKClosureReason_CommitmentTxConfirmed_class =
5746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
5747         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5748         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5749         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5750         LDKClosureReason_FundingTimedOut_class =
5751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
5752         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
5753         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
5754         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
5755         LDKClosureReason_ProcessingError_class =
5756                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
5757         CHECK(LDKClosureReason_ProcessingError_class != NULL);
5758         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5759         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5760         LDKClosureReason_DisconnectedPeer_class =
5761                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
5762         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5763         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5764         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5765         LDKClosureReason_OutdatedChannelManager_class =
5766                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
5767         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5768         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5769         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5770         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
5771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
5772         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
5773         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
5774         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
5775         LDKClosureReason_FundingBatchClosure_class =
5776                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
5777         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
5778         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
5779         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
5780         LDKClosureReason_HTLCsTimedOut_class =
5781                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HTLCsTimedOut"));
5782         CHECK(LDKClosureReason_HTLCsTimedOut_class != NULL);
5783         LDKClosureReason_HTLCsTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_HTLCsTimedOut_class, "<init>", "()V");
5784         CHECK(LDKClosureReason_HTLCsTimedOut_meth != NULL);
5785 }
5786 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5787         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
5788         switch(obj->tag) {
5789                 case LDKClosureReason_CounterpartyForceClosed: {
5790                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
5791                         int64_t peer_msg_ref = 0;
5792                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
5793                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
5794                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
5795                 }
5796                 case LDKClosureReason_HolderForceClosed: {
5797                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5798                 }
5799                 case LDKClosureReason_LegacyCooperativeClosure: {
5800                         return (*env)->NewObject(env, LDKClosureReason_LegacyCooperativeClosure_class, LDKClosureReason_LegacyCooperativeClosure_meth);
5801                 }
5802                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: {
5803                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth);
5804                 }
5805                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: {
5806                         return (*env)->NewObject(env, LDKClosureReason_LocallyInitiatedCooperativeClosure_class, LDKClosureReason_LocallyInitiatedCooperativeClosure_meth);
5807                 }
5808                 case LDKClosureReason_CommitmentTxConfirmed: {
5809                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5810                 }
5811                 case LDKClosureReason_FundingTimedOut: {
5812                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
5813                 }
5814                 case LDKClosureReason_ProcessingError: {
5815                         LDKStr err_str = obj->processing_error.err;
5816                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5817                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5818                 }
5819                 case LDKClosureReason_DisconnectedPeer: {
5820                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5821                 }
5822                 case LDKClosureReason_OutdatedChannelManager: {
5823                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5824                 }
5825                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
5826                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
5827                 }
5828                 case LDKClosureReason_FundingBatchClosure: {
5829                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
5830                 }
5831                 case LDKClosureReason_HTLCsTimedOut: {
5832                         return (*env)->NewObject(env, LDKClosureReason_HTLCsTimedOut_class, LDKClosureReason_HTLCsTimedOut_meth);
5833                 }
5834                 default: abort();
5835         }
5836 }
5837 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5838 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5839 static jclass LDKMonitorEvent_HolderForceClosedWithInfo_class = NULL;
5840 static jmethodID LDKMonitorEvent_HolderForceClosedWithInfo_meth = NULL;
5841 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5842 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5843 static jclass LDKMonitorEvent_Completed_class = NULL;
5844 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5846         LDKMonitorEvent_HTLCEvent_class =
5847                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5848         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5849         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5850         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5851         LDKMonitorEvent_HolderForceClosedWithInfo_class =
5852                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosedWithInfo"));
5853         CHECK(LDKMonitorEvent_HolderForceClosedWithInfo_class != NULL);
5854         LDKMonitorEvent_HolderForceClosedWithInfo_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosedWithInfo_class, "<init>", "(JJJ)V");
5855         CHECK(LDKMonitorEvent_HolderForceClosedWithInfo_meth != NULL);
5856         LDKMonitorEvent_HolderForceClosed_class =
5857                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5858         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5859         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5860         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5861         LDKMonitorEvent_Completed_class =
5862                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5863         CHECK(LDKMonitorEvent_Completed_class != NULL);
5864         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJJ)V");
5865         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5866 }
5867 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5868         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5869         switch(obj->tag) {
5870                 case LDKMonitorEvent_HTLCEvent: {
5871                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5872                         int64_t htlc_event_ref = 0;
5873                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5874                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5875                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5876                 }
5877                 case LDKMonitorEvent_HolderForceClosedWithInfo: {
5878                         int64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
5879                         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
5880                         int64_t outpoint_ref = 0;
5881                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
5882                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
5883                         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
5884                         int64_t channel_id_ref = 0;
5885                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5886                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
5887                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosedWithInfo_class, LDKMonitorEvent_HolderForceClosedWithInfo_meth, reason_ref, outpoint_ref, channel_id_ref);
5888                 }
5889                 case LDKMonitorEvent_HolderForceClosed: {
5890                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5891                         int64_t holder_force_closed_ref = 0;
5892                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5893                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5894                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5895                 }
5896                 case LDKMonitorEvent_Completed: {
5897                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5898                         int64_t funding_txo_ref = 0;
5899                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5900                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5901                         LDKChannelId channel_id_var = obj->completed.channel_id;
5902                         int64_t channel_id_ref = 0;
5903                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5904                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
5905                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5906                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, channel_id_ref, monitor_update_id_conv);
5907                 }
5908                 default: abort();
5909         }
5910 }
5911 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5912         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5913         for (size_t i = 0; i < ret.datalen; i++) {
5914                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5915         }
5916         return ret;
5917 }
5918 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5919         LDKOutPoint ret = owner->a;
5920         ret.is_owned = false;
5921         return ret;
5922 }
5923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5924         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5925         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5926         int64_t ret_ref = 0;
5927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5929         return ret_ref;
5930 }
5931
5932 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5933         LDKChannelId ret = owner->b;
5934         ret.is_owned = false;
5935         return ret;
5936 }
5937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5938         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5939         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5940         int64_t ret_ref = 0;
5941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5943         return ret_ref;
5944 }
5945
5946 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5947         return CVec_MonitorEventZ_clone(&owner->c);
5948 }
5949 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5950         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5951         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
5952         int64_tArray ret_arr = NULL;
5953         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5954         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5955         for (size_t o = 0; o < ret_var.datalen; o++) {
5956                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5957                 *ret_conv_14_copy = ret_var.data[o];
5958                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5959                 ret_arr_ptr[o] = ret_conv_14_ref;
5960         }
5961         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5962         FREE(ret_var.data);
5963         return ret_arr;
5964 }
5965
5966 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5967         return owner->d;
5968 }
5969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1d(JNIEnv *env, jclass clz, int64_t owner) {
5970         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5971         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5972         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form);
5973         return ret_arr;
5974 }
5975
5976 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
5977         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5978         for (size_t i = 0; i < ret.datalen; i++) {
5979                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5980         }
5981         return ret;
5982 }
5983 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5984         LDKInitFeatures ret = *owner->contents.result;
5985         ret.is_owned = false;
5986         return ret;
5987 }
5988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5989         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5990         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5991         int64_t ret_ref = 0;
5992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5994         return ret_ref;
5995 }
5996
5997 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5998 CHECK(!owner->result_ok);
5999         return DecodeError_clone(&*owner->contents.err);
6000 }
6001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6002         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
6003         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6004         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
6005         int64_t ret_ref = tag_ptr(ret_copy, true);
6006         return ret_ref;
6007 }
6008
6009 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
6010         LDKChannelFeatures ret = *owner->contents.result;
6011         ret.is_owned = false;
6012         return ret;
6013 }
6014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6015         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
6016         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
6017         int64_t ret_ref = 0;
6018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6020         return ret_ref;
6021 }
6022
6023 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
6024 CHECK(!owner->result_ok);
6025         return DecodeError_clone(&*owner->contents.err);
6026 }
6027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6028         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
6029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6030         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
6031         int64_t ret_ref = tag_ptr(ret_copy, true);
6032         return ret_ref;
6033 }
6034
6035 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6036         LDKNodeFeatures ret = *owner->contents.result;
6037         ret.is_owned = false;
6038         return ret;
6039 }
6040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6041         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
6042         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
6043         int64_t ret_ref = 0;
6044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6046         return ret_ref;
6047 }
6048
6049 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6050 CHECK(!owner->result_ok);
6051         return DecodeError_clone(&*owner->contents.err);
6052 }
6053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6054         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
6055         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6056         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
6057         int64_t ret_ref = tag_ptr(ret_copy, true);
6058         return ret_ref;
6059 }
6060
6061 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
6062         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
6063         ret.is_owned = false;
6064         return ret;
6065 }
6066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6067         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6068         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
6069         int64_t ret_ref = 0;
6070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6072         return ret_ref;
6073 }
6074
6075 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
6076 CHECK(!owner->result_ok);
6077         return DecodeError_clone(&*owner->contents.err);
6078 }
6079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6080         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6081         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6082         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
6083         int64_t ret_ref = tag_ptr(ret_copy, true);
6084         return ret_ref;
6085 }
6086
6087 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
6088         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
6089         ret.is_owned = false;
6090         return ret;
6091 }
6092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6093         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6094         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
6095         int64_t ret_ref = 0;
6096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6098         return ret_ref;
6099 }
6100
6101 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
6102 CHECK(!owner->result_ok);
6103         return DecodeError_clone(&*owner->contents.err);
6104 }
6105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6106         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6108         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
6109         int64_t ret_ref = tag_ptr(ret_copy, true);
6110         return ret_ref;
6111 }
6112
6113 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
6114         LDKBlindedHopFeatures ret = *owner->contents.result;
6115         ret.is_owned = false;
6116         return ret;
6117 }
6118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6119         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
6120         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
6121         int64_t ret_ref = 0;
6122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6124         return ret_ref;
6125 }
6126
6127 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
6128 CHECK(!owner->result_ok);
6129         return DecodeError_clone(&*owner->contents.err);
6130 }
6131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6132         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
6133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6134         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
6135         int64_t ret_ref = tag_ptr(ret_copy, true);
6136         return ret_ref;
6137 }
6138
6139 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6140         LDKChannelTypeFeatures ret = *owner->contents.result;
6141         ret.is_owned = false;
6142         return ret;
6143 }
6144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6145         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
6146         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
6147         int64_t ret_ref = 0;
6148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6150         return ret_ref;
6151 }
6152
6153 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6154 CHECK(!owner->result_ok);
6155         return DecodeError_clone(&*owner->contents.err);
6156 }
6157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6158         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
6159         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6160         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
6161         int64_t ret_ref = tag_ptr(ret_copy, true);
6162         return ret_ref;
6163 }
6164
6165 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
6166         LDKOfferId ret = *owner->contents.result;
6167         ret.is_owned = false;
6168         return ret;
6169 }
6170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6171         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
6172         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
6173         int64_t ret_ref = 0;
6174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6176         return ret_ref;
6177 }
6178
6179 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
6180 CHECK(!owner->result_ok);
6181         return DecodeError_clone(&*owner->contents.err);
6182 }
6183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6184         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
6185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6186         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
6187         int64_t ret_ref = tag_ptr(ret_copy, true);
6188         return ret_ref;
6189 }
6190
6191 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
6192 CHECK(owner->result_ok);
6193         return *owner->contents.result;
6194 }
6195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6196         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
6197         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
6198 }
6199
6200 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
6201 CHECK(!owner->result_ok);
6202         return Bolt12SemanticError_clone(&*owner->contents.err);
6203 }
6204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6205         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
6206         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
6207         return ret_conv;
6208 }
6209
6210 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
6211         LDKOffer ret = *owner->contents.result;
6212         ret.is_owned = false;
6213         return ret;
6214 }
6215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6216         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
6217         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
6218         int64_t ret_ref = 0;
6219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6221         return ret_ref;
6222 }
6223
6224 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
6225 CHECK(!owner->result_ok);
6226         return Bolt12SemanticError_clone(&*owner->contents.err);
6227 }
6228 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6229         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
6230         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
6231         return ret_conv;
6232 }
6233
6234 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6235         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
6236         ret.is_owned = false;
6237         return ret;
6238 }
6239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6240         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6241         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6242         int64_t ret_ref = 0;
6243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6245         return ret_ref;
6246 }
6247
6248 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6249 CHECK(!owner->result_ok);
6250         return Bolt12SemanticError_clone(&*owner->contents.err);
6251 }
6252 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6253         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6254         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6255         return ret_conv;
6256 }
6257
6258 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6259         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
6260         ret.is_owned = false;
6261         return ret;
6262 }
6263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6264         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6265         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6266         int64_t ret_ref = 0;
6267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6269         return ret_ref;
6270 }
6271
6272 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6273 CHECK(!owner->result_ok);
6274         return Bolt12SemanticError_clone(&*owner->contents.err);
6275 }
6276 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6277         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6278         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6279         return ret_conv;
6280 }
6281
6282 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
6283         LDKOffer ret = *owner->contents.result;
6284         ret.is_owned = false;
6285         return ret;
6286 }
6287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6288         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
6289         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
6290         int64_t ret_ref = 0;
6291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6293         return ret_ref;
6294 }
6295
6296 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
6297         LDKBolt12ParseError ret = *owner->contents.err;
6298         ret.is_owned = false;
6299         return ret;
6300 }
6301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6302         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
6303         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
6304         int64_t ret_ref = 0;
6305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6307         return ret_ref;
6308 }
6309
6310 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6311         LDKNodeId ret = *owner->contents.result;
6312         ret.is_owned = false;
6313         return ret;
6314 }
6315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6316         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
6317         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
6318         int64_t ret_ref = 0;
6319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6321         return ret_ref;
6322 }
6323
6324 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6325 CHECK(!owner->result_ok);
6326         return DecodeError_clone(&*owner->contents.err);
6327 }
6328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6329         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
6330         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6331         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
6332         int64_t ret_ref = tag_ptr(ret_copy, true);
6333         return ret_ref;
6334 }
6335
6336 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
6337 CHECK(owner->result_ok);
6338         return *owner->contents.result;
6339 }
6340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6341         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
6342         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
6343         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
6344         return ret_arr;
6345 }
6346
6347 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
6348 CHECK(!owner->result_ok);
6349         return *owner->contents.err;
6350 }
6351 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6352         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
6353         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
6354         return ret_conv;
6355 }
6356
6357 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
6358 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
6359 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
6360 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
6361 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
6362 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
6363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
6364         LDKNetworkUpdate_ChannelUpdateMessage_class =
6365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
6366         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
6367         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
6368         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
6369         LDKNetworkUpdate_ChannelFailure_class =
6370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
6371         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
6372         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
6373         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
6374         LDKNetworkUpdate_NodeFailure_class =
6375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
6376         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
6377         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
6378         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
6379 }
6380 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6381         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
6382         switch(obj->tag) {
6383                 case LDKNetworkUpdate_ChannelUpdateMessage: {
6384                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
6385                         int64_t msg_ref = 0;
6386                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6387                         msg_ref = tag_ptr(msg_var.inner, false);
6388                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
6389                 }
6390                 case LDKNetworkUpdate_ChannelFailure: {
6391                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
6392                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
6393                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
6394                 }
6395                 case LDKNetworkUpdate_NodeFailure: {
6396                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6397                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
6398                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
6399                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
6400                 }
6401                 default: abort();
6402         }
6403 }
6404 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
6405 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
6406 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
6407 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
6408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
6409         LDKCOption_NetworkUpdateZ_Some_class =
6410                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
6411         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
6412         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
6413         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
6414         LDKCOption_NetworkUpdateZ_None_class =
6415                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
6416         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
6417         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
6418         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
6419 }
6420 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6421         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
6422         switch(obj->tag) {
6423                 case LDKCOption_NetworkUpdateZ_Some: {
6424                         int64_t some_ref = tag_ptr(&obj->some, false);
6425                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
6426                 }
6427                 case LDKCOption_NetworkUpdateZ_None: {
6428                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
6429                 }
6430                 default: abort();
6431         }
6432 }
6433 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6434 CHECK(owner->result_ok);
6435         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
6436 }
6437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6438         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
6439         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
6440         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
6441         int64_t ret_ref = tag_ptr(ret_copy, true);
6442         return ret_ref;
6443 }
6444
6445 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6446 CHECK(!owner->result_ok);
6447         return DecodeError_clone(&*owner->contents.err);
6448 }
6449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6450         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
6451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6452         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
6453         int64_t ret_ref = tag_ptr(ret_copy, true);
6454         return ret_ref;
6455 }
6456
6457 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
6458 CHECK(owner->result_ok);
6459         return TxOut_clone(&*owner->contents.result);
6460 }
6461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6462         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
6463         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6464         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
6465         return tag_ptr(ret_ref, true);
6466 }
6467
6468 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
6469 CHECK(!owner->result_ok);
6470         return UtxoLookupError_clone(&*owner->contents.err);
6471 }
6472 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6473         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
6474         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
6475         return ret_conv;
6476 }
6477
6478 static jclass LDKUtxoResult_Sync_class = NULL;
6479 static jmethodID LDKUtxoResult_Sync_meth = NULL;
6480 static jclass LDKUtxoResult_Async_class = NULL;
6481 static jmethodID LDKUtxoResult_Async_meth = NULL;
6482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
6483         LDKUtxoResult_Sync_class =
6484                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
6485         CHECK(LDKUtxoResult_Sync_class != NULL);
6486         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
6487         CHECK(LDKUtxoResult_Sync_meth != NULL);
6488         LDKUtxoResult_Async_class =
6489                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
6490         CHECK(LDKUtxoResult_Async_class != NULL);
6491         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
6492         CHECK(LDKUtxoResult_Async_meth != NULL);
6493 }
6494 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6495         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
6496         switch(obj->tag) {
6497                 case LDKUtxoResult_Sync: {
6498                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
6499                         *sync_conv = obj->sync;
6500                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
6501                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
6502                 }
6503                 case LDKUtxoResult_Async: {
6504                         LDKUtxoFuture async_var = obj->async;
6505                         int64_t async_ref = 0;
6506                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
6507                         async_ref = tag_ptr(async_var.inner, false);
6508                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
6509                 }
6510                 default: abort();
6511         }
6512 }
6513 typedef struct LDKUtxoLookup_JCalls {
6514         atomic_size_t refcnt;
6515         JavaVM *vm;
6516         jweak o;
6517         jmethodID get_utxo_meth;
6518 } LDKUtxoLookup_JCalls;
6519 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
6520         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
6521         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6522                 JNIEnv *env;
6523                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6524                 if (get_jenv_res == JNI_EDETACHED) {
6525                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6526                 } else {
6527                         DO_ASSERT(get_jenv_res == JNI_OK);
6528                 }
6529                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6530                 if (get_jenv_res == JNI_EDETACHED) {
6531                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6532                 }
6533                 FREE(j_calls);
6534         }
6535 }
6536 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
6537         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
6538         JNIEnv *env;
6539         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6540         if (get_jenv_res == JNI_EDETACHED) {
6541                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6542         } else {
6543                 DO_ASSERT(get_jenv_res == JNI_OK);
6544         }
6545         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
6546         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
6547         int64_t short_channel_id_conv = short_channel_id;
6548         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6549         CHECK(obj != NULL);
6550         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
6551         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6552                 (*env)->ExceptionDescribe(env);
6553                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
6554         }
6555         void* ret_ptr = untag_ptr(ret);
6556         CHECK_ACCESS(ret_ptr);
6557         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
6558         FREE(untag_ptr(ret));
6559         if (get_jenv_res == JNI_EDETACHED) {
6560                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6561         }
6562         return ret_conv;
6563 }
6564 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
6565         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
6566         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6567 }
6568 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
6569         jclass c = (*env)->GetObjectClass(env, o);
6570         CHECK(c != NULL);
6571         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
6572         atomic_init(&calls->refcnt, 1);
6573         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6574         calls->o = (*env)->NewWeakGlobalRef(env, o);
6575         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6576         CHECK(calls->get_utxo_meth != NULL);
6577
6578         LDKUtxoLookup ret = {
6579                 .this_arg = (void*) calls,
6580                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
6581                 .free = LDKUtxoLookup_JCalls_free,
6582         };
6583         return ret;
6584 }
6585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
6586         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
6587         *res_ptr = LDKUtxoLookup_init(env, clz, o);
6588         return tag_ptr(res_ptr, true);
6589 }
6590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
6591         void* this_arg_ptr = untag_ptr(this_arg);
6592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6593         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
6594         uint8_t chain_hash_arr[32];
6595         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
6596         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
6597         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
6598         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
6599         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
6600         int64_t ret_ref = tag_ptr(ret_copy, true);
6601         return ret_ref;
6602 }
6603
6604 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
6605 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
6606 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
6607 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
6608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
6609         LDKCOption_UtxoLookupZ_Some_class =
6610                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
6611         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
6612         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
6613         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
6614         LDKCOption_UtxoLookupZ_None_class =
6615                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
6616         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
6617         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
6618         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
6619 }
6620 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6621         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
6622         switch(obj->tag) {
6623                 case LDKCOption_UtxoLookupZ_Some: {
6624                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
6625                         *some_ret = obj->some;
6626                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
6627                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
6628                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6629                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
6630                         }
6631                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
6632                 }
6633                 case LDKCOption_UtxoLookupZ_None: {
6634                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
6635                 }
6636                 default: abort();
6637         }
6638 }
6639 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6640 CHECK(owner->result_ok);
6641         return *owner->contents.result;
6642 }
6643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6644         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
6645         CResult_NoneLightningErrorZ_get_ok(owner_conv);
6646 }
6647
6648 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6649         LDKLightningError ret = *owner->contents.err;
6650         ret.is_owned = false;
6651         return ret;
6652 }
6653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6654         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
6655         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
6656         int64_t ret_ref = 0;
6657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6659         return ret_ref;
6660 }
6661
6662 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6663 CHECK(owner->result_ok);
6664         return *owner->contents.result;
6665 }
6666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6667         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
6668         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
6669         return ret_conv;
6670 }
6671
6672 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6673         LDKLightningError ret = *owner->contents.err;
6674         ret.is_owned = false;
6675         return ret;
6676 }
6677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6678         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
6679         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
6680         int64_t ret_ref = 0;
6681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6683         return ret_ref;
6684 }
6685
6686 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6687         LDKChannelAnnouncement ret = owner->a;
6688         ret.is_owned = false;
6689         return ret;
6690 }
6691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6692         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6693         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
6694         int64_t ret_ref = 0;
6695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6697         return ret_ref;
6698 }
6699
6700 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6701         LDKChannelUpdate ret = owner->b;
6702         ret.is_owned = false;
6703         return ret;
6704 }
6705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6706         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6707         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
6708         int64_t ret_ref = 0;
6709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6711         return ret_ref;
6712 }
6713
6714 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6715         LDKChannelUpdate ret = owner->c;
6716         ret.is_owned = false;
6717         return ret;
6718 }
6719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
6720         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6721         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
6722         int64_t ret_ref = 0;
6723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6725         return ret_ref;
6726 }
6727
6728 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
6729 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
6730 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
6731 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
6732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
6733         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
6734                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
6735         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
6736         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
6737         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
6738         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
6739                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
6740         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
6741         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
6742         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
6743 }
6744 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6745         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
6746         switch(obj->tag) {
6747                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
6748                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6749                         *some_conv = obj->some;
6750                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
6751                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
6752                 }
6753                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
6754                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
6755                 }
6756                 default: abort();
6757         }
6758 }
6759 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
6760 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
6761 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
6762 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
6763 static jclass LDKErrorAction_IgnoreError_class = NULL;
6764 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
6765 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
6766 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
6767 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
6768 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
6769 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
6770 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
6771 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
6772 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
6773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
6774         LDKErrorAction_DisconnectPeer_class =
6775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
6776         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
6777         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
6778         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
6779         LDKErrorAction_DisconnectPeerWithWarning_class =
6780                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
6781         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
6782         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
6783         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
6784         LDKErrorAction_IgnoreError_class =
6785                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
6786         CHECK(LDKErrorAction_IgnoreError_class != NULL);
6787         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
6788         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
6789         LDKErrorAction_IgnoreAndLog_class =
6790                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
6791         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
6792         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
6793         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
6794         LDKErrorAction_IgnoreDuplicateGossip_class =
6795                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
6796         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
6797         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
6798         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
6799         LDKErrorAction_SendErrorMessage_class =
6800                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
6801         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
6802         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
6803         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
6804         LDKErrorAction_SendWarningMessage_class =
6805                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
6806         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
6807         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
6808         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
6809 }
6810 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6811         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
6812         switch(obj->tag) {
6813                 case LDKErrorAction_DisconnectPeer: {
6814                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
6815                         int64_t msg_ref = 0;
6816                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6817                         msg_ref = tag_ptr(msg_var.inner, false);
6818                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
6819                 }
6820                 case LDKErrorAction_DisconnectPeerWithWarning: {
6821                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
6822                         int64_t msg_ref = 0;
6823                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6824                         msg_ref = tag_ptr(msg_var.inner, false);
6825                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
6826                 }
6827                 case LDKErrorAction_IgnoreError: {
6828                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
6829                 }
6830                 case LDKErrorAction_IgnoreAndLog: {
6831                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
6832                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
6833                 }
6834                 case LDKErrorAction_IgnoreDuplicateGossip: {
6835                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
6836                 }
6837                 case LDKErrorAction_SendErrorMessage: {
6838                         LDKErrorMessage msg_var = obj->send_error_message.msg;
6839                         int64_t msg_ref = 0;
6840                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6841                         msg_ref = tag_ptr(msg_var.inner, false);
6842                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
6843                 }
6844                 case LDKErrorAction_SendWarningMessage: {
6845                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
6846                         int64_t msg_ref = 0;
6847                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6848                         msg_ref = tag_ptr(msg_var.inner, false);
6849                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
6850                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
6851                 }
6852                 default: abort();
6853         }
6854 }
6855 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
6856 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
6857 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
6858 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
6859 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
6860 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
6861 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
6862 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
6863 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
6864 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
6865 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
6866 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
6867 static jclass LDKMessageSendEvent_SendStfu_class = NULL;
6868 static jmethodID LDKMessageSendEvent_SendStfu_meth = NULL;
6869 static jclass LDKMessageSendEvent_SendSplice_class = NULL;
6870 static jmethodID LDKMessageSendEvent_SendSplice_meth = NULL;
6871 static jclass LDKMessageSendEvent_SendSpliceAck_class = NULL;
6872 static jmethodID LDKMessageSendEvent_SendSpliceAck_meth = NULL;
6873 static jclass LDKMessageSendEvent_SendSpliceLocked_class = NULL;
6874 static jmethodID LDKMessageSendEvent_SendSpliceLocked_meth = NULL;
6875 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
6876 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
6877 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
6878 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
6879 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
6880 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
6881 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
6882 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
6883 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
6884 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
6885 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
6886 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
6887 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
6888 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
6889 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
6890 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
6891 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
6892 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
6893 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
6894 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
6895 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
6896 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
6897 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
6898 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
6899 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
6900 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
6901 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
6902 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
6903 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
6904 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
6905 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
6906 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
6907 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
6908 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
6909 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
6910 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
6911 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
6912 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
6913 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
6914 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
6915 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
6916 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
6917 static jclass LDKMessageSendEvent_HandleError_class = NULL;
6918 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
6919 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
6920 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
6921 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
6922 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6923 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6924 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6925 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6926 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6928         LDKMessageSendEvent_SendAcceptChannel_class =
6929                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6930         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6931         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6932         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6933         LDKMessageSendEvent_SendAcceptChannelV2_class =
6934                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6935         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6936         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6937         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6938         LDKMessageSendEvent_SendOpenChannel_class =
6939                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6940         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6941         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6942         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6943         LDKMessageSendEvent_SendOpenChannelV2_class =
6944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6945         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6946         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6947         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6948         LDKMessageSendEvent_SendFundingCreated_class =
6949                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6950         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6951         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6952         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6953         LDKMessageSendEvent_SendFundingSigned_class =
6954                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6955         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6956         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6957         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6958         LDKMessageSendEvent_SendStfu_class =
6959                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendStfu"));
6960         CHECK(LDKMessageSendEvent_SendStfu_class != NULL);
6961         LDKMessageSendEvent_SendStfu_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendStfu_class, "<init>", "([BJ)V");
6962         CHECK(LDKMessageSendEvent_SendStfu_meth != NULL);
6963         LDKMessageSendEvent_SendSplice_class =
6964                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSplice"));
6965         CHECK(LDKMessageSendEvent_SendSplice_class != NULL);
6966         LDKMessageSendEvent_SendSplice_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSplice_class, "<init>", "([BJ)V");
6967         CHECK(LDKMessageSendEvent_SendSplice_meth != NULL);
6968         LDKMessageSendEvent_SendSpliceAck_class =
6969                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceAck"));
6970         CHECK(LDKMessageSendEvent_SendSpliceAck_class != NULL);
6971         LDKMessageSendEvent_SendSpliceAck_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceAck_class, "<init>", "([BJ)V");
6972         CHECK(LDKMessageSendEvent_SendSpliceAck_meth != NULL);
6973         LDKMessageSendEvent_SendSpliceLocked_class =
6974                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceLocked"));
6975         CHECK(LDKMessageSendEvent_SendSpliceLocked_class != NULL);
6976         LDKMessageSendEvent_SendSpliceLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceLocked_class, "<init>", "([BJ)V");
6977         CHECK(LDKMessageSendEvent_SendSpliceLocked_meth != NULL);
6978         LDKMessageSendEvent_SendTxAddInput_class =
6979                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6980         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6981         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6982         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6983         LDKMessageSendEvent_SendTxAddOutput_class =
6984                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6985         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6986         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6987         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6988         LDKMessageSendEvent_SendTxRemoveInput_class =
6989                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6990         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6991         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6992         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6993         LDKMessageSendEvent_SendTxRemoveOutput_class =
6994                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6995         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6996         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6997         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6998         LDKMessageSendEvent_SendTxComplete_class =
6999                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
7000         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
7001         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
7002         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
7003         LDKMessageSendEvent_SendTxSignatures_class =
7004                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
7005         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
7006         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
7007         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
7008         LDKMessageSendEvent_SendTxInitRbf_class =
7009                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
7010         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
7011         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
7012         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
7013         LDKMessageSendEvent_SendTxAckRbf_class =
7014                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
7015         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
7016         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
7017         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
7018         LDKMessageSendEvent_SendTxAbort_class =
7019                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
7020         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
7021         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
7022         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
7023         LDKMessageSendEvent_SendChannelReady_class =
7024                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
7025         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
7026         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
7027         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
7028         LDKMessageSendEvent_SendAnnouncementSignatures_class =
7029                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
7030         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
7031         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
7032         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
7033         LDKMessageSendEvent_UpdateHTLCs_class =
7034                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
7035         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
7036         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
7037         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
7038         LDKMessageSendEvent_SendRevokeAndACK_class =
7039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
7040         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
7041         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
7042         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
7043         LDKMessageSendEvent_SendClosingSigned_class =
7044                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
7045         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
7046         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
7047         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
7048         LDKMessageSendEvent_SendShutdown_class =
7049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
7050         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
7051         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
7052         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
7053         LDKMessageSendEvent_SendChannelReestablish_class =
7054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
7055         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
7056         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
7057         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
7058         LDKMessageSendEvent_SendChannelAnnouncement_class =
7059                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
7060         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
7061         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
7062         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
7063         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
7064                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
7065         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
7066         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
7067         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
7068         LDKMessageSendEvent_BroadcastChannelUpdate_class =
7069                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
7070         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
7071         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
7072         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
7073         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
7074                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
7075         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
7076         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
7077         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
7078         LDKMessageSendEvent_SendChannelUpdate_class =
7079                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
7080         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
7081         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
7082         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
7083         LDKMessageSendEvent_HandleError_class =
7084                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
7085         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
7086         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
7087         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
7088         LDKMessageSendEvent_SendChannelRangeQuery_class =
7089                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
7090         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
7091         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
7092         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
7093         LDKMessageSendEvent_SendShortIdsQuery_class =
7094                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
7095         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
7096         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
7097         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
7098         LDKMessageSendEvent_SendReplyChannelRange_class =
7099                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
7100         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
7101         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
7102         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
7103         LDKMessageSendEvent_SendGossipTimestampFilter_class =
7104                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
7105         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
7106         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
7107         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
7108 }
7109 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7110         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
7111         switch(obj->tag) {
7112                 case LDKMessageSendEvent_SendAcceptChannel: {
7113                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7114                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
7115                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
7116                         int64_t msg_ref = 0;
7117                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7118                         msg_ref = tag_ptr(msg_var.inner, false);
7119                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
7120                 }
7121                 case LDKMessageSendEvent_SendAcceptChannelV2: {
7122                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7123                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
7124                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
7125                         int64_t msg_ref = 0;
7126                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7127                         msg_ref = tag_ptr(msg_var.inner, false);
7128                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
7129                 }
7130                 case LDKMessageSendEvent_SendOpenChannel: {
7131                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7132                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
7133                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
7134                         int64_t msg_ref = 0;
7135                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7136                         msg_ref = tag_ptr(msg_var.inner, false);
7137                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
7138                 }
7139                 case LDKMessageSendEvent_SendOpenChannelV2: {
7140                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7141                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
7142                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
7143                         int64_t msg_ref = 0;
7144                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7145                         msg_ref = tag_ptr(msg_var.inner, false);
7146                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
7147                 }
7148                 case LDKMessageSendEvent_SendFundingCreated: {
7149                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7150                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
7151                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
7152                         int64_t msg_ref = 0;
7153                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7154                         msg_ref = tag_ptr(msg_var.inner, false);
7155                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
7156                 }
7157                 case LDKMessageSendEvent_SendFundingSigned: {
7158                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7159                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
7160                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
7161                         int64_t msg_ref = 0;
7162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7163                         msg_ref = tag_ptr(msg_var.inner, false);
7164                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
7165                 }
7166                 case LDKMessageSendEvent_SendStfu: {
7167                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7168                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_stfu.node_id.compressed_form);
7169                         LDKStfu msg_var = obj->send_stfu.msg;
7170                         int64_t msg_ref = 0;
7171                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7172                         msg_ref = tag_ptr(msg_var.inner, false);
7173                         return (*env)->NewObject(env, LDKMessageSendEvent_SendStfu_class, LDKMessageSendEvent_SendStfu_meth, node_id_arr, msg_ref);
7174                 }
7175                 case LDKMessageSendEvent_SendSplice: {
7176                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7177                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice.node_id.compressed_form);
7178                         LDKSplice msg_var = obj->send_splice.msg;
7179                         int64_t msg_ref = 0;
7180                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7181                         msg_ref = tag_ptr(msg_var.inner, false);
7182                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSplice_class, LDKMessageSendEvent_SendSplice_meth, node_id_arr, msg_ref);
7183                 }
7184                 case LDKMessageSendEvent_SendSpliceAck: {
7185                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7186                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_ack.node_id.compressed_form);
7187                         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
7188                         int64_t msg_ref = 0;
7189                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7190                         msg_ref = tag_ptr(msg_var.inner, false);
7191                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceAck_class, LDKMessageSendEvent_SendSpliceAck_meth, node_id_arr, msg_ref);
7192                 }
7193                 case LDKMessageSendEvent_SendSpliceLocked: {
7194                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7195                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_locked.node_id.compressed_form);
7196                         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
7197                         int64_t msg_ref = 0;
7198                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7199                         msg_ref = tag_ptr(msg_var.inner, false);
7200                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceLocked_class, LDKMessageSendEvent_SendSpliceLocked_meth, node_id_arr, msg_ref);
7201                 }
7202                 case LDKMessageSendEvent_SendTxAddInput: {
7203                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7204                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
7205                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
7206                         int64_t msg_ref = 0;
7207                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7208                         msg_ref = tag_ptr(msg_var.inner, false);
7209                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
7210                 }
7211                 case LDKMessageSendEvent_SendTxAddOutput: {
7212                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7213                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
7214                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
7215                         int64_t msg_ref = 0;
7216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7217                         msg_ref = tag_ptr(msg_var.inner, false);
7218                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
7219                 }
7220                 case LDKMessageSendEvent_SendTxRemoveInput: {
7221                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7222                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
7223                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
7224                         int64_t msg_ref = 0;
7225                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7226                         msg_ref = tag_ptr(msg_var.inner, false);
7227                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
7228                 }
7229                 case LDKMessageSendEvent_SendTxRemoveOutput: {
7230                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7231                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
7232                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
7233                         int64_t msg_ref = 0;
7234                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7235                         msg_ref = tag_ptr(msg_var.inner, false);
7236                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
7237                 }
7238                 case LDKMessageSendEvent_SendTxComplete: {
7239                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7240                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
7241                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
7242                         int64_t msg_ref = 0;
7243                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7244                         msg_ref = tag_ptr(msg_var.inner, false);
7245                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
7246                 }
7247                 case LDKMessageSendEvent_SendTxSignatures: {
7248                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7249                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
7250                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
7251                         int64_t msg_ref = 0;
7252                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7253                         msg_ref = tag_ptr(msg_var.inner, false);
7254                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
7255                 }
7256                 case LDKMessageSendEvent_SendTxInitRbf: {
7257                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7258                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
7259                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
7260                         int64_t msg_ref = 0;
7261                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7262                         msg_ref = tag_ptr(msg_var.inner, false);
7263                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
7264                 }
7265                 case LDKMessageSendEvent_SendTxAckRbf: {
7266                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7267                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
7268                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
7269                         int64_t msg_ref = 0;
7270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7271                         msg_ref = tag_ptr(msg_var.inner, false);
7272                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
7273                 }
7274                 case LDKMessageSendEvent_SendTxAbort: {
7275                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7276                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
7277                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
7278                         int64_t msg_ref = 0;
7279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7280                         msg_ref = tag_ptr(msg_var.inner, false);
7281                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
7282                 }
7283                 case LDKMessageSendEvent_SendChannelReady: {
7284                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7285                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
7286                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
7287                         int64_t msg_ref = 0;
7288                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7289                         msg_ref = tag_ptr(msg_var.inner, false);
7290                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
7291                 }
7292                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
7293                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7294                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
7295                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
7296                         int64_t msg_ref = 0;
7297                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7298                         msg_ref = tag_ptr(msg_var.inner, false);
7299                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
7300                 }
7301                 case LDKMessageSendEvent_UpdateHTLCs: {
7302                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7303                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
7304                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
7305                         int64_t updates_ref = 0;
7306                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
7307                         updates_ref = tag_ptr(updates_var.inner, false);
7308                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
7309                 }
7310                 case LDKMessageSendEvent_SendRevokeAndACK: {
7311                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7312                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
7313                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
7314                         int64_t msg_ref = 0;
7315                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7316                         msg_ref = tag_ptr(msg_var.inner, false);
7317                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
7318                 }
7319                 case LDKMessageSendEvent_SendClosingSigned: {
7320                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7321                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
7322                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
7323                         int64_t msg_ref = 0;
7324                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7325                         msg_ref = tag_ptr(msg_var.inner, false);
7326                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
7327                 }
7328                 case LDKMessageSendEvent_SendShutdown: {
7329                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7330                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
7331                         LDKShutdown msg_var = obj->send_shutdown.msg;
7332                         int64_t msg_ref = 0;
7333                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7334                         msg_ref = tag_ptr(msg_var.inner, false);
7335                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
7336                 }
7337                 case LDKMessageSendEvent_SendChannelReestablish: {
7338                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7339                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
7340                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
7341                         int64_t msg_ref = 0;
7342                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7343                         msg_ref = tag_ptr(msg_var.inner, false);
7344                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
7345                 }
7346                 case LDKMessageSendEvent_SendChannelAnnouncement: {
7347                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7348                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
7349                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
7350                         int64_t msg_ref = 0;
7351                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7352                         msg_ref = tag_ptr(msg_var.inner, false);
7353                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
7354                         int64_t update_msg_ref = 0;
7355                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
7356                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
7357                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
7358                 }
7359                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
7360                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
7361                         int64_t msg_ref = 0;
7362                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7363                         msg_ref = tag_ptr(msg_var.inner, false);
7364                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
7365                         int64_t update_msg_ref = 0;
7366                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
7367                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
7368                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
7369                 }
7370                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
7371                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
7372                         int64_t msg_ref = 0;
7373                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7374                         msg_ref = tag_ptr(msg_var.inner, false);
7375                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
7376                 }
7377                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
7378                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
7379                         int64_t msg_ref = 0;
7380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7381                         msg_ref = tag_ptr(msg_var.inner, false);
7382                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
7383                 }
7384                 case LDKMessageSendEvent_SendChannelUpdate: {
7385                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7386                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
7387                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
7388                         int64_t msg_ref = 0;
7389                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7390                         msg_ref = tag_ptr(msg_var.inner, false);
7391                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
7392                 }
7393                 case LDKMessageSendEvent_HandleError: {
7394                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7395                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
7396                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
7397                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
7398                 }
7399                 case LDKMessageSendEvent_SendChannelRangeQuery: {
7400                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7401                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
7402                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
7403                         int64_t msg_ref = 0;
7404                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7405                         msg_ref = tag_ptr(msg_var.inner, false);
7406                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
7407                 }
7408                 case LDKMessageSendEvent_SendShortIdsQuery: {
7409                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7410                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
7411                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
7412                         int64_t msg_ref = 0;
7413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7414                         msg_ref = tag_ptr(msg_var.inner, false);
7415                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
7416                 }
7417                 case LDKMessageSendEvent_SendReplyChannelRange: {
7418                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7419                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
7420                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
7421                         int64_t msg_ref = 0;
7422                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7423                         msg_ref = tag_ptr(msg_var.inner, false);
7424                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
7425                 }
7426                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
7427                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7428                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
7429                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
7430                         int64_t msg_ref = 0;
7431                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7432                         msg_ref = tag_ptr(msg_var.inner, false);
7433                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
7434                 }
7435                 default: abort();
7436         }
7437 }
7438 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
7439         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
7440         for (size_t i = 0; i < ret.datalen; i++) {
7441                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
7442         }
7443         return ret;
7444 }
7445 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7446         LDKChannelUpdateInfo ret = *owner->contents.result;
7447         ret.is_owned = false;
7448         return ret;
7449 }
7450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7451         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
7452         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_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_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *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_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7464         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
7465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7466         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
7467         int64_t ret_ref = tag_ptr(ret_copy, true);
7468         return ret_ref;
7469 }
7470
7471 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7472         LDKChannelInfo ret = *owner->contents.result;
7473         ret.is_owned = false;
7474         return ret;
7475 }
7476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7477         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
7478         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
7479         int64_t ret_ref = 0;
7480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7482         return ret_ref;
7483 }
7484
7485 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7486 CHECK(!owner->result_ok);
7487         return DecodeError_clone(&*owner->contents.err);
7488 }
7489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7490         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
7491         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7492         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
7493         int64_t ret_ref = tag_ptr(ret_copy, true);
7494         return ret_ref;
7495 }
7496
7497 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7498         LDKRoutingFees ret = *owner->contents.result;
7499         ret.is_owned = false;
7500         return ret;
7501 }
7502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7503         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
7504         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
7505         int64_t ret_ref = 0;
7506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7508         return ret_ref;
7509 }
7510
7511 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7512 CHECK(!owner->result_ok);
7513         return DecodeError_clone(&*owner->contents.err);
7514 }
7515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7516         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
7517         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7518         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
7519         int64_t ret_ref = tag_ptr(ret_copy, true);
7520         return ret_ref;
7521 }
7522
7523 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
7524 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
7525 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
7526 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
7527 static jclass LDKSocketAddress_OnionV2_class = NULL;
7528 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
7529 static jclass LDKSocketAddress_OnionV3_class = NULL;
7530 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
7531 static jclass LDKSocketAddress_Hostname_class = NULL;
7532 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
7533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
7534         LDKSocketAddress_TcpIpV4_class =
7535                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
7536         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
7537         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
7538         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
7539         LDKSocketAddress_TcpIpV6_class =
7540                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
7541         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
7542         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
7543         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
7544         LDKSocketAddress_OnionV2_class =
7545                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
7546         CHECK(LDKSocketAddress_OnionV2_class != NULL);
7547         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
7548         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
7549         LDKSocketAddress_OnionV3_class =
7550                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
7551         CHECK(LDKSocketAddress_OnionV3_class != NULL);
7552         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
7553         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
7554         LDKSocketAddress_Hostname_class =
7555                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
7556         CHECK(LDKSocketAddress_Hostname_class != NULL);
7557         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
7558         CHECK(LDKSocketAddress_Hostname_meth != NULL);
7559 }
7560 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7561         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
7562         switch(obj->tag) {
7563                 case LDKSocketAddress_TcpIpV4: {
7564                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
7565                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
7566                         int16_t port_conv = obj->tcp_ip_v4.port;
7567                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
7568                 }
7569                 case LDKSocketAddress_TcpIpV6: {
7570                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
7571                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
7572                         int16_t port_conv = obj->tcp_ip_v6.port;
7573                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
7574                 }
7575                 case LDKSocketAddress_OnionV2: {
7576                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
7577                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
7578                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
7579                 }
7580                 case LDKSocketAddress_OnionV3: {
7581                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
7582                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
7583                         int16_t checksum_conv = obj->onion_v3.checksum;
7584                         int8_t version_conv = obj->onion_v3.version;
7585                         int16_t port_conv = obj->onion_v3.port;
7586                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
7587                 }
7588                 case LDKSocketAddress_Hostname: {
7589                         LDKHostname hostname_var = obj->hostname.hostname;
7590                         int64_t hostname_ref = 0;
7591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
7592                         hostname_ref = tag_ptr(hostname_var.inner, false);
7593                         int16_t port_conv = obj->hostname.port;
7594                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
7595                 }
7596                 default: abort();
7597         }
7598 }
7599 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
7600         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
7601         for (size_t i = 0; i < ret.datalen; i++) {
7602                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
7603         }
7604         return ret;
7605 }
7606 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7607         LDKNodeAnnouncementInfo ret = *owner->contents.result;
7608         ret.is_owned = false;
7609         return ret;
7610 }
7611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7612         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
7613         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
7614         int64_t ret_ref = 0;
7615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7617         return ret_ref;
7618 }
7619
7620 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7621 CHECK(!owner->result_ok);
7622         return DecodeError_clone(&*owner->contents.err);
7623 }
7624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7625         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
7626         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7627         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
7628         int64_t ret_ref = tag_ptr(ret_copy, true);
7629         return ret_ref;
7630 }
7631
7632 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
7633         LDKNodeAlias ret = *owner->contents.result;
7634         ret.is_owned = false;
7635         return ret;
7636 }
7637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7638         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
7639         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
7640         int64_t ret_ref = 0;
7641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7643         return ret_ref;
7644 }
7645
7646 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
7647 CHECK(!owner->result_ok);
7648         return DecodeError_clone(&*owner->contents.err);
7649 }
7650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7651         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
7652         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7653         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
7654         int64_t ret_ref = tag_ptr(ret_copy, true);
7655         return ret_ref;
7656 }
7657
7658 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7659         LDKNodeInfo ret = *owner->contents.result;
7660         ret.is_owned = false;
7661         return ret;
7662 }
7663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7664         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
7665         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
7666         int64_t ret_ref = 0;
7667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7669         return ret_ref;
7670 }
7671
7672 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7673 CHECK(!owner->result_ok);
7674         return DecodeError_clone(&*owner->contents.err);
7675 }
7676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7677         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
7678         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7679         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
7680         int64_t ret_ref = tag_ptr(ret_copy, true);
7681         return ret_ref;
7682 }
7683
7684 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7685         LDKNetworkGraph ret = *owner->contents.result;
7686         ret.is_owned = false;
7687         return ret;
7688 }
7689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7690         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
7691         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
7692         int64_t ret_ref = 0;
7693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7695         return ret_ref;
7696 }
7697
7698 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7699 CHECK(!owner->result_ok);
7700         return DecodeError_clone(&*owner->contents.err);
7701 }
7702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7703         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
7704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7705         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
7706         int64_t ret_ref = tag_ptr(ret_copy, true);
7707         return ret_ref;
7708 }
7709
7710 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
7711 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
7712 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
7713 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
7714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
7715         LDKCOption_CVec_SocketAddressZZ_Some_class =
7716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
7717         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
7718         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
7719         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
7720         LDKCOption_CVec_SocketAddressZZ_None_class =
7721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
7722         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
7723         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
7724         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
7725 }
7726 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7727         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
7728         switch(obj->tag) {
7729                 case LDKCOption_CVec_SocketAddressZZ_Some: {
7730                         LDKCVec_SocketAddressZ some_var = obj->some;
7731                         int64_tArray some_arr = NULL;
7732                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
7733                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
7734                         for (size_t p = 0; p < some_var.datalen; p++) {
7735                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
7736                                 some_arr_ptr[p] = some_conv_15_ref;
7737                         }
7738                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
7739                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
7740                 }
7741                 case LDKCOption_CVec_SocketAddressZZ_None: {
7742                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
7743                 }
7744                 default: abort();
7745         }
7746 }
7747 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
7748 CHECK(owner->result_ok);
7749         return *owner->contents.result;
7750 }
7751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7752         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
7753         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
7754         return ret_conv;
7755 }
7756
7757 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
7758 CHECK(!owner->result_ok);
7759         return ShortChannelIdError_clone(&*owner->contents.err);
7760 }
7761 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7762         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
7763         jclass ret_conv = LDKShortChannelIdError_to_java(env, CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
7764         return ret_conv;
7765 }
7766
7767 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7768         LDKPendingHTLCInfo ret = *owner->contents.result;
7769         ret.is_owned = false;
7770         return ret;
7771 }
7772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7773         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7774         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
7775         int64_t ret_ref = 0;
7776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7778         return ret_ref;
7779 }
7780
7781 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7782         LDKInboundHTLCErr ret = *owner->contents.err;
7783         ret.is_owned = false;
7784         return ret;
7785 }
7786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7787         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7788         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
7789         int64_t ret_ref = 0;
7790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7792         return ret_ref;
7793 }
7794
7795 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
7796         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
7797         for (size_t i = 0; i < ret.datalen; i++) {
7798                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
7799         }
7800         return ret;
7801 }
7802 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
7803         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
7804         for (size_t i = 0; i < ret.datalen; i++) {
7805                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
7806         }
7807         return ret;
7808 }
7809 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
7810         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
7811         for (size_t i = 0; i < ret.datalen; i++) {
7812                 ret.data[i] = Utxo_clone(&orig->data[i]);
7813         }
7814         return ret;
7815 }
7816 static jclass LDKCOption_TxOutZ_Some_class = NULL;
7817 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
7818 static jclass LDKCOption_TxOutZ_None_class = NULL;
7819 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
7820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
7821         LDKCOption_TxOutZ_Some_class =
7822                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
7823         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
7824         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
7825         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
7826         LDKCOption_TxOutZ_None_class =
7827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
7828         CHECK(LDKCOption_TxOutZ_None_class != NULL);
7829         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
7830         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
7831 }
7832 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7833         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
7834         switch(obj->tag) {
7835                 case LDKCOption_TxOutZ_Some: {
7836                         LDKTxOut* some_ref = &obj->some;
7837                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
7838                 }
7839                 case LDKCOption_TxOutZ_None: {
7840                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
7841                 }
7842                 default: abort();
7843         }
7844 }
7845 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
7846         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
7847         for (size_t i = 0; i < ret.datalen; i++) {
7848                 ret.data[i] = Input_clone(&orig->data[i]);
7849         }
7850         return ret;
7851 }
7852 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7853         LDKCoinSelection ret = *owner->contents.result;
7854         ret.is_owned = false;
7855         return ret;
7856 }
7857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7858         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7859         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
7860         int64_t ret_ref = 0;
7861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7863         return ret_ref;
7864 }
7865
7866 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7867 CHECK(!owner->result_ok);
7868         return *owner->contents.err;
7869 }
7870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7871         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7872         CResult_CoinSelectionNoneZ_get_err(owner_conv);
7873 }
7874
7875 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7876 CHECK(owner->result_ok);
7877         return CVec_UtxoZ_clone(&*owner->contents.result);
7878 }
7879 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7880         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7881         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
7882         int64_tArray ret_arr = NULL;
7883         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7884         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7885         for (size_t g = 0; g < ret_var.datalen; g++) {
7886                 LDKUtxo ret_conv_6_var = ret_var.data[g];
7887                 int64_t ret_conv_6_ref = 0;
7888                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
7889                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
7890                 ret_arr_ptr[g] = ret_conv_6_ref;
7891         }
7892         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7893         FREE(ret_var.data);
7894         return ret_arr;
7895 }
7896
7897 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7898 CHECK(!owner->result_ok);
7899         return *owner->contents.err;
7900 }
7901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7902         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7903         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
7904 }
7905
7906 static jclass LDKPaymentContext_Unknown_class = NULL;
7907 static jmethodID LDKPaymentContext_Unknown_meth = NULL;
7908 static jclass LDKPaymentContext_Bolt12Offer_class = NULL;
7909 static jmethodID LDKPaymentContext_Bolt12Offer_meth = NULL;
7910 static jclass LDKPaymentContext_Bolt12Refund_class = NULL;
7911 static jmethodID LDKPaymentContext_Bolt12Refund_meth = NULL;
7912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentContext_init (JNIEnv *env, jclass clz) {
7913         LDKPaymentContext_Unknown_class =
7914                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Unknown"));
7915         CHECK(LDKPaymentContext_Unknown_class != NULL);
7916         LDKPaymentContext_Unknown_meth = (*env)->GetMethodID(env, LDKPaymentContext_Unknown_class, "<init>", "(J)V");
7917         CHECK(LDKPaymentContext_Unknown_meth != NULL);
7918         LDKPaymentContext_Bolt12Offer_class =
7919                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Bolt12Offer"));
7920         CHECK(LDKPaymentContext_Bolt12Offer_class != NULL);
7921         LDKPaymentContext_Bolt12Offer_meth = (*env)->GetMethodID(env, LDKPaymentContext_Bolt12Offer_class, "<init>", "(J)V");
7922         CHECK(LDKPaymentContext_Bolt12Offer_meth != NULL);
7923         LDKPaymentContext_Bolt12Refund_class =
7924                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Bolt12Refund"));
7925         CHECK(LDKPaymentContext_Bolt12Refund_class != NULL);
7926         LDKPaymentContext_Bolt12Refund_meth = (*env)->GetMethodID(env, LDKPaymentContext_Bolt12Refund_class, "<init>", "(J)V");
7927         CHECK(LDKPaymentContext_Bolt12Refund_meth != NULL);
7928 }
7929 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentContext_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7930         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
7931         switch(obj->tag) {
7932                 case LDKPaymentContext_Unknown: {
7933                         LDKUnknownPaymentContext unknown_var = obj->unknown;
7934                         int64_t unknown_ref = 0;
7935                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
7936                         unknown_ref = tag_ptr(unknown_var.inner, false);
7937                         return (*env)->NewObject(env, LDKPaymentContext_Unknown_class, LDKPaymentContext_Unknown_meth, unknown_ref);
7938                 }
7939                 case LDKPaymentContext_Bolt12Offer: {
7940                         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
7941                         int64_t bolt12_offer_ref = 0;
7942                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
7943                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
7944                         return (*env)->NewObject(env, LDKPaymentContext_Bolt12Offer_class, LDKPaymentContext_Bolt12Offer_meth, bolt12_offer_ref);
7945                 }
7946                 case LDKPaymentContext_Bolt12Refund: {
7947                         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
7948                         int64_t bolt12_refund_ref = 0;
7949                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
7950                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
7951                         return (*env)->NewObject(env, LDKPaymentContext_Bolt12Refund_class, LDKPaymentContext_Bolt12Refund_meth, bolt12_refund_ref);
7952                 }
7953                 default: abort();
7954         }
7955 }
7956 static jclass LDKCOption_PaymentContextZ_Some_class = NULL;
7957 static jmethodID LDKCOption_PaymentContextZ_Some_meth = NULL;
7958 static jclass LDKCOption_PaymentContextZ_None_class = NULL;
7959 static jmethodID LDKCOption_PaymentContextZ_None_meth = NULL;
7960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentContextZ_init (JNIEnv *env, jclass clz) {
7961         LDKCOption_PaymentContextZ_Some_class =
7962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentContextZ$Some"));
7963         CHECK(LDKCOption_PaymentContextZ_Some_class != NULL);
7964         LDKCOption_PaymentContextZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentContextZ_Some_class, "<init>", "(J)V");
7965         CHECK(LDKCOption_PaymentContextZ_Some_meth != NULL);
7966         LDKCOption_PaymentContextZ_None_class =
7967                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentContextZ$None"));
7968         CHECK(LDKCOption_PaymentContextZ_None_class != NULL);
7969         LDKCOption_PaymentContextZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentContextZ_None_class, "<init>", "()V");
7970         CHECK(LDKCOption_PaymentContextZ_None_meth != NULL);
7971 }
7972 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentContextZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7973         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
7974         switch(obj->tag) {
7975                 case LDKCOption_PaymentContextZ_Some: {
7976                         int64_t some_ref = tag_ptr(&obj->some, false);
7977                         return (*env)->NewObject(env, LDKCOption_PaymentContextZ_Some_class, LDKCOption_PaymentContextZ_Some_meth, some_ref);
7978                 }
7979                 case LDKCOption_PaymentContextZ_None: {
7980                         return (*env)->NewObject(env, LDKCOption_PaymentContextZ_None_class, LDKCOption_PaymentContextZ_None_meth);
7981                 }
7982                 default: abort();
7983         }
7984 }
7985 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7986         return owner->a;
7987 }
7988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7989         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7990         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
7991         return ret_conv;
7992 }
7993
7994 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7995         return owner->b;
7996 }
7997 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7998         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7999         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
8000         return ret_conv;
8001 }
8002
8003 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
8004 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
8005 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
8006 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
8007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
8008         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
8009                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
8010         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
8011         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
8012         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
8013         LDKCOption_C2Tuple_u64u16ZZ_None_class =
8014                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
8015         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
8016         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
8017         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
8018 }
8019 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8020         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
8021         switch(obj->tag) {
8022                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
8023                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
8024                         *some_conv = obj->some;
8025                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
8026                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
8027                 }
8028                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
8029                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
8030                 }
8031                 default: abort();
8032         }
8033 }
8034 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
8035         LDKChannelId ret = *owner->contents.result;
8036         ret.is_owned = false;
8037         return ret;
8038 }
8039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8040         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
8041         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
8042         int64_t ret_ref = 0;
8043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8045         return ret_ref;
8046 }
8047
8048 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
8049 CHECK(!owner->result_ok);
8050         return APIError_clone(&*owner->contents.err);
8051 }
8052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8053         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
8054         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8055         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
8056         int64_t ret_ref = tag_ptr(ret_copy, true);
8057         return ret_ref;
8058 }
8059
8060 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
8061 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
8062 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
8063 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
8064 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
8065 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
8066 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
8067 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
8068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
8069         LDKRecentPaymentDetails_AwaitingInvoice_class =
8070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
8071         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
8072         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
8073         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
8074         LDKRecentPaymentDetails_Pending_class =
8075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
8076         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
8077         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
8078         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
8079         LDKRecentPaymentDetails_Fulfilled_class =
8080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
8081         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
8082         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
8083         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
8084         LDKRecentPaymentDetails_Abandoned_class =
8085                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
8086         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
8087         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
8088         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
8089 }
8090 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8091         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
8092         switch(obj->tag) {
8093                 case LDKRecentPaymentDetails_AwaitingInvoice: {
8094                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8095                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
8096                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
8097                 }
8098                 case LDKRecentPaymentDetails_Pending: {
8099                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8100                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
8101                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
8102                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
8103                         int64_t total_msat_conv = obj->pending.total_msat;
8104                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
8105                 }
8106                 case LDKRecentPaymentDetails_Fulfilled: {
8107                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8108                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
8109                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
8110                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
8111                 }
8112                 case LDKRecentPaymentDetails_Abandoned: {
8113                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8114                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
8115                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
8116                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
8117                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
8118                 }
8119                 default: abort();
8120         }
8121 }
8122 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
8123         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
8124         for (size_t i = 0; i < ret.datalen; i++) {
8125                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
8126         }
8127         return ret;
8128 }
8129 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
8130 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
8131 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
8132 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
8133 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
8134 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
8135 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
8136 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
8137 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
8138 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
8139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
8140         LDKPaymentSendFailure_ParameterError_class =
8141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
8142         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
8143         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
8144         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
8145         LDKPaymentSendFailure_PathParameterError_class =
8146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
8147         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
8148         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
8149         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
8150         LDKPaymentSendFailure_AllFailedResendSafe_class =
8151                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
8152         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
8153         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
8154         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
8155         LDKPaymentSendFailure_DuplicatePayment_class =
8156                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
8157         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
8158         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
8159         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
8160         LDKPaymentSendFailure_PartialFailure_class =
8161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
8162         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
8163         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
8164         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
8165 }
8166 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8167         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
8168         switch(obj->tag) {
8169                 case LDKPaymentSendFailure_ParameterError: {
8170                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
8171                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
8172                 }
8173                 case LDKPaymentSendFailure_PathParameterError: {
8174                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
8175                         int64_tArray path_parameter_error_arr = NULL;
8176                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
8177                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
8178                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
8179                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8180                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
8181                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
8182                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
8183                         }
8184                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
8185                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
8186                 }
8187                 case LDKPaymentSendFailure_AllFailedResendSafe: {
8188                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
8189                         int64_tArray all_failed_resend_safe_arr = NULL;
8190                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
8191                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
8192                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
8193                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
8194                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
8195                         }
8196                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
8197                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
8198                 }
8199                 case LDKPaymentSendFailure_DuplicatePayment: {
8200                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
8201                 }
8202                 case LDKPaymentSendFailure_PartialFailure: {
8203                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
8204                         int64_tArray results_arr = NULL;
8205                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
8206                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
8207                         for (size_t w = 0; w < results_var.datalen; w++) {
8208                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8209                                 *results_conv_22_conv = results_var.data[w];
8210                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
8211                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
8212                         }
8213                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
8214                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
8215                         int64_t failed_paths_retry_ref = 0;
8216                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
8217                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
8218                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8219                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
8220                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
8221                 }
8222                 default: abort();
8223         }
8224 }
8225 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
8226 CHECK(owner->result_ok);
8227         return *owner->contents.result;
8228 }
8229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8230         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
8231         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
8232 }
8233
8234 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
8235 CHECK(!owner->result_ok);
8236         return PaymentSendFailure_clone(&*owner->contents.err);
8237 }
8238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8239         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
8240         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8241         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
8242         int64_t ret_ref = tag_ptr(ret_copy, true);
8243         return ret_ref;
8244 }
8245
8246 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
8247 CHECK(owner->result_ok);
8248         return *owner->contents.result;
8249 }
8250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8251         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
8252         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
8253 }
8254
8255 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
8256 CHECK(!owner->result_ok);
8257         return RetryableSendFailure_clone(&*owner->contents.err);
8258 }
8259 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8260         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
8261         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
8262         return ret_conv;
8263 }
8264
8265 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
8266 CHECK(owner->result_ok);
8267         return ThirtyTwoBytes_clone(&*owner->contents.result);
8268 }
8269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8270         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
8271         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8272         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
8273         return ret_arr;
8274 }
8275
8276 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
8277 CHECK(!owner->result_ok);
8278         return PaymentSendFailure_clone(&*owner->contents.err);
8279 }
8280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8281         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
8282         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8283         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
8284         int64_t ret_ref = tag_ptr(ret_copy, true);
8285         return ret_ref;
8286 }
8287
8288 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
8289 CHECK(owner->result_ok);
8290         return ThirtyTwoBytes_clone(&*owner->contents.result);
8291 }
8292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8293         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
8294         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8295         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
8296         return ret_arr;
8297 }
8298
8299 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
8300 CHECK(!owner->result_ok);
8301         return RetryableSendFailure_clone(&*owner->contents.err);
8302 }
8303 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8304         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
8305         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
8306         return ret_conv;
8307 }
8308
8309 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
8310         return ThirtyTwoBytes_clone(&owner->a);
8311 }
8312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8313         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
8314         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8315         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
8316         return ret_arr;
8317 }
8318
8319 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
8320         return ThirtyTwoBytes_clone(&owner->b);
8321 }
8322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8323         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
8324         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8325         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
8326         return ret_arr;
8327 }
8328
8329 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
8330 CHECK(owner->result_ok);
8331         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
8332 }
8333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8334         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
8335         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8336         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
8337         return tag_ptr(ret_conv, true);
8338 }
8339
8340 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
8341 CHECK(!owner->result_ok);
8342         return PaymentSendFailure_clone(&*owner->contents.err);
8343 }
8344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8345         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
8346         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8347         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
8348         int64_t ret_ref = tag_ptr(ret_copy, true);
8349         return ret_ref;
8350 }
8351
8352 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
8353         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
8354         for (size_t i = 0; i < ret.datalen; i++) {
8355                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
8356         }
8357         return ret;
8358 }
8359 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
8360 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
8361 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
8362 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
8363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
8364         LDKProbeSendFailure_RouteNotFound_class =
8365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
8366         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
8367         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
8368         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
8369         LDKProbeSendFailure_SendingFailed_class =
8370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
8371         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
8372         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
8373         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
8374 }
8375 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8376         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
8377         switch(obj->tag) {
8378                 case LDKProbeSendFailure_RouteNotFound: {
8379                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
8380                 }
8381                 case LDKProbeSendFailure_SendingFailed: {
8382                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
8383                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
8384                 }
8385                 default: abort();
8386         }
8387 }
8388 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
8389 CHECK(owner->result_ok);
8390         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
8391 }
8392 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8393         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
8394         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
8395         int64_tArray ret_arr = NULL;
8396         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8397         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8398         for (size_t o = 0; o < ret_var.datalen; o++) {
8399                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8400                 *ret_conv_40_conv = ret_var.data[o];
8401                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8402         }
8403         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8404         FREE(ret_var.data);
8405         return ret_arr;
8406 }
8407
8408 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
8409 CHECK(!owner->result_ok);
8410         return ProbeSendFailure_clone(&*owner->contents.err);
8411 }
8412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8413         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
8414         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
8415         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
8416         int64_t ret_ref = tag_ptr(ret_copy, true);
8417         return ret_ref;
8418 }
8419
8420 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
8421         LDKChannelId ret = owner->a;
8422         ret.is_owned = false;
8423         return ret;
8424 }
8425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8426         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
8427         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
8428         int64_t ret_ref = 0;
8429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8431         return ret_ref;
8432 }
8433
8434 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
8435         return owner->b;
8436 }
8437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8438         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
8439         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8440         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form);
8441         return ret_arr;
8442 }
8443
8444 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
8445         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
8446         for (size_t i = 0; i < ret.datalen; i++) {
8447                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
8448         }
8449         return ret;
8450 }
8451 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
8452         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
8453         for (size_t i = 0; i < ret.datalen; i++) {
8454                 ret.data[i] = ChannelId_clone(&orig->data[i]);
8455         }
8456         return ret;
8457 }
8458 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8459         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
8460         ret.is_owned = false;
8461         return ret;
8462 }
8463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8464         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8465         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8466         int64_t ret_ref = 0;
8467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8469         return ret_ref;
8470 }
8471
8472 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8473 CHECK(!owner->result_ok);
8474         return Bolt12SemanticError_clone(&*owner->contents.err);
8475 }
8476 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8477         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8478         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8479         return ret_conv;
8480 }
8481
8482 static jclass LDKCOption_StrZ_Some_class = NULL;
8483 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
8484 static jclass LDKCOption_StrZ_None_class = NULL;
8485 static jmethodID LDKCOption_StrZ_None_meth = NULL;
8486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
8487         LDKCOption_StrZ_Some_class =
8488                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
8489         CHECK(LDKCOption_StrZ_Some_class != NULL);
8490         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
8491         CHECK(LDKCOption_StrZ_Some_meth != NULL);
8492         LDKCOption_StrZ_None_class =
8493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
8494         CHECK(LDKCOption_StrZ_None_class != NULL);
8495         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
8496         CHECK(LDKCOption_StrZ_None_meth != NULL);
8497 }
8498 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8499         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
8500         switch(obj->tag) {
8501                 case LDKCOption_StrZ_Some: {
8502                         LDKStr some_str = obj->some;
8503                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
8504                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
8505                 }
8506                 case LDKCOption_StrZ_None: {
8507                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
8508                 }
8509                 default: abort();
8510         }
8511 }
8512 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
8513 CHECK(owner->result_ok);
8514         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
8515 }
8516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8517         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
8518         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8519         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
8520         return tag_ptr(ret_conv, true);
8521 }
8522
8523 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
8524 CHECK(!owner->result_ok);
8525         return *owner->contents.err;
8526 }
8527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8528         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
8529         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
8530 }
8531
8532 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
8533 CHECK(owner->result_ok);
8534         return ThirtyTwoBytes_clone(&*owner->contents.result);
8535 }
8536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8537         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
8538         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8539         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
8540         return ret_arr;
8541 }
8542
8543 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
8544 CHECK(!owner->result_ok);
8545         return APIError_clone(&*owner->contents.err);
8546 }
8547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8548         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
8549         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8550         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
8551         int64_t ret_ref = tag_ptr(ret_copy, true);
8552         return ret_ref;
8553 }
8554
8555 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
8556 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
8557 static jclass LDKOffersMessage_Invoice_class = NULL;
8558 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
8559 static jclass LDKOffersMessage_InvoiceError_class = NULL;
8560 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
8561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
8562         LDKOffersMessage_InvoiceRequest_class =
8563                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
8564         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
8565         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
8566         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
8567         LDKOffersMessage_Invoice_class =
8568                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
8569         CHECK(LDKOffersMessage_Invoice_class != NULL);
8570         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
8571         CHECK(LDKOffersMessage_Invoice_meth != NULL);
8572         LDKOffersMessage_InvoiceError_class =
8573                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
8574         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
8575         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
8576         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
8577 }
8578 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8579         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
8580         switch(obj->tag) {
8581                 case LDKOffersMessage_InvoiceRequest: {
8582                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
8583                         int64_t invoice_request_ref = 0;
8584                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8585                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
8586                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
8587                 }
8588                 case LDKOffersMessage_Invoice: {
8589                         LDKBolt12Invoice invoice_var = obj->invoice;
8590                         int64_t invoice_ref = 0;
8591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8592                         invoice_ref = tag_ptr(invoice_var.inner, false);
8593                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
8594                 }
8595                 case LDKOffersMessage_InvoiceError: {
8596                         LDKInvoiceError invoice_error_var = obj->invoice_error;
8597                         int64_t invoice_error_ref = 0;
8598                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
8599                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
8600                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
8601                 }
8602                 default: abort();
8603         }
8604 }
8605 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
8606 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
8607 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
8608 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
8610         LDKCOption_OffersMessageZ_Some_class =
8611                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
8612         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
8613         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
8614         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
8615         LDKCOption_OffersMessageZ_None_class =
8616                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
8617         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
8618         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
8619         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
8620 }
8621 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8622         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
8623         switch(obj->tag) {
8624                 case LDKCOption_OffersMessageZ_Some: {
8625                         int64_t some_ref = tag_ptr(&obj->some, false);
8626                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
8627                 }
8628                 case LDKCOption_OffersMessageZ_None: {
8629                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
8630                 }
8631                 default: abort();
8632         }
8633 }
8634 static jclass LDKDestination_Node_class = NULL;
8635 static jmethodID LDKDestination_Node_meth = NULL;
8636 static jclass LDKDestination_BlindedPath_class = NULL;
8637 static jmethodID LDKDestination_BlindedPath_meth = NULL;
8638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
8639         LDKDestination_Node_class =
8640                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
8641         CHECK(LDKDestination_Node_class != NULL);
8642         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
8643         CHECK(LDKDestination_Node_meth != NULL);
8644         LDKDestination_BlindedPath_class =
8645                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
8646         CHECK(LDKDestination_BlindedPath_class != NULL);
8647         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
8648         CHECK(LDKDestination_BlindedPath_meth != NULL);
8649 }
8650 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8651         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
8652         switch(obj->tag) {
8653                 case LDKDestination_Node: {
8654                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
8655                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
8656                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
8657                 }
8658                 case LDKDestination_BlindedPath: {
8659                         LDKBlindedPath blinded_path_var = obj->blinded_path;
8660                         int64_t blinded_path_ref = 0;
8661                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
8662                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
8663                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
8664                 }
8665                 default: abort();
8666         }
8667 }
8668 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8669         return OffersMessage_clone(&owner->a);
8670 }
8671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8672         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8673         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8674         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
8675         int64_t ret_ref = tag_ptr(ret_copy, true);
8676         return ret_ref;
8677 }
8678
8679 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8680         return Destination_clone(&owner->b);
8681 }
8682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8683         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8684         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8685         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
8686         int64_t ret_ref = tag_ptr(ret_copy, true);
8687         return ret_ref;
8688 }
8689
8690 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8691         LDKBlindedPath ret = owner->c;
8692         ret.is_owned = false;
8693         return ret;
8694 }
8695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
8696         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8697         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
8698         int64_t ret_ref = 0;
8699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8701         return ret_ref;
8702 }
8703
8704 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
8705         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8706         for (size_t i = 0; i < ret.datalen; i++) {
8707                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
8708         }
8709         return ret;
8710 }
8711 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
8712         LDKPhantomRouteHints ret = *owner->contents.result;
8713         ret.is_owned = false;
8714         return ret;
8715 }
8716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8717         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
8718         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
8719         int64_t ret_ref = 0;
8720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8722         return ret_ref;
8723 }
8724
8725 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
8726 CHECK(!owner->result_ok);
8727         return DecodeError_clone(&*owner->contents.err);
8728 }
8729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8730         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
8731         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8732         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
8733         int64_t ret_ref = tag_ptr(ret_copy, true);
8734         return ret_ref;
8735 }
8736
8737 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
8738         LDKBlindedForward ret = *owner->contents.result;
8739         ret.is_owned = false;
8740         return ret;
8741 }
8742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8743         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
8744         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
8745         int64_t ret_ref = 0;
8746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8748         return ret_ref;
8749 }
8750
8751 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
8752 CHECK(!owner->result_ok);
8753         return DecodeError_clone(&*owner->contents.err);
8754 }
8755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8756         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
8757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8758         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
8759         int64_t ret_ref = tag_ptr(ret_copy, true);
8760         return ret_ref;
8761 }
8762
8763 static jclass LDKPendingHTLCRouting_Forward_class = NULL;
8764 static jmethodID LDKPendingHTLCRouting_Forward_meth = NULL;
8765 static jclass LDKPendingHTLCRouting_Receive_class = NULL;
8766 static jmethodID LDKPendingHTLCRouting_Receive_meth = NULL;
8767 static jclass LDKPendingHTLCRouting_ReceiveKeysend_class = NULL;
8768 static jmethodID LDKPendingHTLCRouting_ReceiveKeysend_meth = NULL;
8769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPendingHTLCRouting_init (JNIEnv *env, jclass clz) {
8770         LDKPendingHTLCRouting_Forward_class =
8771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Forward"));
8772         CHECK(LDKPendingHTLCRouting_Forward_class != NULL);
8773         LDKPendingHTLCRouting_Forward_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Forward_class, "<init>", "(JJJ)V");
8774         CHECK(LDKPendingHTLCRouting_Forward_meth != NULL);
8775         LDKPendingHTLCRouting_Receive_class =
8776                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Receive"));
8777         CHECK(LDKPendingHTLCRouting_Receive_class != NULL);
8778         LDKPendingHTLCRouting_Receive_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Receive_class, "<init>", "(JJJI[B[JZ)V");
8779         CHECK(LDKPendingHTLCRouting_Receive_meth != NULL);
8780         LDKPendingHTLCRouting_ReceiveKeysend_class =
8781                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$ReceiveKeysend"));
8782         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_class != NULL);
8783         LDKPendingHTLCRouting_ReceiveKeysend_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_ReceiveKeysend_class, "<init>", "(J[BJI[JZ)V");
8784         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_meth != NULL);
8785 }
8786 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPendingHTLCRouting_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8787         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
8788         switch(obj->tag) {
8789                 case LDKPendingHTLCRouting_Forward: {
8790                         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
8791                         int64_t onion_packet_ref = 0;
8792                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
8793                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
8794                         int64_t short_channel_id_conv = obj->forward.short_channel_id;
8795                         LDKBlindedForward blinded_var = obj->forward.blinded;
8796                         int64_t blinded_ref = 0;
8797                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
8798                         blinded_ref = tag_ptr(blinded_var.inner, false);
8799                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Forward_class, LDKPendingHTLCRouting_Forward_meth, onion_packet_ref, short_channel_id_conv, blinded_ref);
8800                 }
8801                 case LDKPendingHTLCRouting_Receive: {
8802                         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
8803                         int64_t payment_data_ref = 0;
8804                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8805                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8806                         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
8807                         int64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
8808                         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
8809                         int8_tArray phantom_shared_secret_arr = (*env)->NewByteArray(env, 32);
8810                         (*env)->SetByteArrayRegion(env, phantom_shared_secret_arr, 0, 32, obj->receive.phantom_shared_secret.data);
8811                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
8812                         int64_tArray custom_tlvs_arr = NULL;
8813                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8814                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8815                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8816                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8817                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8818                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8819                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8820                         }
8821                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8822                         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
8823                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Receive_class, LDKPendingHTLCRouting_Receive_meth, payment_data_ref, payment_metadata_ref, payment_context_ref, incoming_cltv_expiry_conv, phantom_shared_secret_arr, custom_tlvs_arr, requires_blinded_error_conv);
8824                 }
8825                 case LDKPendingHTLCRouting_ReceiveKeysend: {
8826                         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
8827                         int64_t payment_data_ref = 0;
8828                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8829                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8830                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
8831                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->receive_keysend.payment_preimage.data);
8832                         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
8833                         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
8834                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
8835                         int64_tArray custom_tlvs_arr = NULL;
8836                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8837                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8838                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8839                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8840                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8841                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8842                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8843                         }
8844                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8845                         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
8846                         return (*env)->NewObject(env, LDKPendingHTLCRouting_ReceiveKeysend_class, LDKPendingHTLCRouting_ReceiveKeysend_meth, payment_data_ref, payment_preimage_arr, payment_metadata_ref, incoming_cltv_expiry_conv, custom_tlvs_arr, requires_blinded_error_conv);
8847                 }
8848                 default: abort();
8849         }
8850 }
8851 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8852 CHECK(owner->result_ok);
8853         return PendingHTLCRouting_clone(&*owner->contents.result);
8854 }
8855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8856         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8857         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
8858         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
8859         int64_t ret_ref = tag_ptr(ret_copy, true);
8860         return ret_ref;
8861 }
8862
8863 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8864 CHECK(!owner->result_ok);
8865         return DecodeError_clone(&*owner->contents.err);
8866 }
8867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8868         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8870         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
8871         int64_t ret_ref = tag_ptr(ret_copy, true);
8872         return ret_ref;
8873 }
8874
8875 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8876         LDKPendingHTLCInfo ret = *owner->contents.result;
8877         ret.is_owned = false;
8878         return ret;
8879 }
8880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8881         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8882         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
8883         int64_t ret_ref = 0;
8884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8886         return ret_ref;
8887 }
8888
8889 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8890 CHECK(!owner->result_ok);
8891         return DecodeError_clone(&*owner->contents.err);
8892 }
8893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8894         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8895         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8896         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
8897         int64_t ret_ref = tag_ptr(ret_copy, true);
8898         return ret_ref;
8899 }
8900
8901 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8902 CHECK(owner->result_ok);
8903         return BlindedFailure_clone(&*owner->contents.result);
8904 }
8905 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8906         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8907         jclass ret_conv = LDKBlindedFailure_to_java(env, CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
8908         return ret_conv;
8909 }
8910
8911 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8912 CHECK(!owner->result_ok);
8913         return DecodeError_clone(&*owner->contents.err);
8914 }
8915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8916         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8917         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8918         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
8919         int64_t ret_ref = tag_ptr(ret_copy, true);
8920         return ret_ref;
8921 }
8922
8923 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
8924         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
8925         for (size_t i = 0; i < ret.datalen; i++) {
8926                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
8927         }
8928         return ret;
8929 }
8930 typedef struct LDKWatch_JCalls {
8931         atomic_size_t refcnt;
8932         JavaVM *vm;
8933         jweak o;
8934         jmethodID watch_channel_meth;
8935         jmethodID update_channel_meth;
8936         jmethodID release_pending_monitor_events_meth;
8937 } LDKWatch_JCalls;
8938 static void LDKWatch_JCalls_free(void* this_arg) {
8939         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8940         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8941                 JNIEnv *env;
8942                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8943                 if (get_jenv_res == JNI_EDETACHED) {
8944                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8945                 } else {
8946                         DO_ASSERT(get_jenv_res == JNI_OK);
8947                 }
8948                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8949                 if (get_jenv_res == JNI_EDETACHED) {
8950                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8951                 }
8952                 FREE(j_calls);
8953         }
8954 }
8955 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
8956         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8957         JNIEnv *env;
8958         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8959         if (get_jenv_res == JNI_EDETACHED) {
8960                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8961         } else {
8962                 DO_ASSERT(get_jenv_res == JNI_OK);
8963         }
8964         LDKOutPoint funding_txo_var = funding_txo;
8965         int64_t funding_txo_ref = 0;
8966         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
8967         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
8968         LDKChannelMonitor monitor_var = monitor;
8969         int64_t monitor_ref = 0;
8970         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
8971         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
8972         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8973         CHECK(obj != NULL);
8974         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
8975         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8976                 (*env)->ExceptionDescribe(env);
8977                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
8978         }
8979         void* ret_ptr = untag_ptr(ret);
8980         CHECK_ACCESS(ret_ptr);
8981         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
8982         FREE(untag_ptr(ret));
8983         if (get_jenv_res == JNI_EDETACHED) {
8984                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8985         }
8986         return ret_conv;
8987 }
8988 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
8989         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8990         JNIEnv *env;
8991         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8992         if (get_jenv_res == JNI_EDETACHED) {
8993                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8994         } else {
8995                 DO_ASSERT(get_jenv_res == JNI_OK);
8996         }
8997         LDKOutPoint funding_txo_var = funding_txo;
8998         int64_t funding_txo_ref = 0;
8999         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9000         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
9001         LDKChannelMonitorUpdate update_var = *update;
9002         int64_t update_ref = 0;
9003         update_var = ChannelMonitorUpdate_clone(&update_var);
9004         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9005         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9006         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9007         CHECK(obj != NULL);
9008         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
9009         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9010                 (*env)->ExceptionDescribe(env);
9011                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
9012         }
9013         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
9014         if (get_jenv_res == JNI_EDETACHED) {
9015                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9016         }
9017         return ret_conv;
9018 }
9019 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
9020         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
9021         JNIEnv *env;
9022         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9023         if (get_jenv_res == JNI_EDETACHED) {
9024                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9025         } else {
9026                 DO_ASSERT(get_jenv_res == JNI_OK);
9027         }
9028         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9029         CHECK(obj != NULL);
9030         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
9031         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9032                 (*env)->ExceptionDescribe(env);
9033                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
9034         }
9035         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
9036         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9037         if (ret_constr.datalen > 0)
9038                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
9039         else
9040                 ret_constr.data = NULL;
9041         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9042         for (size_t f = 0; f < ret_constr.datalen; f++) {
9043                 int64_t ret_conv_57 = ret_vals[f];
9044                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
9045                 CHECK_ACCESS(ret_conv_57_ptr);
9046                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
9047                 FREE(untag_ptr(ret_conv_57));
9048                 ret_constr.data[f] = ret_conv_57_conv;
9049         }
9050         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9051         if (get_jenv_res == JNI_EDETACHED) {
9052                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9053         }
9054         return ret_constr;
9055 }
9056 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
9057         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
9058         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9059 }
9060 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
9061         jclass c = (*env)->GetObjectClass(env, o);
9062         CHECK(c != NULL);
9063         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
9064         atomic_init(&calls->refcnt, 1);
9065         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9066         calls->o = (*env)->NewWeakGlobalRef(env, o);
9067         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
9068         CHECK(calls->watch_channel_meth != NULL);
9069         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
9070         CHECK(calls->update_channel_meth != NULL);
9071         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
9072         CHECK(calls->release_pending_monitor_events_meth != NULL);
9073
9074         LDKWatch ret = {
9075                 .this_arg = (void*) calls,
9076                 .watch_channel = watch_channel_LDKWatch_jcall,
9077                 .update_channel = update_channel_LDKWatch_jcall,
9078                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
9079                 .free = LDKWatch_JCalls_free,
9080         };
9081         return ret;
9082 }
9083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
9084         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
9085         *res_ptr = LDKWatch_init(env, clz, o);
9086         return tag_ptr(res_ptr, true);
9087 }
9088 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) {
9089         void* this_arg_ptr = untag_ptr(this_arg);
9090         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9091         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9092         LDKOutPoint funding_txo_conv;
9093         funding_txo_conv.inner = untag_ptr(funding_txo);
9094         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
9095         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
9096         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9097         LDKChannelMonitor monitor_conv;
9098         monitor_conv.inner = untag_ptr(monitor);
9099         monitor_conv.is_owned = ptr_is_owned(monitor);
9100         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
9101         monitor_conv = ChannelMonitor_clone(&monitor_conv);
9102         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
9103         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
9104         return tag_ptr(ret_conv, true);
9105 }
9106
9107 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) {
9108         void* this_arg_ptr = untag_ptr(this_arg);
9109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9110         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9111         LDKOutPoint funding_txo_conv;
9112         funding_txo_conv.inner = untag_ptr(funding_txo);
9113         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
9114         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
9115         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9116         LDKChannelMonitorUpdate update_conv;
9117         update_conv.inner = untag_ptr(update);
9118         update_conv.is_owned = ptr_is_owned(update);
9119         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9120         update_conv.is_owned = false;
9121         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
9122         return ret_conv;
9123 }
9124
9125 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9126         void* this_arg_ptr = untag_ptr(this_arg);
9127         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9128         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9129         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
9130         int64_tArray ret_arr = NULL;
9131         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9132         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9133         for (size_t f = 0; f < ret_var.datalen; f++) {
9134                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
9135                 *ret_conv_57_conv = ret_var.data[f];
9136                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
9137         }
9138         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9139         FREE(ret_var.data);
9140         return ret_arr;
9141 }
9142
9143 typedef struct LDKBroadcasterInterface_JCalls {
9144         atomic_size_t refcnt;
9145         JavaVM *vm;
9146         jweak o;
9147         jmethodID broadcast_transactions_meth;
9148 } LDKBroadcasterInterface_JCalls;
9149 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
9150         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
9151         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9152                 JNIEnv *env;
9153                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9154                 if (get_jenv_res == JNI_EDETACHED) {
9155                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9156                 } else {
9157                         DO_ASSERT(get_jenv_res == JNI_OK);
9158                 }
9159                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9160                 if (get_jenv_res == JNI_EDETACHED) {
9161                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9162                 }
9163                 FREE(j_calls);
9164         }
9165 }
9166 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
9167         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
9168         JNIEnv *env;
9169         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9170         if (get_jenv_res == JNI_EDETACHED) {
9171                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9172         } else {
9173                 DO_ASSERT(get_jenv_res == JNI_OK);
9174         }
9175         LDKCVec_TransactionZ txs_var = txs;
9176         jobjectArray txs_arr = NULL;
9177         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
9178         ;
9179         for (size_t i = 0; i < txs_var.datalen; i++) {
9180                 LDKTransaction txs_conv_8_var = txs_var.data[i];
9181                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
9182                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
9183                 Transaction_free(txs_conv_8_var);
9184                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
9185         }
9186         
9187         FREE(txs_var.data);
9188         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9189         CHECK(obj != NULL);
9190         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
9191         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9192                 (*env)->ExceptionDescribe(env);
9193                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
9194         }
9195         if (get_jenv_res == JNI_EDETACHED) {
9196                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9197         }
9198 }
9199 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
9200         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
9201         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9202 }
9203 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
9204         jclass c = (*env)->GetObjectClass(env, o);
9205         CHECK(c != NULL);
9206         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
9207         atomic_init(&calls->refcnt, 1);
9208         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9209         calls->o = (*env)->NewWeakGlobalRef(env, o);
9210         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
9211         CHECK(calls->broadcast_transactions_meth != NULL);
9212
9213         LDKBroadcasterInterface ret = {
9214                 .this_arg = (void*) calls,
9215                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
9216                 .free = LDKBroadcasterInterface_JCalls_free,
9217         };
9218         return ret;
9219 }
9220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
9221         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
9222         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
9223         return tag_ptr(res_ptr, true);
9224 }
9225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
9226         void* this_arg_ptr = untag_ptr(this_arg);
9227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9228         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
9229         LDKCVec_TransactionZ txs_constr;
9230         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
9231         if (txs_constr.datalen > 0)
9232                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9233         else
9234                 txs_constr.data = NULL;
9235         for (size_t i = 0; i < txs_constr.datalen; i++) {
9236                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
9237                 LDKTransaction txs_conv_8_ref;
9238                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
9239                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
9240                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
9241                 txs_conv_8_ref.data_is_owned = true;
9242                 txs_constr.data[i] = txs_conv_8_ref;
9243         }
9244         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
9245 }
9246
9247 typedef struct LDKEntropySource_JCalls {
9248         atomic_size_t refcnt;
9249         JavaVM *vm;
9250         jweak o;
9251         jmethodID get_secure_random_bytes_meth;
9252 } LDKEntropySource_JCalls;
9253 static void LDKEntropySource_JCalls_free(void* this_arg) {
9254         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
9255         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9256                 JNIEnv *env;
9257                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9258                 if (get_jenv_res == JNI_EDETACHED) {
9259                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9260                 } else {
9261                         DO_ASSERT(get_jenv_res == JNI_OK);
9262                 }
9263                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9264                 if (get_jenv_res == JNI_EDETACHED) {
9265                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9266                 }
9267                 FREE(j_calls);
9268         }
9269 }
9270 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
9271         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
9272         JNIEnv *env;
9273         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9274         if (get_jenv_res == JNI_EDETACHED) {
9275                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9276         } else {
9277                 DO_ASSERT(get_jenv_res == JNI_OK);
9278         }
9279         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9280         CHECK(obj != NULL);
9281         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
9282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9283                 (*env)->ExceptionDescribe(env);
9284                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
9285         }
9286         LDKThirtyTwoBytes ret_ref;
9287         CHECK((*env)->GetArrayLength(env, ret) == 32);
9288         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9289         if (get_jenv_res == JNI_EDETACHED) {
9290                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9291         }
9292         return ret_ref;
9293 }
9294 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
9295         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
9296         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9297 }
9298 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
9299         jclass c = (*env)->GetObjectClass(env, o);
9300         CHECK(c != NULL);
9301         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
9302         atomic_init(&calls->refcnt, 1);
9303         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9304         calls->o = (*env)->NewWeakGlobalRef(env, o);
9305         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
9306         CHECK(calls->get_secure_random_bytes_meth != NULL);
9307
9308         LDKEntropySource ret = {
9309                 .this_arg = (void*) calls,
9310                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
9311                 .free = LDKEntropySource_JCalls_free,
9312         };
9313         return ret;
9314 }
9315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
9316         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
9317         *res_ptr = LDKEntropySource_init(env, clz, o);
9318         return tag_ptr(res_ptr, true);
9319 }
9320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
9321         void* this_arg_ptr = untag_ptr(this_arg);
9322         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9323         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
9324         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9325         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
9326         return ret_arr;
9327 }
9328
9329 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
9330 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
9331 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
9332 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
9333 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
9334 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
9335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
9336         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
9337                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
9338         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
9339         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
9340         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
9341         LDKUnsignedGossipMessage_ChannelUpdate_class =
9342                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
9343         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
9344         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
9345         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
9346         LDKUnsignedGossipMessage_NodeAnnouncement_class =
9347                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
9348         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
9349         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
9350         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
9351 }
9352 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9353         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
9354         switch(obj->tag) {
9355                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
9356                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
9357                         int64_t channel_announcement_ref = 0;
9358                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
9359                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
9360                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
9361                 }
9362                 case LDKUnsignedGossipMessage_ChannelUpdate: {
9363                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
9364                         int64_t channel_update_ref = 0;
9365                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
9366                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
9367                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
9368                 }
9369                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
9370                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
9371                         int64_t node_announcement_ref = 0;
9372                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
9373                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
9374                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
9375                 }
9376                 default: abort();
9377         }
9378 }
9379 typedef struct LDKNodeSigner_JCalls {
9380         atomic_size_t refcnt;
9381         JavaVM *vm;
9382         jweak o;
9383         jmethodID get_inbound_payment_key_material_meth;
9384         jmethodID get_node_id_meth;
9385         jmethodID ecdh_meth;
9386         jmethodID sign_invoice_meth;
9387         jmethodID sign_bolt12_invoice_request_meth;
9388         jmethodID sign_bolt12_invoice_meth;
9389         jmethodID sign_gossip_message_meth;
9390 } LDKNodeSigner_JCalls;
9391 static void LDKNodeSigner_JCalls_free(void* this_arg) {
9392         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9393         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9394                 JNIEnv *env;
9395                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9396                 if (get_jenv_res == JNI_EDETACHED) {
9397                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9398                 } else {
9399                         DO_ASSERT(get_jenv_res == JNI_OK);
9400                 }
9401                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9402                 if (get_jenv_res == JNI_EDETACHED) {
9403                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9404                 }
9405                 FREE(j_calls);
9406         }
9407 }
9408 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
9409         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9410         JNIEnv *env;
9411         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9412         if (get_jenv_res == JNI_EDETACHED) {
9413                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9414         } else {
9415                 DO_ASSERT(get_jenv_res == JNI_OK);
9416         }
9417         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9418         CHECK(obj != NULL);
9419         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
9420         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9421                 (*env)->ExceptionDescribe(env);
9422                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
9423         }
9424         LDKThirtyTwoBytes ret_ref;
9425         CHECK((*env)->GetArrayLength(env, ret) == 32);
9426         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9427         if (get_jenv_res == JNI_EDETACHED) {
9428                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9429         }
9430         return ret_ref;
9431 }
9432 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
9433         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9434         JNIEnv *env;
9435         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9436         if (get_jenv_res == JNI_EDETACHED) {
9437                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9438         } else {
9439                 DO_ASSERT(get_jenv_res == JNI_OK);
9440         }
9441         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9442         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9443         CHECK(obj != NULL);
9444         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
9445         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9446                 (*env)->ExceptionDescribe(env);
9447                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
9448         }
9449         void* ret_ptr = untag_ptr(ret);
9450         CHECK_ACCESS(ret_ptr);
9451         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
9452         FREE(untag_ptr(ret));
9453         if (get_jenv_res == JNI_EDETACHED) {
9454                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9455         }
9456         return ret_conv;
9457 }
9458 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
9459         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9460         JNIEnv *env;
9461         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9462         if (get_jenv_res == JNI_EDETACHED) {
9463                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9464         } else {
9465                 DO_ASSERT(get_jenv_res == JNI_OK);
9466         }
9467         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9468         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
9469         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
9470         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
9471         *tweak_copy = tweak;
9472         int64_t tweak_ref = tag_ptr(tweak_copy, true);
9473         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9474         CHECK(obj != NULL);
9475         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
9476         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9477                 (*env)->ExceptionDescribe(env);
9478                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
9479         }
9480         void* ret_ptr = untag_ptr(ret);
9481         CHECK_ACCESS(ret_ptr);
9482         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
9483         FREE(untag_ptr(ret));
9484         if (get_jenv_res == JNI_EDETACHED) {
9485                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9486         }
9487         return ret_conv;
9488 }
9489 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
9490         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9491         JNIEnv *env;
9492         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9493         if (get_jenv_res == JNI_EDETACHED) {
9494                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9495         } else {
9496                 DO_ASSERT(get_jenv_res == JNI_OK);
9497         }
9498         LDKu8slice hrp_bytes_var = hrp_bytes;
9499         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
9500         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
9501         LDKCVec_U5Z invoice_data_var = invoice_data;
9502         jobjectArray invoice_data_arr = NULL;
9503         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
9504         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
9505         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
9506                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
9507                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
9508         }
9509         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
9510         FREE(invoice_data_var.data);
9511         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9512         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9513         CHECK(obj != NULL);
9514         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
9515         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9516                 (*env)->ExceptionDescribe(env);
9517                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
9518         }
9519         void* ret_ptr = untag_ptr(ret);
9520         CHECK_ACCESS(ret_ptr);
9521         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
9522         FREE(untag_ptr(ret));
9523         if (get_jenv_res == JNI_EDETACHED) {
9524                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9525         }
9526         return ret_conv;
9527 }
9528 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
9529         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9530         JNIEnv *env;
9531         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9532         if (get_jenv_res == JNI_EDETACHED) {
9533                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9534         } else {
9535                 DO_ASSERT(get_jenv_res == JNI_OK);
9536         }
9537         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
9538         int64_t invoice_request_ref = 0;
9539         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
9540         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9541         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
9542         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9543         CHECK(obj != NULL);
9544         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
9545         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9546                 (*env)->ExceptionDescribe(env);
9547                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
9548         }
9549         void* ret_ptr = untag_ptr(ret);
9550         CHECK_ACCESS(ret_ptr);
9551         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
9552         FREE(untag_ptr(ret));
9553         if (get_jenv_res == JNI_EDETACHED) {
9554                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9555         }
9556         return ret_conv;
9557 }
9558 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
9559         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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         LDKUnsignedBolt12Invoice invoice_var = *invoice;
9568         int64_t invoice_ref = 0;
9569         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
9570         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9571         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
9572         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9573         CHECK(obj != NULL);
9574         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
9575         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9576                 (*env)->ExceptionDescribe(env);
9577                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
9578         }
9579         void* ret_ptr = untag_ptr(ret);
9580         CHECK_ACCESS(ret_ptr);
9581         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
9582         FREE(untag_ptr(ret));
9583         if (get_jenv_res == JNI_EDETACHED) {
9584                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9585         }
9586         return ret_conv;
9587 }
9588 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
9589         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9590         JNIEnv *env;
9591         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9592         if (get_jenv_res == JNI_EDETACHED) {
9593                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9594         } else {
9595                 DO_ASSERT(get_jenv_res == JNI_OK);
9596         }
9597         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
9598         *msg_copy = msg;
9599         int64_t msg_ref = tag_ptr(msg_copy, true);
9600         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9601         CHECK(obj != NULL);
9602         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
9603         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9604                 (*env)->ExceptionDescribe(env);
9605                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
9606         }
9607         void* ret_ptr = untag_ptr(ret);
9608         CHECK_ACCESS(ret_ptr);
9609         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
9610         FREE(untag_ptr(ret));
9611         if (get_jenv_res == JNI_EDETACHED) {
9612                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9613         }
9614         return ret_conv;
9615 }
9616 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
9617         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
9618         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9619 }
9620 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
9621         jclass c = (*env)->GetObjectClass(env, o);
9622         CHECK(c != NULL);
9623         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
9624         atomic_init(&calls->refcnt, 1);
9625         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9626         calls->o = (*env)->NewWeakGlobalRef(env, o);
9627         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
9628         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
9629         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
9630         CHECK(calls->get_node_id_meth != NULL);
9631         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
9632         CHECK(calls->ecdh_meth != NULL);
9633         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
9634         CHECK(calls->sign_invoice_meth != NULL);
9635         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
9636         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
9637         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
9638         CHECK(calls->sign_bolt12_invoice_meth != NULL);
9639         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
9640         CHECK(calls->sign_gossip_message_meth != NULL);
9641
9642         LDKNodeSigner ret = {
9643                 .this_arg = (void*) calls,
9644                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
9645                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
9646                 .ecdh = ecdh_LDKNodeSigner_jcall,
9647                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
9648                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
9649                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
9650                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
9651                 .free = LDKNodeSigner_JCalls_free,
9652         };
9653         return ret;
9654 }
9655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
9656         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
9657         *res_ptr = LDKNodeSigner_init(env, clz, o);
9658         return tag_ptr(res_ptr, true);
9659 }
9660 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
9661         void* this_arg_ptr = untag_ptr(this_arg);
9662         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9663         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9664         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9665         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
9666         return ret_arr;
9667 }
9668
9669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
9670         void* this_arg_ptr = untag_ptr(this_arg);
9671         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9672         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9673         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9674         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
9675         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
9676         return tag_ptr(ret_conv, true);
9677 }
9678
9679 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) {
9680         void* this_arg_ptr = untag_ptr(this_arg);
9681         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9682         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9683         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9684         LDKPublicKey other_key_ref;
9685         CHECK((*env)->GetArrayLength(env, other_key) == 33);
9686         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
9687         void* tweak_ptr = untag_ptr(tweak);
9688         CHECK_ACCESS(tweak_ptr);
9689         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
9690         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
9691         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
9692         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
9693         return tag_ptr(ret_conv, true);
9694 }
9695
9696 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) {
9697         void* this_arg_ptr = untag_ptr(this_arg);
9698         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9699         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9700         LDKu8slice hrp_bytes_ref;
9701         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
9702         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
9703         LDKCVec_U5Z invoice_data_constr;
9704         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
9705         if (invoice_data_constr.datalen > 0)
9706                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
9707         else
9708                 invoice_data_constr.data = NULL;
9709         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
9710         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
9711                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
9712                 
9713                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
9714         }
9715         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
9716         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9717         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9718         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
9719         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
9720         return tag_ptr(ret_conv, true);
9721 }
9722
9723 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) {
9724         void* this_arg_ptr = untag_ptr(this_arg);
9725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9726         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9727         LDKUnsignedInvoiceRequest invoice_request_conv;
9728         invoice_request_conv.inner = untag_ptr(invoice_request);
9729         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
9730         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
9731         invoice_request_conv.is_owned = false;
9732         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
9733         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
9734         return tag_ptr(ret_conv, true);
9735 }
9736
9737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
9738         void* this_arg_ptr = untag_ptr(this_arg);
9739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9740         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9741         LDKUnsignedBolt12Invoice invoice_conv;
9742         invoice_conv.inner = untag_ptr(invoice);
9743         invoice_conv.is_owned = ptr_is_owned(invoice);
9744         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
9745         invoice_conv.is_owned = false;
9746         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
9747         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
9748         return tag_ptr(ret_conv, true);
9749 }
9750
9751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9752         void* this_arg_ptr = untag_ptr(this_arg);
9753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9754         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9755         void* msg_ptr = untag_ptr(msg);
9756         CHECK_ACCESS(msg_ptr);
9757         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
9758         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
9759         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
9760         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
9761         return tag_ptr(ret_conv, true);
9762 }
9763
9764 typedef struct LDKSignerProvider_JCalls {
9765         atomic_size_t refcnt;
9766         JavaVM *vm;
9767         jweak o;
9768         jmethodID generate_channel_keys_id_meth;
9769         jmethodID derive_channel_signer_meth;
9770         jmethodID read_chan_signer_meth;
9771         jmethodID get_destination_script_meth;
9772         jmethodID get_shutdown_scriptpubkey_meth;
9773 } LDKSignerProvider_JCalls;
9774 static void LDKSignerProvider_JCalls_free(void* this_arg) {
9775         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9776         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9777                 JNIEnv *env;
9778                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9779                 if (get_jenv_res == JNI_EDETACHED) {
9780                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9781                 } else {
9782                         DO_ASSERT(get_jenv_res == JNI_OK);
9783                 }
9784                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9785                 if (get_jenv_res == JNI_EDETACHED) {
9786                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9787                 }
9788                 FREE(j_calls);
9789         }
9790 }
9791 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
9792         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9793         JNIEnv *env;
9794         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9795         if (get_jenv_res == JNI_EDETACHED) {
9796                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9797         } else {
9798                 DO_ASSERT(get_jenv_res == JNI_OK);
9799         }
9800         jboolean inbound_conv = inbound;
9801         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9802         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
9803         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
9804         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9805         CHECK(obj != NULL);
9806         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
9807         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9808                 (*env)->ExceptionDescribe(env);
9809                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
9810         }
9811         LDKThirtyTwoBytes ret_ref;
9812         CHECK((*env)->GetArrayLength(env, ret) == 32);
9813         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9814         if (get_jenv_res == JNI_EDETACHED) {
9815                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9816         }
9817         return ret_ref;
9818 }
9819 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
9820         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9821         JNIEnv *env;
9822         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9823         if (get_jenv_res == JNI_EDETACHED) {
9824                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9825         } else {
9826                 DO_ASSERT(get_jenv_res == JNI_OK);
9827         }
9828         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9829         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9830         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9831         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9832         CHECK(obj != NULL);
9833         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
9834         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9835                 (*env)->ExceptionDescribe(env);
9836                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
9837         }
9838         void* ret_ptr = untag_ptr(ret);
9839         CHECK_ACCESS(ret_ptr);
9840         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
9841         FREE(untag_ptr(ret));
9842         if (get_jenv_res == JNI_EDETACHED) {
9843                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9844         }
9845         return ret_conv;
9846 }
9847 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
9848         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9849         JNIEnv *env;
9850         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9851         if (get_jenv_res == JNI_EDETACHED) {
9852                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9853         } else {
9854                 DO_ASSERT(get_jenv_res == JNI_OK);
9855         }
9856         LDKu8slice reader_var = reader;
9857         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
9858         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
9859         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9860         CHECK(obj != NULL);
9861         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
9862         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9863                 (*env)->ExceptionDescribe(env);
9864                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
9865         }
9866         void* ret_ptr = untag_ptr(ret);
9867         CHECK_ACCESS(ret_ptr);
9868         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
9869         FREE(untag_ptr(ret));
9870         if (get_jenv_res == JNI_EDETACHED) {
9871                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9872         }
9873         return ret_conv;
9874 }
9875 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
9876         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9877         JNIEnv *env;
9878         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9879         if (get_jenv_res == JNI_EDETACHED) {
9880                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9881         } else {
9882                 DO_ASSERT(get_jenv_res == JNI_OK);
9883         }
9884         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9885         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9886         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9887         CHECK(obj != NULL);
9888         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth, channel_keys_id_arr);
9889         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9890                 (*env)->ExceptionDescribe(env);
9891                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
9892         }
9893         void* ret_ptr = untag_ptr(ret);
9894         CHECK_ACCESS(ret_ptr);
9895         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
9896         FREE(untag_ptr(ret));
9897         if (get_jenv_res == JNI_EDETACHED) {
9898                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9899         }
9900         return ret_conv;
9901 }
9902 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
9903         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9904         JNIEnv *env;
9905         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9906         if (get_jenv_res == JNI_EDETACHED) {
9907                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9908         } else {
9909                 DO_ASSERT(get_jenv_res == JNI_OK);
9910         }
9911         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9912         CHECK(obj != NULL);
9913         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
9914         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9915                 (*env)->ExceptionDescribe(env);
9916                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
9917         }
9918         void* ret_ptr = untag_ptr(ret);
9919         CHECK_ACCESS(ret_ptr);
9920         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
9921         FREE(untag_ptr(ret));
9922         if (get_jenv_res == JNI_EDETACHED) {
9923                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9924         }
9925         return ret_conv;
9926 }
9927 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
9928         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
9929         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9930 }
9931 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
9932         jclass c = (*env)->GetObjectClass(env, o);
9933         CHECK(c != NULL);
9934         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
9935         atomic_init(&calls->refcnt, 1);
9936         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9937         calls->o = (*env)->NewWeakGlobalRef(env, o);
9938         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
9939         CHECK(calls->generate_channel_keys_id_meth != NULL);
9940         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
9941         CHECK(calls->derive_channel_signer_meth != NULL);
9942         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
9943         CHECK(calls->read_chan_signer_meth != NULL);
9944         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "([B)J");
9945         CHECK(calls->get_destination_script_meth != NULL);
9946         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
9947         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
9948
9949         LDKSignerProvider ret = {
9950                 .this_arg = (void*) calls,
9951                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
9952                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
9953                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
9954                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
9955                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
9956                 .free = LDKSignerProvider_JCalls_free,
9957         };
9958         return ret;
9959 }
9960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9961         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
9962         *res_ptr = LDKSignerProvider_init(env, clz, o);
9963         return tag_ptr(res_ptr, true);
9964 }
9965 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) {
9966         void* this_arg_ptr = untag_ptr(this_arg);
9967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9968         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9969         LDKU128 user_channel_id_ref;
9970         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
9971         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
9972         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9973         (*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);
9974         return ret_arr;
9975 }
9976
9977 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) {
9978         void* this_arg_ptr = untag_ptr(this_arg);
9979         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9980         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9981         LDKThirtyTwoBytes channel_keys_id_ref;
9982         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
9983         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
9984         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
9985         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
9986         return tag_ptr(ret_ret, true);
9987 }
9988
9989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
9990         void* this_arg_ptr = untag_ptr(this_arg);
9991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9992         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9993         LDKu8slice reader_ref;
9994         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
9995         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
9996         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
9997         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
9998         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
9999         return tag_ptr(ret_conv, true);
10000 }
10001
10002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_keys_id) {
10003         void* this_arg_ptr = untag_ptr(this_arg);
10004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10005         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10006         LDKThirtyTwoBytes channel_keys_id_ref;
10007         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
10008         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
10009         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
10010         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
10011         return tag_ptr(ret_conv, true);
10012 }
10013
10014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
10015         void* this_arg_ptr = untag_ptr(this_arg);
10016         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10017         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10018         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
10019         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
10020         return tag_ptr(ret_conv, true);
10021 }
10022
10023 typedef struct LDKFeeEstimator_JCalls {
10024         atomic_size_t refcnt;
10025         JavaVM *vm;
10026         jweak o;
10027         jmethodID get_est_sat_per_1000_weight_meth;
10028 } LDKFeeEstimator_JCalls;
10029 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
10030         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
10031         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10032                 JNIEnv *env;
10033                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10034                 if (get_jenv_res == JNI_EDETACHED) {
10035                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10036                 } else {
10037                         DO_ASSERT(get_jenv_res == JNI_OK);
10038                 }
10039                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10040                 if (get_jenv_res == JNI_EDETACHED) {
10041                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10042                 }
10043                 FREE(j_calls);
10044         }
10045 }
10046 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
10047         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
10048         JNIEnv *env;
10049         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10050         if (get_jenv_res == JNI_EDETACHED) {
10051                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10052         } else {
10053                 DO_ASSERT(get_jenv_res == JNI_OK);
10054         }
10055         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
10056         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10057         CHECK(obj != NULL);
10058         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
10059         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10060                 (*env)->ExceptionDescribe(env);
10061                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
10062         }
10063         if (get_jenv_res == JNI_EDETACHED) {
10064                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10065         }
10066         return ret;
10067 }
10068 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
10069         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
10070         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10071 }
10072 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
10073         jclass c = (*env)->GetObjectClass(env, o);
10074         CHECK(c != NULL);
10075         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
10076         atomic_init(&calls->refcnt, 1);
10077         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10078         calls->o = (*env)->NewWeakGlobalRef(env, o);
10079         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
10080         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
10081
10082         LDKFeeEstimator ret = {
10083                 .this_arg = (void*) calls,
10084                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
10085                 .free = LDKFeeEstimator_JCalls_free,
10086         };
10087         return ret;
10088 }
10089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
10090         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
10091         *res_ptr = LDKFeeEstimator_init(env, clz, o);
10092         return tag_ptr(res_ptr, true);
10093 }
10094 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) {
10095         void* this_arg_ptr = untag_ptr(this_arg);
10096         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10097         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
10098         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
10099         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
10100         return ret_conv;
10101 }
10102
10103 typedef struct LDKMessageRouter_JCalls {
10104         atomic_size_t refcnt;
10105         JavaVM *vm;
10106         jweak o;
10107         jmethodID find_path_meth;
10108         jmethodID create_blinded_paths_meth;
10109 } LDKMessageRouter_JCalls;
10110 static void LDKMessageRouter_JCalls_free(void* this_arg) {
10111         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10112         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10113                 JNIEnv *env;
10114                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10115                 if (get_jenv_res == JNI_EDETACHED) {
10116                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10117                 } else {
10118                         DO_ASSERT(get_jenv_res == JNI_OK);
10119                 }
10120                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10121                 if (get_jenv_res == JNI_EDETACHED) {
10122                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10123                 }
10124                 FREE(j_calls);
10125         }
10126 }
10127 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
10128         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10129         JNIEnv *env;
10130         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10131         if (get_jenv_res == JNI_EDETACHED) {
10132                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10133         } else {
10134                 DO_ASSERT(get_jenv_res == JNI_OK);
10135         }
10136         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
10137         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
10138         LDKCVec_PublicKeyZ peers_var = peers;
10139         jobjectArray peers_arr = NULL;
10140         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
10141         ;
10142         for (size_t i = 0; i < peers_var.datalen; i++) {
10143                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
10144                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
10145                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
10146         }
10147         
10148         FREE(peers_var.data);
10149         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10150         *destination_copy = destination;
10151         int64_t destination_ref = tag_ptr(destination_copy, true);
10152         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10153         CHECK(obj != NULL);
10154         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
10155         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10156                 (*env)->ExceptionDescribe(env);
10157                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
10158         }
10159         void* ret_ptr = untag_ptr(ret);
10160         CHECK_ACCESS(ret_ptr);
10161         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
10162         FREE(untag_ptr(ret));
10163         if (get_jenv_res == JNI_EDETACHED) {
10164                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10165         }
10166         return ret_conv;
10167 }
10168 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
10169         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10170         JNIEnv *env;
10171         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10172         if (get_jenv_res == JNI_EDETACHED) {
10173                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10174         } else {
10175                 DO_ASSERT(get_jenv_res == JNI_OK);
10176         }
10177         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
10178         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
10179         LDKCVec_PublicKeyZ peers_var = peers;
10180         jobjectArray peers_arr = NULL;
10181         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
10182         ;
10183         for (size_t i = 0; i < peers_var.datalen; i++) {
10184                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
10185                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
10186                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
10187         }
10188         
10189         FREE(peers_var.data);
10190         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10191         CHECK(obj != NULL);
10192         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_paths_meth, recipient_arr, peers_arr);
10193         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10194                 (*env)->ExceptionDescribe(env);
10195                 (*env)->FatalError(env, "A call to create_blinded_paths in LDKMessageRouter from rust threw an exception.");
10196         }
10197         void* ret_ptr = untag_ptr(ret);
10198         CHECK_ACCESS(ret_ptr);
10199         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
10200         FREE(untag_ptr(ret));
10201         if (get_jenv_res == JNI_EDETACHED) {
10202                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10203         }
10204         return ret_conv;
10205 }
10206 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
10207         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
10208         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10209 }
10210 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
10211         jclass c = (*env)->GetObjectClass(env, o);
10212         CHECK(c != NULL);
10213         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
10214         atomic_init(&calls->refcnt, 1);
10215         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10216         calls->o = (*env)->NewWeakGlobalRef(env, o);
10217         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
10218         CHECK(calls->find_path_meth != NULL);
10219         calls->create_blinded_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_paths", "([B[[B)J");
10220         CHECK(calls->create_blinded_paths_meth != NULL);
10221
10222         LDKMessageRouter ret = {
10223                 .this_arg = (void*) calls,
10224                 .find_path = find_path_LDKMessageRouter_jcall,
10225                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
10226                 .free = LDKMessageRouter_JCalls_free,
10227         };
10228         return ret;
10229 }
10230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
10231         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
10232         *res_ptr = LDKMessageRouter_init(env, clz, o);
10233         return tag_ptr(res_ptr, true);
10234 }
10235 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) {
10236         void* this_arg_ptr = untag_ptr(this_arg);
10237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10238         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
10239         LDKPublicKey sender_ref;
10240         CHECK((*env)->GetArrayLength(env, sender) == 33);
10241         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
10242         LDKCVec_PublicKeyZ peers_constr;
10243         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
10244         if (peers_constr.datalen > 0)
10245                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10246         else
10247                 peers_constr.data = NULL;
10248         for (size_t i = 0; i < peers_constr.datalen; i++) {
10249                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
10250                 LDKPublicKey peers_conv_8_ref;
10251                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
10252                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
10253                 peers_constr.data[i] = peers_conv_8_ref;
10254         }
10255         void* destination_ptr = untag_ptr(destination);
10256         CHECK_ACCESS(destination_ptr);
10257         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
10258         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
10259         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
10260         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
10261         return tag_ptr(ret_conv, true);
10262 }
10263
10264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1create_1blinded_1paths(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray recipient, jobjectArray peers) {
10265         void* this_arg_ptr = untag_ptr(this_arg);
10266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10267         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
10268         LDKPublicKey recipient_ref;
10269         CHECK((*env)->GetArrayLength(env, recipient) == 33);
10270         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
10271         LDKCVec_PublicKeyZ peers_constr;
10272         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
10273         if (peers_constr.datalen > 0)
10274                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10275         else
10276                 peers_constr.data = NULL;
10277         for (size_t i = 0; i < peers_constr.datalen; i++) {
10278                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
10279                 LDKPublicKey peers_conv_8_ref;
10280                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
10281                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
10282                 peers_constr.data[i] = peers_conv_8_ref;
10283         }
10284         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
10285         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
10286         return tag_ptr(ret_conv, true);
10287 }
10288
10289 typedef struct LDKRouter_JCalls {
10290         atomic_size_t refcnt;
10291         JavaVM *vm;
10292         jweak o;
10293         LDKMessageRouter_JCalls* MessageRouter;
10294         jmethodID find_route_meth;
10295         jmethodID find_route_with_id_meth;
10296         jmethodID create_blinded_payment_paths_meth;
10297 } LDKRouter_JCalls;
10298 static void LDKRouter_JCalls_free(void* this_arg) {
10299         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10300         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10301                 JNIEnv *env;
10302                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10303                 if (get_jenv_res == JNI_EDETACHED) {
10304                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10305                 } else {
10306                         DO_ASSERT(get_jenv_res == JNI_OK);
10307                 }
10308                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10309                 if (get_jenv_res == JNI_EDETACHED) {
10310                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10311                 }
10312                 FREE(j_calls);
10313         }
10314 }
10315 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10316         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10317         JNIEnv *env;
10318         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10319         if (get_jenv_res == JNI_EDETACHED) {
10320                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10321         } else {
10322                 DO_ASSERT(get_jenv_res == JNI_OK);
10323         }
10324         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
10325         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
10326         LDKRouteParameters route_params_var = *route_params;
10327         int64_t route_params_ref = 0;
10328         route_params_var = RouteParameters_clone(&route_params_var);
10329         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10330         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10331         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10332         int64_tArray first_hops_arr = NULL;
10333         if (first_hops != NULL) {
10334                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10335                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10336                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10337                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10338                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10339                         int64_t first_hops_conv_16_ref = 0;
10340                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10341                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10342                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10343                 }
10344                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10345         }
10346         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10347         int64_t inflight_htlcs_ref = 0;
10348         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10349         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10350         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10351         CHECK(obj != NULL);
10352         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
10353         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10354                 (*env)->ExceptionDescribe(env);
10355                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
10356         }
10357         void* ret_ptr = untag_ptr(ret);
10358         CHECK_ACCESS(ret_ptr);
10359         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10360         FREE(untag_ptr(ret));
10361         if (get_jenv_res == JNI_EDETACHED) {
10362                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10363         }
10364         return ret_conv;
10365 }
10366 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) {
10367         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10368         JNIEnv *env;
10369         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10370         if (get_jenv_res == JNI_EDETACHED) {
10371                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10372         } else {
10373                 DO_ASSERT(get_jenv_res == JNI_OK);
10374         }
10375         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
10376         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
10377         LDKRouteParameters route_params_var = *route_params;
10378         int64_t route_params_ref = 0;
10379         route_params_var = RouteParameters_clone(&route_params_var);
10380         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10381         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10382         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10383         int64_tArray first_hops_arr = NULL;
10384         if (first_hops != NULL) {
10385                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10386                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10387                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10388                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10389                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10390                         int64_t first_hops_conv_16_ref = 0;
10391                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10392                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10393                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10394                 }
10395                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10396         }
10397         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10398         int64_t inflight_htlcs_ref = 0;
10399         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10400         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10401         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
10402         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
10403         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
10404         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
10405         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10406         CHECK(obj != NULL);
10407         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);
10408         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10409                 (*env)->ExceptionDescribe(env);
10410                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
10411         }
10412         void* ret_ptr = untag_ptr(ret);
10413         CHECK_ACCESS(ret_ptr);
10414         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10415         FREE(untag_ptr(ret));
10416         if (get_jenv_res == JNI_EDETACHED) {
10417                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10418         }
10419         return ret_conv;
10420 }
10421 LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ create_blinded_payment_paths_LDKRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_ChannelDetailsZ first_hops, LDKReceiveTlvs tlvs, uint64_t amount_msats) {
10422         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10423         JNIEnv *env;
10424         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10425         if (get_jenv_res == JNI_EDETACHED) {
10426                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10427         } else {
10428                 DO_ASSERT(get_jenv_res == JNI_OK);
10429         }
10430         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
10431         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
10432         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
10433         int64_tArray first_hops_arr = NULL;
10434         first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10435         int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10436         for (size_t q = 0; q < first_hops_var.datalen; q++) {
10437                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10438                 int64_t first_hops_conv_16_ref = 0;
10439                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10440                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10441                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10442         }
10443         (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10444         FREE(first_hops_var.data);
10445         LDKReceiveTlvs tlvs_var = tlvs;
10446         int64_t tlvs_ref = 0;
10447         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
10448         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
10449         int64_t amount_msats_conv = amount_msats;
10450         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10451         CHECK(obj != NULL);
10452         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_payment_paths_meth, recipient_arr, first_hops_arr, tlvs_ref, amount_msats_conv);
10453         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10454                 (*env)->ExceptionDescribe(env);
10455                 (*env)->FatalError(env, "A call to create_blinded_payment_paths in LDKRouter from rust threw an exception.");
10456         }
10457         void* ret_ptr = untag_ptr(ret);
10458         CHECK_ACCESS(ret_ptr);
10459         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
10460         FREE(untag_ptr(ret));
10461         if (get_jenv_res == JNI_EDETACHED) {
10462                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10463         }
10464         return ret_conv;
10465 }
10466 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10467         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10468         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10469         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
10470 }
10471 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
10472         jclass c = (*env)->GetObjectClass(env, o);
10473         CHECK(c != NULL);
10474         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10475         atomic_init(&calls->refcnt, 1);
10476         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10477         calls->o = (*env)->NewWeakGlobalRef(env, o);
10478         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
10479         CHECK(calls->find_route_meth != NULL);
10480         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
10481         CHECK(calls->find_route_with_id_meth != NULL);
10482         calls->create_blinded_payment_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_payment_paths", "([B[JJJ)J");
10483         CHECK(calls->create_blinded_payment_paths_meth != NULL);
10484
10485         LDKRouter ret = {
10486                 .this_arg = (void*) calls,
10487                 .find_route = find_route_LDKRouter_jcall,
10488                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
10489                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
10490                 .free = LDKRouter_JCalls_free,
10491                 .MessageRouter = LDKMessageRouter_init(env, clz, MessageRouter),
10492         };
10493         calls->MessageRouter = ret.MessageRouter.this_arg;
10494         return ret;
10495 }
10496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
10497         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10498         *res_ptr = LDKRouter_init(env, clz, o, MessageRouter);
10499         return tag_ptr(res_ptr, true);
10500 }
10501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1get_1MessageRouter(JNIEnv *env, jclass clz, int64_t arg) {
10502         LDKRouter *inp = (LDKRouter *)untag_ptr(arg);
10503         return tag_ptr(&inp->MessageRouter, false);
10504 }
10505 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) {
10506         void* this_arg_ptr = untag_ptr(this_arg);
10507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10508         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10509         LDKPublicKey payer_ref;
10510         CHECK((*env)->GetArrayLength(env, payer) == 33);
10511         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
10512         LDKRouteParameters route_params_conv;
10513         route_params_conv.inner = untag_ptr(route_params);
10514         route_params_conv.is_owned = ptr_is_owned(route_params);
10515         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10516         route_params_conv.is_owned = false;
10517         LDKCVec_ChannelDetailsZ first_hops_constr;
10518         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10519         if (first_hops != NULL) {
10520                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10521                 if (first_hops_constr.datalen > 0)
10522                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10523                 else
10524                         first_hops_constr.data = NULL;
10525                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10526                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10527                         int64_t first_hops_conv_16 = first_hops_vals[q];
10528                         LDKChannelDetails first_hops_conv_16_conv;
10529                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10530                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10531                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10532                         first_hops_conv_16_conv.is_owned = false;
10533                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10534                 }
10535                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10536                 first_hops_ptr = &first_hops_constr;
10537         }
10538         LDKInFlightHtlcs inflight_htlcs_conv;
10539         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10540         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10541         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10542         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
10543         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10544         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
10545         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10546         return tag_ptr(ret_conv, true);
10547 }
10548
10549 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) {
10550         void* this_arg_ptr = untag_ptr(this_arg);
10551         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10552         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10553         LDKPublicKey payer_ref;
10554         CHECK((*env)->GetArrayLength(env, payer) == 33);
10555         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
10556         LDKRouteParameters route_params_conv;
10557         route_params_conv.inner = untag_ptr(route_params);
10558         route_params_conv.is_owned = ptr_is_owned(route_params);
10559         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10560         route_params_conv.is_owned = false;
10561         LDKCVec_ChannelDetailsZ first_hops_constr;
10562         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10563         if (first_hops != NULL) {
10564                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10565                 if (first_hops_constr.datalen > 0)
10566                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10567                 else
10568                         first_hops_constr.data = NULL;
10569                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10570                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10571                         int64_t first_hops_conv_16 = first_hops_vals[q];
10572                         LDKChannelDetails first_hops_conv_16_conv;
10573                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10574                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10575                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10576                         first_hops_conv_16_conv.is_owned = false;
10577                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10578                 }
10579                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10580                 first_hops_ptr = &first_hops_constr;
10581         }
10582         LDKInFlightHtlcs inflight_htlcs_conv;
10583         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10584         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10585         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10586         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
10587         LDKThirtyTwoBytes _payment_hash_ref;
10588         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
10589         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
10590         LDKThirtyTwoBytes _payment_id_ref;
10591         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
10592         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
10593         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10594         *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);
10595         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10596         return tag_ptr(ret_conv, true);
10597 }
10598
10599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1create_1blinded_1payment_1paths(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray recipient, int64_tArray first_hops, int64_t tlvs, int64_t amount_msats) {
10600         void* this_arg_ptr = untag_ptr(this_arg);
10601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10602         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10603         LDKPublicKey recipient_ref;
10604         CHECK((*env)->GetArrayLength(env, recipient) == 33);
10605         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
10606         LDKCVec_ChannelDetailsZ first_hops_constr;
10607         first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10608         if (first_hops_constr.datalen > 0)
10609                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10610         else
10611                 first_hops_constr.data = NULL;
10612         int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10613         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10614                 int64_t first_hops_conv_16 = first_hops_vals[q];
10615                 LDKChannelDetails first_hops_conv_16_conv;
10616                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10617                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10618                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10619                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
10620                 first_hops_constr.data[q] = first_hops_conv_16_conv;
10621         }
10622         (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10623         LDKReceiveTlvs tlvs_conv;
10624         tlvs_conv.inner = untag_ptr(tlvs);
10625         tlvs_conv.is_owned = ptr_is_owned(tlvs);
10626         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
10627         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
10628         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
10629         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
10630         return tag_ptr(ret_conv, true);
10631 }
10632
10633 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
10634         return ThirtyTwoBytes_clone(&owner->a);
10635 }
10636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10637         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
10638         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10639         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
10640         return ret_arr;
10641 }
10642
10643 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
10644         LDKChannelManager ret = owner->b;
10645         ret.is_owned = false;
10646         return ret;
10647 }
10648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10649         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
10650         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
10651         int64_t ret_ref = 0;
10652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10654         return ret_ref;
10655 }
10656
10657 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
10658 CHECK(owner->result_ok);
10659         return &*owner->contents.result;
10660 }
10661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10662         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
10663         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
10664         return ret_ret;
10665 }
10666
10667 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
10668 CHECK(!owner->result_ok);
10669         return DecodeError_clone(&*owner->contents.err);
10670 }
10671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10672         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
10673         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10674         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
10675         int64_t ret_ref = tag_ptr(ret_copy, true);
10676         return ret_ref;
10677 }
10678
10679 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
10680 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
10681 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
10682 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
10683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
10684         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
10685                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
10686         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
10687         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
10688         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
10689         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
10690                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
10691         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
10692         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
10693         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
10694 }
10695 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10696         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
10697         switch(obj->tag) {
10698                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
10699                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
10700                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
10701                 }
10702                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
10703                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
10704                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
10705                 }
10706                 default: abort();
10707         }
10708 }
10709 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
10710 CHECK(owner->result_ok);
10711         return MaxDustHTLCExposure_clone(&*owner->contents.result);
10712 }
10713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10714         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
10715         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
10716         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
10717         int64_t ret_ref = tag_ptr(ret_copy, true);
10718         return ret_ref;
10719 }
10720
10721 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
10722 CHECK(!owner->result_ok);
10723         return DecodeError_clone(&*owner->contents.err);
10724 }
10725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10726         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
10727         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10728         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
10729         int64_t ret_ref = tag_ptr(ret_copy, true);
10730         return ret_ref;
10731 }
10732
10733 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
10734         LDKChannelConfig ret = *owner->contents.result;
10735         ret.is_owned = false;
10736         return ret;
10737 }
10738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10739         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10740         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
10741         int64_t ret_ref = 0;
10742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10744         return ret_ref;
10745 }
10746
10747 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
10748 CHECK(!owner->result_ok);
10749         return DecodeError_clone(&*owner->contents.err);
10750 }
10751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10752         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10753         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10754         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
10755         int64_t ret_ref = tag_ptr(ret_copy, true);
10756         return ret_ref;
10757 }
10758
10759 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
10760 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
10761 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
10762 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
10763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
10764         LDKCOption_MaxDustHTLCExposureZ_Some_class =
10765                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
10766         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
10767         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
10768         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
10769         LDKCOption_MaxDustHTLCExposureZ_None_class =
10770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
10771         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
10772         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
10773         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
10774 }
10775 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10776         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
10777         switch(obj->tag) {
10778                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
10779                         int64_t some_ref = tag_ptr(&obj->some, false);
10780                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
10781                 }
10782                 case LDKCOption_MaxDustHTLCExposureZ_None: {
10783                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
10784                 }
10785                 default: abort();
10786         }
10787 }
10788 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
10789 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
10790 static jclass LDKCOption_APIErrorZ_None_class = NULL;
10791 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
10792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
10793         LDKCOption_APIErrorZ_Some_class =
10794                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
10795         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
10796         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
10797         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
10798         LDKCOption_APIErrorZ_None_class =
10799                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
10800         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
10801         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
10802         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
10803 }
10804 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10805         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
10806         switch(obj->tag) {
10807                 case LDKCOption_APIErrorZ_Some: {
10808                         int64_t some_ref = tag_ptr(&obj->some, false);
10809                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
10810                 }
10811                 case LDKCOption_APIErrorZ_None: {
10812                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
10813                 }
10814                 default: abort();
10815         }
10816 }
10817 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10818 CHECK(owner->result_ok);
10819         return COption_APIErrorZ_clone(&*owner->contents.result);
10820 }
10821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10822         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10823         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
10824         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
10825         int64_t ret_ref = tag_ptr(ret_copy, true);
10826         return ret_ref;
10827 }
10828
10829 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10830 CHECK(!owner->result_ok);
10831         return DecodeError_clone(&*owner->contents.err);
10832 }
10833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10834         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10836         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
10837         int64_t ret_ref = tag_ptr(ret_copy, true);
10838         return ret_ref;
10839 }
10840
10841 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10842         LDKChannelMonitorUpdate ret = *owner->contents.result;
10843         ret.is_owned = false;
10844         return ret;
10845 }
10846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10847         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10848         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
10849         int64_t ret_ref = 0;
10850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10852         return ret_ref;
10853 }
10854
10855 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10856 CHECK(!owner->result_ok);
10857         return DecodeError_clone(&*owner->contents.err);
10858 }
10859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10860         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10861         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10862         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
10863         int64_t ret_ref = tag_ptr(ret_copy, true);
10864         return ret_ref;
10865 }
10866
10867 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
10868 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
10869 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
10870 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
10871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
10872         LDKCOption_MonitorEventZ_Some_class =
10873                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
10874         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
10875         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
10876         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
10877         LDKCOption_MonitorEventZ_None_class =
10878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
10879         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
10880         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
10881         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
10882 }
10883 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10884         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
10885         switch(obj->tag) {
10886                 case LDKCOption_MonitorEventZ_Some: {
10887                         int64_t some_ref = tag_ptr(&obj->some, false);
10888                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
10889                 }
10890                 case LDKCOption_MonitorEventZ_None: {
10891                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
10892                 }
10893                 default: abort();
10894         }
10895 }
10896 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10897 CHECK(owner->result_ok);
10898         return COption_MonitorEventZ_clone(&*owner->contents.result);
10899 }
10900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10901         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10902         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10903         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
10904         int64_t ret_ref = tag_ptr(ret_copy, true);
10905         return ret_ref;
10906 }
10907
10908 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10909 CHECK(!owner->result_ok);
10910         return DecodeError_clone(&*owner->contents.err);
10911 }
10912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10913         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10914         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10915         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
10916         int64_t ret_ref = tag_ptr(ret_copy, true);
10917         return ret_ref;
10918 }
10919
10920 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10921         LDKHTLCUpdate ret = *owner->contents.result;
10922         ret.is_owned = false;
10923         return ret;
10924 }
10925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10926         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10927         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
10928         int64_t ret_ref = 0;
10929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10931         return ret_ref;
10932 }
10933
10934 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10935 CHECK(!owner->result_ok);
10936         return DecodeError_clone(&*owner->contents.err);
10937 }
10938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10939         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10940         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10941         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
10942         int64_t ret_ref = tag_ptr(ret_copy, true);
10943         return ret_ref;
10944 }
10945
10946 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10947         LDKOutPoint ret = owner->a;
10948         ret.is_owned = false;
10949         return ret;
10950 }
10951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10952         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10953         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
10954         int64_t ret_ref = 0;
10955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10957         return ret_ref;
10958 }
10959
10960 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10961         return CVec_u8Z_clone(&owner->b);
10962 }
10963 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10964         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10965         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
10966         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10967         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10968         CVec_u8Z_free(ret_var);
10969         return ret_arr;
10970 }
10971
10972 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
10973         return owner->a;
10974 }
10975 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10976         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
10977         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
10978         return ret_conv;
10979 }
10980
10981 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
10982         return CVec_u8Z_clone(&owner->b);
10983 }
10984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10985         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
10986         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
10987         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10988         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10989         CVec_u8Z_free(ret_var);
10990         return ret_arr;
10991 }
10992
10993 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
10994         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
10995         for (size_t i = 0; i < ret.datalen; i++) {
10996                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
10997         }
10998         return ret;
10999 }
11000 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
11001         return ThirtyTwoBytes_clone(&owner->a);
11002 }
11003 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11004         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
11005         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11006         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
11007         return ret_arr;
11008 }
11009
11010 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
11011         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
11012 }
11013 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11014         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
11015         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
11016         int64_tArray ret_arr = NULL;
11017         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11018         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11019         for (size_t x = 0; x < ret_var.datalen; x++) {
11020                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
11021                 *ret_conv_23_conv = ret_var.data[x];
11022                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
11023         }
11024         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11025         FREE(ret_var.data);
11026         return ret_arr;
11027 }
11028
11029 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
11030         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 };
11031         for (size_t i = 0; i < ret.datalen; i++) {
11032                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
11033         }
11034         return ret;
11035 }
11036 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
11037         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
11038         for (size_t i = 0; i < ret.datalen; i++) {
11039                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
11040         }
11041         return ret;
11042 }
11043 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
11044         return owner->a;
11045 }
11046 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11047         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
11048         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
11049         return ret_conv;
11050 }
11051
11052 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
11053         return TxOut_clone(&owner->b);
11054 }
11055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11056         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
11057         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11058         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
11059         return tag_ptr(ret_ref, true);
11060 }
11061
11062 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
11063         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
11064         for (size_t i = 0; i < ret.datalen; i++) {
11065                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
11066         }
11067         return ret;
11068 }
11069 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
11070         return ThirtyTwoBytes_clone(&owner->a);
11071 }
11072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11073         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
11074         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11075         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
11076         return ret_arr;
11077 }
11078
11079 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
11080         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
11081 }
11082 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11083         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
11084         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
11085         int64_tArray ret_arr = NULL;
11086         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11087         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11088         for (size_t u = 0; u < ret_var.datalen; u++) {
11089                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11090                 *ret_conv_20_conv = ret_var.data[u];
11091                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
11092         }
11093         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11094         FREE(ret_var.data);
11095         return ret_arr;
11096 }
11097
11098 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
11099         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 };
11100         for (size_t i = 0; i < ret.datalen; i++) {
11101                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
11102         }
11103         return ret;
11104 }
11105 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
11106 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
11107 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
11108 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
11109 static jclass LDKBalance_ContentiousClaimable_class = NULL;
11110 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
11111 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
11112 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
11113 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
11114 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
11115 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
11116 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
11117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
11118         LDKBalance_ClaimableOnChannelClose_class =
11119                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
11120         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
11121         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
11122         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
11123         LDKBalance_ClaimableAwaitingConfirmations_class =
11124                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
11125         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
11126         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
11127         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
11128         LDKBalance_ContentiousClaimable_class =
11129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
11130         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
11131         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
11132         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
11133         LDKBalance_MaybeTimeoutClaimableHTLC_class =
11134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
11135         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
11136         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
11137         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
11138         LDKBalance_MaybePreimageClaimableHTLC_class =
11139                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
11140         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
11141         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
11142         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
11143         LDKBalance_CounterpartyRevokedOutputClaimable_class =
11144                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
11145         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
11146         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
11147         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
11148 }
11149 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11150         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
11151         switch(obj->tag) {
11152                 case LDKBalance_ClaimableOnChannelClose: {
11153                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
11154                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
11155                 }
11156                 case LDKBalance_ClaimableAwaitingConfirmations: {
11157                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
11158                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
11159                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
11160                 }
11161                 case LDKBalance_ContentiousClaimable: {
11162                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
11163                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
11164                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11165                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
11166                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
11167                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
11168                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
11169                 }
11170                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
11171                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
11172                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
11173                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11174                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
11175                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
11176                 }
11177                 case LDKBalance_MaybePreimageClaimableHTLC: {
11178                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
11179                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
11180                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11181                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
11182                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
11183                 }
11184                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
11185                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
11186                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
11187                 }
11188                 default: abort();
11189         }
11190 }
11191 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
11192         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
11193         for (size_t i = 0; i < ret.datalen; i++) {
11194                 ret.data[i] = Balance_clone(&orig->data[i]);
11195         }
11196         return ret;
11197 }
11198 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
11199         return ThirtyTwoBytes_clone(&owner->a);
11200 }
11201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11202         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
11203         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11204         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
11205         return ret_arr;
11206 }
11207
11208 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
11209         LDKChannelMonitor ret = owner->b;
11210         ret.is_owned = false;
11211         return ret;
11212 }
11213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11214         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
11215         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
11216         int64_t ret_ref = 0;
11217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11219         return ret_ref;
11220 }
11221
11222 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
11223 CHECK(owner->result_ok);
11224         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
11225 }
11226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11227         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
11228         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11229         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
11230         return tag_ptr(ret_conv, true);
11231 }
11232
11233 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
11234 CHECK(!owner->result_ok);
11235         return DecodeError_clone(&*owner->contents.err);
11236 }
11237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11238         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
11239         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11240         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
11241         int64_t ret_ref = tag_ptr(ret_copy, true);
11242         return ret_ref;
11243 }
11244
11245 typedef struct LDKType_JCalls {
11246         atomic_size_t refcnt;
11247         JavaVM *vm;
11248         jweak o;
11249         jmethodID type_id_meth;
11250         jmethodID debug_str_meth;
11251         jmethodID write_meth;
11252 } LDKType_JCalls;
11253 static void LDKType_JCalls_free(void* this_arg) {
11254         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11255         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11256                 JNIEnv *env;
11257                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11258                 if (get_jenv_res == JNI_EDETACHED) {
11259                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11260                 } else {
11261                         DO_ASSERT(get_jenv_res == JNI_OK);
11262                 }
11263                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11264                 if (get_jenv_res == JNI_EDETACHED) {
11265                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11266                 }
11267                 FREE(j_calls);
11268         }
11269 }
11270 uint16_t type_id_LDKType_jcall(const void* this_arg) {
11271         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11272         JNIEnv *env;
11273         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11274         if (get_jenv_res == JNI_EDETACHED) {
11275                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11276         } else {
11277                 DO_ASSERT(get_jenv_res == JNI_OK);
11278         }
11279         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11280         CHECK(obj != NULL);
11281         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
11282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11283                 (*env)->ExceptionDescribe(env);
11284                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
11285         }
11286         if (get_jenv_res == JNI_EDETACHED) {
11287                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11288         }
11289         return ret;
11290 }
11291 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
11292         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11293         JNIEnv *env;
11294         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11295         if (get_jenv_res == JNI_EDETACHED) {
11296                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11297         } else {
11298                 DO_ASSERT(get_jenv_res == JNI_OK);
11299         }
11300         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11301         CHECK(obj != NULL);
11302         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
11303         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11304                 (*env)->ExceptionDescribe(env);
11305                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
11306         }
11307         LDKStr ret_conv = java_to_owned_str(env, ret);
11308         if (get_jenv_res == JNI_EDETACHED) {
11309                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11310         }
11311         return ret_conv;
11312 }
11313 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
11314         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11315         JNIEnv *env;
11316         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11317         if (get_jenv_res == JNI_EDETACHED) {
11318                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11319         } else {
11320                 DO_ASSERT(get_jenv_res == JNI_OK);
11321         }
11322         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11323         CHECK(obj != NULL);
11324         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
11325         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11326                 (*env)->ExceptionDescribe(env);
11327                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
11328         }
11329         LDKCVec_u8Z ret_ref;
11330         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
11331         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11332         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
11333         if (get_jenv_res == JNI_EDETACHED) {
11334                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11335         }
11336         return ret_ref;
11337 }
11338 static void LDKType_JCalls_cloned(LDKType* new_obj) {
11339         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
11340         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11341 }
11342 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
11343         jclass c = (*env)->GetObjectClass(env, o);
11344         CHECK(c != NULL);
11345         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
11346         atomic_init(&calls->refcnt, 1);
11347         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11348         calls->o = (*env)->NewWeakGlobalRef(env, o);
11349         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
11350         CHECK(calls->type_id_meth != NULL);
11351         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
11352         CHECK(calls->debug_str_meth != NULL);
11353         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
11354         CHECK(calls->write_meth != NULL);
11355
11356         LDKType ret = {
11357                 .this_arg = (void*) calls,
11358                 .type_id = type_id_LDKType_jcall,
11359                 .debug_str = debug_str_LDKType_jcall,
11360                 .write = write_LDKType_jcall,
11361                 .cloned = LDKType_JCalls_cloned,
11362                 .free = LDKType_JCalls_free,
11363         };
11364         return ret;
11365 }
11366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
11367         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
11368         *res_ptr = LDKType_init(env, clz, o);
11369         return tag_ptr(res_ptr, true);
11370 }
11371 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11372         void* this_arg_ptr = untag_ptr(this_arg);
11373         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11374         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11375         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
11376         return ret_conv;
11377 }
11378
11379 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
11380         void* this_arg_ptr = untag_ptr(this_arg);
11381         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11382         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11383         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
11384         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11385         Str_free(ret_str);
11386         return ret_conv;
11387 }
11388
11389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11390         void* this_arg_ptr = untag_ptr(this_arg);
11391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11392         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11393         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11394         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11395         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11396         CVec_u8Z_free(ret_var);
11397         return ret_arr;
11398 }
11399
11400 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
11401         return owner->a;
11402 }
11403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11404         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
11405         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11406         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
11407         return ret_arr;
11408 }
11409
11410 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
11411         return Type_clone(&owner->b);
11412 }
11413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11414         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
11415         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
11416         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
11417         return tag_ptr(ret_ret, true);
11418 }
11419
11420 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
11421         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
11422         for (size_t i = 0; i < ret.datalen; i++) {
11423                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
11424         }
11425         return ret;
11426 }
11427 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
11428         return owner->a;
11429 }
11430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11431         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
11432         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form);
11434         return ret_arr;
11435 }
11436
11437 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
11438         return CVec_SocketAddressZ_clone(&owner->b);
11439 }
11440 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11441         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
11442         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
11443         int64_tArray ret_arr = NULL;
11444         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11445         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11446         for (size_t p = 0; p < ret_var.datalen; p++) {
11447                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11448                 *ret_conv_15_copy = ret_var.data[p];
11449                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
11450                 ret_arr_ptr[p] = ret_conv_15_ref;
11451         }
11452         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11453         FREE(ret_var.data);
11454         return ret_arr;
11455 }
11456
11457 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
11458         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
11459         for (size_t i = 0; i < ret.datalen; i++) {
11460                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
11461         }
11462         return ret;
11463 }
11464 typedef struct LDKOnionMessageContents_JCalls {
11465         atomic_size_t refcnt;
11466         JavaVM *vm;
11467         jweak o;
11468         jmethodID tlv_type_meth;
11469         jmethodID write_meth;
11470         jmethodID debug_str_meth;
11471 } LDKOnionMessageContents_JCalls;
11472 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
11473         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11474         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11475                 JNIEnv *env;
11476                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11477                 if (get_jenv_res == JNI_EDETACHED) {
11478                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11479                 } else {
11480                         DO_ASSERT(get_jenv_res == JNI_OK);
11481                 }
11482                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11483                 if (get_jenv_res == JNI_EDETACHED) {
11484                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11485                 }
11486                 FREE(j_calls);
11487         }
11488 }
11489 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
11490         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11491         JNIEnv *env;
11492         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11493         if (get_jenv_res == JNI_EDETACHED) {
11494                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11495         } else {
11496                 DO_ASSERT(get_jenv_res == JNI_OK);
11497         }
11498         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11499         CHECK(obj != NULL);
11500         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
11501         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11502                 (*env)->ExceptionDescribe(env);
11503                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
11504         }
11505         if (get_jenv_res == JNI_EDETACHED) {
11506                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11507         }
11508         return ret;
11509 }
11510 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
11511         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11512         JNIEnv *env;
11513         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11514         if (get_jenv_res == JNI_EDETACHED) {
11515                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11516         } else {
11517                 DO_ASSERT(get_jenv_res == JNI_OK);
11518         }
11519         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11520         CHECK(obj != NULL);
11521         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
11522         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11523                 (*env)->ExceptionDescribe(env);
11524                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
11525         }
11526         LDKCVec_u8Z ret_ref;
11527         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
11528         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11529         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
11530         if (get_jenv_res == JNI_EDETACHED) {
11531                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11532         }
11533         return ret_ref;
11534 }
11535 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
11536         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11537         JNIEnv *env;
11538         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11539         if (get_jenv_res == JNI_EDETACHED) {
11540                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11541         } else {
11542                 DO_ASSERT(get_jenv_res == JNI_OK);
11543         }
11544         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11545         CHECK(obj != NULL);
11546         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
11547         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11548                 (*env)->ExceptionDescribe(env);
11549                 (*env)->FatalError(env, "A call to debug_str in LDKOnionMessageContents from rust threw an exception.");
11550         }
11551         LDKStr ret_conv = java_to_owned_str(env, ret);
11552         if (get_jenv_res == JNI_EDETACHED) {
11553                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11554         }
11555         return ret_conv;
11556 }
11557 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
11558         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
11559         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11560 }
11561 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
11562         jclass c = (*env)->GetObjectClass(env, o);
11563         CHECK(c != NULL);
11564         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
11565         atomic_init(&calls->refcnt, 1);
11566         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11567         calls->o = (*env)->NewWeakGlobalRef(env, o);
11568         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
11569         CHECK(calls->tlv_type_meth != NULL);
11570         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
11571         CHECK(calls->write_meth != NULL);
11572         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
11573         CHECK(calls->debug_str_meth != NULL);
11574
11575         LDKOnionMessageContents ret = {
11576                 .this_arg = (void*) calls,
11577                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
11578                 .write = write_LDKOnionMessageContents_jcall,
11579                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
11580                 .cloned = LDKOnionMessageContents_JCalls_cloned,
11581                 .free = LDKOnionMessageContents_JCalls_free,
11582         };
11583         return ret;
11584 }
11585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
11586         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11587         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
11588         return tag_ptr(res_ptr, true);
11589 }
11590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
11591         void* this_arg_ptr = untag_ptr(this_arg);
11592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11593         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11594         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
11595         return ret_conv;
11596 }
11597
11598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11599         void* this_arg_ptr = untag_ptr(this_arg);
11600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11601         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11602         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11603         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11604         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11605         CVec_u8Z_free(ret_var);
11606         return ret_arr;
11607 }
11608
11609 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
11610         void* this_arg_ptr = untag_ptr(this_arg);
11611         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11612         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11613         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
11614         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11615         Str_free(ret_str);
11616         return ret_conv;
11617 }
11618
11619 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
11620 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
11621 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
11622 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
11623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
11624         LDKCOption_OnionMessageContentsZ_Some_class =
11625                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
11626         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
11627         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
11628         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
11629         LDKCOption_OnionMessageContentsZ_None_class =
11630                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
11631         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
11632         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
11633         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
11634 }
11635 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11636         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
11637         switch(obj->tag) {
11638                 case LDKCOption_OnionMessageContentsZ_Some: {
11639                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11640                         *some_ret = OnionMessageContents_clone(&obj->some);
11641                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
11642                 }
11643                 case LDKCOption_OnionMessageContentsZ_None: {
11644                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
11645                 }
11646                 default: abort();
11647         }
11648 }
11649 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
11650 CHECK(owner->result_ok);
11651         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
11652 }
11653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11654         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
11655         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
11656         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
11657         int64_t ret_ref = tag_ptr(ret_copy, true);
11658         return ret_ref;
11659 }
11660
11661 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
11662 CHECK(!owner->result_ok);
11663         return DecodeError_clone(&*owner->contents.err);
11664 }
11665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11666         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
11667         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11668         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
11669         int64_t ret_ref = tag_ptr(ret_copy, true);
11670         return ret_ref;
11671 }
11672
11673 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11674         return OnionMessageContents_clone(&owner->a);
11675 }
11676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11677         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11678         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11679         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
11680         return tag_ptr(ret_ret, true);
11681 }
11682
11683 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11684         return Destination_clone(&owner->b);
11685 }
11686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11687         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11688         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
11689         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
11690         int64_t ret_ref = tag_ptr(ret_copy, true);
11691         return ret_ref;
11692 }
11693
11694 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11695         LDKBlindedPath ret = owner->c;
11696         ret.is_owned = false;
11697         return ret;
11698 }
11699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
11700         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11701         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
11702         int64_t ret_ref = 0;
11703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11705         return ret_ref;
11706 }
11707
11708 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
11709         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
11710         for (size_t i = 0; i < ret.datalen; i++) {
11711                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
11712         }
11713         return ret;
11714 }
11715 static jclass LDKCOption_TypeZ_Some_class = NULL;
11716 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
11717 static jclass LDKCOption_TypeZ_None_class = NULL;
11718 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
11719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
11720         LDKCOption_TypeZ_Some_class =
11721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
11722         CHECK(LDKCOption_TypeZ_Some_class != NULL);
11723         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
11724         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
11725         LDKCOption_TypeZ_None_class =
11726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
11727         CHECK(LDKCOption_TypeZ_None_class != NULL);
11728         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
11729         CHECK(LDKCOption_TypeZ_None_meth != NULL);
11730 }
11731 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11732         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
11733         switch(obj->tag) {
11734                 case LDKCOption_TypeZ_Some: {
11735                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
11736                         *some_ret = Type_clone(&obj->some);
11737                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
11738                 }
11739                 case LDKCOption_TypeZ_None: {
11740                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
11741                 }
11742                 default: abort();
11743         }
11744 }
11745 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11746 CHECK(owner->result_ok);
11747         return COption_TypeZ_clone(&*owner->contents.result);
11748 }
11749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11750         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11751         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11752         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
11753         int64_t ret_ref = tag_ptr(ret_copy, true);
11754         return ret_ref;
11755 }
11756
11757 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11758 CHECK(!owner->result_ok);
11759         return DecodeError_clone(&*owner->contents.err);
11760 }
11761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11762         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11764         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
11765         int64_t ret_ref = tag_ptr(ret_copy, true);
11766         return ret_ref;
11767 }
11768
11769 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
11770 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
11771 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
11772 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
11773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
11774         LDKCOption_SocketAddressZ_Some_class =
11775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
11776         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
11777         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
11778         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
11779         LDKCOption_SocketAddressZ_None_class =
11780                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
11781         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
11782         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
11783         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
11784 }
11785 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11786         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
11787         switch(obj->tag) {
11788                 case LDKCOption_SocketAddressZ_Some: {
11789                         int64_t some_ref = tag_ptr(&obj->some, false);
11790                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
11791                 }
11792                 case LDKCOption_SocketAddressZ_None: {
11793                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
11794                 }
11795                 default: abort();
11796         }
11797 }
11798 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11799 CHECK(owner->result_ok);
11800         return CVec_u8Z_clone(&*owner->contents.result);
11801 }
11802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11803         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11804         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
11805         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11806         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11807         CVec_u8Z_free(ret_var);
11808         return ret_arr;
11809 }
11810
11811 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11812         LDKPeerHandleError ret = *owner->contents.err;
11813         ret.is_owned = false;
11814         return ret;
11815 }
11816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11817         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11818         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
11819         int64_t ret_ref = 0;
11820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11822         return ret_ref;
11823 }
11824
11825 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11826 CHECK(owner->result_ok);
11827         return *owner->contents.result;
11828 }
11829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11830         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11831         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
11832 }
11833
11834 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11835         LDKPeerHandleError ret = *owner->contents.err;
11836         ret.is_owned = false;
11837         return ret;
11838 }
11839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11840         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11841         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
11842         int64_t ret_ref = 0;
11843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11845         return ret_ref;
11846 }
11847
11848 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11849 CHECK(owner->result_ok);
11850         return *owner->contents.result;
11851 }
11852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11853         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11854         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
11855         return ret_conv;
11856 }
11857
11858 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11859         LDKPeerHandleError ret = *owner->contents.err;
11860         ret.is_owned = false;
11861         return ret;
11862 }
11863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11864         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11865         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
11866         int64_t ret_ref = 0;
11867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11869         return ret_ref;
11870 }
11871
11872 static jclass LDKGraphSyncError_DecodeError_class = NULL;
11873 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
11874 static jclass LDKGraphSyncError_LightningError_class = NULL;
11875 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
11876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
11877         LDKGraphSyncError_DecodeError_class =
11878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
11879         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
11880         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
11881         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
11882         LDKGraphSyncError_LightningError_class =
11883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
11884         CHECK(LDKGraphSyncError_LightningError_class != NULL);
11885         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
11886         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
11887 }
11888 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11889         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
11890         switch(obj->tag) {
11891                 case LDKGraphSyncError_DecodeError: {
11892                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
11893                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
11894                 }
11895                 case LDKGraphSyncError_LightningError: {
11896                         LDKLightningError lightning_error_var = obj->lightning_error;
11897                         int64_t lightning_error_ref = 0;
11898                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
11899                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
11900                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
11901                 }
11902                 default: abort();
11903         }
11904 }
11905 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11906 CHECK(owner->result_ok);
11907         return *owner->contents.result;
11908 }
11909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11910         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11911         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
11912         return ret_conv;
11913 }
11914
11915 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11916 CHECK(!owner->result_ok);
11917         return GraphSyncError_clone(&*owner->contents.err);
11918 }
11919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11920         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11921         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
11922         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
11923         int64_t ret_ref = tag_ptr(ret_copy, true);
11924         return ret_ref;
11925 }
11926
11927 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11928 CHECK(owner->result_ok);
11929         return CVec_u8Z_clone(&*owner->contents.result);
11930 }
11931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11932         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11933         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
11934         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11935         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11936         CVec_u8Z_free(ret_var);
11937         return ret_arr;
11938 }
11939
11940 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11941 CHECK(!owner->result_ok);
11942         return *owner->contents.err;
11943 }
11944 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11945         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11946         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
11947         return ret_conv;
11948 }
11949
11950 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11951 CHECK(owner->result_ok);
11952         return *owner->contents.result;
11953 }
11954 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11955         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11956         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
11957         jobjectArray ret_arr = NULL;
11958         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
11959         ;
11960         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11961         for (size_t i = 0; i < ret_var.datalen; i++) {
11962                 LDKStr ret_conv_8_str = ret_var.data[i];
11963                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
11964                 ret_arr_ptr[i] = ret_conv_8_conv;
11965         }
11966         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11967         return ret_arr;
11968 }
11969
11970 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11971 CHECK(!owner->result_ok);
11972         return *owner->contents.err;
11973 }
11974 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11975         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11976         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
11977         return ret_conv;
11978 }
11979
11980 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
11981         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
11982         for (size_t i = 0; i < ret.datalen; i++) {
11983                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
11984         }
11985         return ret;
11986 }
11987 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
11988 CHECK(owner->result_ok);
11989         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
11990 }
11991 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11992         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
11993         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
11994         int64_tArray ret_arr = NULL;
11995         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11996         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11997         for (size_t o = 0; o < ret_var.datalen; o++) {
11998                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11999                 *ret_conv_40_conv = ret_var.data[o];
12000                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
12001         }
12002         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12003         FREE(ret_var.data);
12004         return ret_arr;
12005 }
12006
12007 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
12008 CHECK(!owner->result_ok);
12009         return *owner->contents.err;
12010 }
12011 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12012         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
12013         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
12014         return ret_conv;
12015 }
12016
12017 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
12018 CHECK(owner->result_ok);
12019         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
12020 }
12021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12022         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
12023         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
12024         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
12025         return tag_ptr(ret_conv, true);
12026 }
12027
12028 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
12029 CHECK(!owner->result_ok);
12030         return *owner->contents.err;
12031 }
12032 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12033         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
12034         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
12035         return ret_conv;
12036 }
12037
12038 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12039         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
12040         ret.is_owned = false;
12041         return ret;
12042 }
12043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12044         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12045         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
12046         int64_t ret_ref = 0;
12047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12049         return ret_ref;
12050 }
12051
12052 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12053 CHECK(!owner->result_ok);
12054         return Bolt12SemanticError_clone(&*owner->contents.err);
12055 }
12056 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12057         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12058         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
12059         return ret_conv;
12060 }
12061
12062 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12063         LDKInvoiceRequest ret = *owner->contents.result;
12064         ret.is_owned = false;
12065         return ret;
12066 }
12067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12068         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12069         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
12070         int64_t ret_ref = 0;
12071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12073         return ret_ref;
12074 }
12075
12076 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12077 CHECK(!owner->result_ok);
12078         return Bolt12SemanticError_clone(&*owner->contents.err);
12079 }
12080 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12081         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12082         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
12083         return ret_conv;
12084 }
12085
12086 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
12087 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
12088 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
12089 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
12090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
12091         LDKCOption_SecretKeyZ_Some_class =
12092                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
12093         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
12094         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
12095         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
12096         LDKCOption_SecretKeyZ_None_class =
12097                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
12098         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
12099         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
12100         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
12101 }
12102 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12103         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
12104         switch(obj->tag) {
12105                 case LDKCOption_SecretKeyZ_Some: {
12106                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
12107                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
12108                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
12109                 }
12110                 case LDKCOption_SecretKeyZ_None: {
12111                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
12112                 }
12113                 default: abort();
12114         }
12115 }
12116 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12117         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
12118         ret.is_owned = false;
12119         return ret;
12120 }
12121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12122         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12123         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
12124         int64_t ret_ref = 0;
12125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12127         return ret_ref;
12128 }
12129
12130 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12131 CHECK(!owner->result_ok);
12132         return Bolt12SemanticError_clone(&*owner->contents.err);
12133 }
12134 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12135         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12136         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
12137         return ret_conv;
12138 }
12139
12140 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
12141         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
12142         ret.is_owned = false;
12143         return ret;
12144 }
12145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12146         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
12147         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
12148         int64_t ret_ref = 0;
12149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12151         return ret_ref;
12152 }
12153
12154 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
12155 CHECK(!owner->result_ok);
12156         return *owner->contents.err;
12157 }
12158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12159         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
12160         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
12161 }
12162
12163 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12164         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
12165         ret.is_owned = false;
12166         return ret;
12167 }
12168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12169         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12170         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
12171         int64_t ret_ref = 0;
12172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12174         return ret_ref;
12175 }
12176
12177 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12178 CHECK(!owner->result_ok);
12179         return Bolt12SemanticError_clone(&*owner->contents.err);
12180 }
12181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12182         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12183         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
12184         return ret_conv;
12185 }
12186
12187 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
12188         LDKInvoiceRequestFields ret = *owner->contents.result;
12189         ret.is_owned = false;
12190         return ret;
12191 }
12192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12193         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
12194         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
12195         int64_t ret_ref = 0;
12196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12198         return ret_ref;
12199 }
12200
12201 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
12202 CHECK(!owner->result_ok);
12203         return DecodeError_clone(&*owner->contents.err);
12204 }
12205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12206         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
12207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12208         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
12209         int64_t ret_ref = tag_ptr(ret_copy, true);
12210         return ret_ref;
12211 }
12212
12213 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
12214         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
12215         for (size_t i = 0; i < ret.datalen; i++) {
12216                 ret.data[i] = Witness_clone(&orig->data[i]);
12217         }
12218         return ret;
12219 }
12220 static jclass LDKCOption_ECDSASignatureZ_Some_class = NULL;
12221 static jmethodID LDKCOption_ECDSASignatureZ_Some_meth = NULL;
12222 static jclass LDKCOption_ECDSASignatureZ_None_class = NULL;
12223 static jmethodID LDKCOption_ECDSASignatureZ_None_meth = NULL;
12224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ECDSASignatureZ_init (JNIEnv *env, jclass clz) {
12225         LDKCOption_ECDSASignatureZ_Some_class =
12226                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ECDSASignatureZ$Some"));
12227         CHECK(LDKCOption_ECDSASignatureZ_Some_class != NULL);
12228         LDKCOption_ECDSASignatureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ECDSASignatureZ_Some_class, "<init>", "([B)V");
12229         CHECK(LDKCOption_ECDSASignatureZ_Some_meth != NULL);
12230         LDKCOption_ECDSASignatureZ_None_class =
12231                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ECDSASignatureZ$None"));
12232         CHECK(LDKCOption_ECDSASignatureZ_None_class != NULL);
12233         LDKCOption_ECDSASignatureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ECDSASignatureZ_None_class, "<init>", "()V");
12234         CHECK(LDKCOption_ECDSASignatureZ_None_meth != NULL);
12235 }
12236 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ECDSASignatureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12237         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
12238         switch(obj->tag) {
12239                 case LDKCOption_ECDSASignatureZ_Some: {
12240                         int8_tArray some_arr = (*env)->NewByteArray(env, 64);
12241                         (*env)->SetByteArrayRegion(env, some_arr, 0, 64, obj->some.compact_form);
12242                         return (*env)->NewObject(env, LDKCOption_ECDSASignatureZ_Some_class, LDKCOption_ECDSASignatureZ_Some_meth, some_arr);
12243                 }
12244                 case LDKCOption_ECDSASignatureZ_None: {
12245                         return (*env)->NewObject(env, LDKCOption_ECDSASignatureZ_None_class, LDKCOption_ECDSASignatureZ_None_meth);
12246                 }
12247                 default: abort();
12248         }
12249 }
12250 static jclass LDKCOption_i64Z_Some_class = NULL;
12251 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
12252 static jclass LDKCOption_i64Z_None_class = NULL;
12253 static jmethodID LDKCOption_i64Z_None_meth = NULL;
12254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
12255         LDKCOption_i64Z_Some_class =
12256                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
12257         CHECK(LDKCOption_i64Z_Some_class != NULL);
12258         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
12259         CHECK(LDKCOption_i64Z_Some_meth != NULL);
12260         LDKCOption_i64Z_None_class =
12261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
12262         CHECK(LDKCOption_i64Z_None_class != NULL);
12263         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
12264         CHECK(LDKCOption_i64Z_None_meth != NULL);
12265 }
12266 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12267         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
12268         switch(obj->tag) {
12269                 case LDKCOption_i64Z_Some: {
12270                         int64_t some_conv = obj->some;
12271                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
12272                 }
12273                 case LDKCOption_i64Z_None: {
12274                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
12275                 }
12276                 default: abort();
12277         }
12278 }
12279 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
12280 CHECK(owner->result_ok);
12281         return SocketAddress_clone(&*owner->contents.result);
12282 }
12283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12284         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
12285         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
12286         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
12287         int64_t ret_ref = tag_ptr(ret_copy, true);
12288         return ret_ref;
12289 }
12290
12291 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
12292 CHECK(!owner->result_ok);
12293         return DecodeError_clone(&*owner->contents.err);
12294 }
12295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12296         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
12297         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12298         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
12299         int64_t ret_ref = tag_ptr(ret_copy, true);
12300         return ret_ref;
12301 }
12302
12303 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
12304 CHECK(owner->result_ok);
12305         return SocketAddress_clone(&*owner->contents.result);
12306 }
12307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12308         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
12309         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
12310         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
12311         int64_t ret_ref = tag_ptr(ret_copy, true);
12312         return ret_ref;
12313 }
12314
12315 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
12316 CHECK(!owner->result_ok);
12317         return SocketAddressParseError_clone(&*owner->contents.err);
12318 }
12319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12320         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
12321         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
12322         return ret_conv;
12323 }
12324
12325 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
12326         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
12327         for (size_t i = 0; i < ret.datalen; i++) {
12328                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
12329         }
12330         return ret;
12331 }
12332 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
12333         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
12334         for (size_t i = 0; i < ret.datalen; i++) {
12335                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
12336         }
12337         return ret;
12338 }
12339 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
12340         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
12341         for (size_t i = 0; i < ret.datalen; i++) {
12342                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
12343         }
12344         return ret;
12345 }
12346 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
12347         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
12348         for (size_t i = 0; i < ret.datalen; i++) {
12349                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
12350         }
12351         return ret;
12352 }
12353 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
12354         LDKAcceptChannel ret = *owner->contents.result;
12355         ret.is_owned = false;
12356         return ret;
12357 }
12358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12359         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
12360         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
12361         int64_t ret_ref = 0;
12362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12364         return ret_ref;
12365 }
12366
12367 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
12368 CHECK(!owner->result_ok);
12369         return DecodeError_clone(&*owner->contents.err);
12370 }
12371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12372         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
12373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12374         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
12375         int64_t ret_ref = tag_ptr(ret_copy, true);
12376         return ret_ref;
12377 }
12378
12379 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
12380         LDKAcceptChannelV2 ret = *owner->contents.result;
12381         ret.is_owned = false;
12382         return ret;
12383 }
12384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12385         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
12386         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
12387         int64_t ret_ref = 0;
12388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12390         return ret_ref;
12391 }
12392
12393 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
12394 CHECK(!owner->result_ok);
12395         return DecodeError_clone(&*owner->contents.err);
12396 }
12397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12398         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
12399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12400         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
12401         int64_t ret_ref = tag_ptr(ret_copy, true);
12402         return ret_ref;
12403 }
12404
12405 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
12406         LDKStfu ret = *owner->contents.result;
12407         ret.is_owned = false;
12408         return ret;
12409 }
12410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12411         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
12412         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
12413         int64_t ret_ref = 0;
12414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12416         return ret_ref;
12417 }
12418
12419 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
12420 CHECK(!owner->result_ok);
12421         return DecodeError_clone(&*owner->contents.err);
12422 }
12423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12424         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
12425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12426         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
12427         int64_t ret_ref = tag_ptr(ret_copy, true);
12428         return ret_ref;
12429 }
12430
12431 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
12432         LDKSplice ret = *owner->contents.result;
12433         ret.is_owned = false;
12434         return ret;
12435 }
12436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12437         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
12438         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
12439         int64_t ret_ref = 0;
12440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12442         return ret_ref;
12443 }
12444
12445 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
12446 CHECK(!owner->result_ok);
12447         return DecodeError_clone(&*owner->contents.err);
12448 }
12449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12450         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
12451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12452         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
12453         int64_t ret_ref = tag_ptr(ret_copy, true);
12454         return ret_ref;
12455 }
12456
12457 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
12458         LDKSpliceAck ret = *owner->contents.result;
12459         ret.is_owned = false;
12460         return ret;
12461 }
12462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12463         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
12464         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
12465         int64_t ret_ref = 0;
12466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12468         return ret_ref;
12469 }
12470
12471 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
12472 CHECK(!owner->result_ok);
12473         return DecodeError_clone(&*owner->contents.err);
12474 }
12475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12476         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
12477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12478         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
12479         int64_t ret_ref = tag_ptr(ret_copy, true);
12480         return ret_ref;
12481 }
12482
12483 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
12484         LDKSpliceLocked ret = *owner->contents.result;
12485         ret.is_owned = false;
12486         return ret;
12487 }
12488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12489         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
12490         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
12491         int64_t ret_ref = 0;
12492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12494         return ret_ref;
12495 }
12496
12497 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
12498 CHECK(!owner->result_ok);
12499         return DecodeError_clone(&*owner->contents.err);
12500 }
12501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12502         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
12503         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12504         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
12505         int64_t ret_ref = tag_ptr(ret_copy, true);
12506         return ret_ref;
12507 }
12508
12509 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
12510         LDKTxAddInput ret = *owner->contents.result;
12511         ret.is_owned = false;
12512         return ret;
12513 }
12514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12515         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
12516         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
12517         int64_t ret_ref = 0;
12518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12520         return ret_ref;
12521 }
12522
12523 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
12524 CHECK(!owner->result_ok);
12525         return DecodeError_clone(&*owner->contents.err);
12526 }
12527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12528         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
12529         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12530         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
12531         int64_t ret_ref = tag_ptr(ret_copy, true);
12532         return ret_ref;
12533 }
12534
12535 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
12536         LDKTxAddOutput ret = *owner->contents.result;
12537         ret.is_owned = false;
12538         return ret;
12539 }
12540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12541         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
12542         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
12543         int64_t ret_ref = 0;
12544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12546         return ret_ref;
12547 }
12548
12549 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
12550 CHECK(!owner->result_ok);
12551         return DecodeError_clone(&*owner->contents.err);
12552 }
12553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12554         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
12555         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12556         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
12557         int64_t ret_ref = tag_ptr(ret_copy, true);
12558         return ret_ref;
12559 }
12560
12561 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
12562         LDKTxRemoveInput ret = *owner->contents.result;
12563         ret.is_owned = false;
12564         return ret;
12565 }
12566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12567         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
12568         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
12569         int64_t ret_ref = 0;
12570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12572         return ret_ref;
12573 }
12574
12575 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
12576 CHECK(!owner->result_ok);
12577         return DecodeError_clone(&*owner->contents.err);
12578 }
12579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12580         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
12581         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12582         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
12583         int64_t ret_ref = tag_ptr(ret_copy, true);
12584         return ret_ref;
12585 }
12586
12587 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
12588         LDKTxRemoveOutput ret = *owner->contents.result;
12589         ret.is_owned = false;
12590         return ret;
12591 }
12592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12593         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
12594         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
12595         int64_t ret_ref = 0;
12596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12598         return ret_ref;
12599 }
12600
12601 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
12602 CHECK(!owner->result_ok);
12603         return DecodeError_clone(&*owner->contents.err);
12604 }
12605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12606         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
12607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12608         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
12609         int64_t ret_ref = tag_ptr(ret_copy, true);
12610         return ret_ref;
12611 }
12612
12613 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
12614         LDKTxComplete ret = *owner->contents.result;
12615         ret.is_owned = false;
12616         return ret;
12617 }
12618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12619         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
12620         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
12621         int64_t ret_ref = 0;
12622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12624         return ret_ref;
12625 }
12626
12627 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
12628 CHECK(!owner->result_ok);
12629         return DecodeError_clone(&*owner->contents.err);
12630 }
12631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12632         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
12633         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12634         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
12635         int64_t ret_ref = tag_ptr(ret_copy, true);
12636         return ret_ref;
12637 }
12638
12639 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
12640         LDKTxSignatures ret = *owner->contents.result;
12641         ret.is_owned = false;
12642         return ret;
12643 }
12644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12645         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
12646         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
12647         int64_t ret_ref = 0;
12648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12650         return ret_ref;
12651 }
12652
12653 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
12654 CHECK(!owner->result_ok);
12655         return DecodeError_clone(&*owner->contents.err);
12656 }
12657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12658         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
12659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12660         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
12661         int64_t ret_ref = tag_ptr(ret_copy, true);
12662         return ret_ref;
12663 }
12664
12665 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
12666         LDKTxInitRbf ret = *owner->contents.result;
12667         ret.is_owned = false;
12668         return ret;
12669 }
12670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12671         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
12672         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
12673         int64_t ret_ref = 0;
12674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12676         return ret_ref;
12677 }
12678
12679 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
12680 CHECK(!owner->result_ok);
12681         return DecodeError_clone(&*owner->contents.err);
12682 }
12683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12684         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
12685         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12686         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
12687         int64_t ret_ref = tag_ptr(ret_copy, true);
12688         return ret_ref;
12689 }
12690
12691 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
12692         LDKTxAckRbf ret = *owner->contents.result;
12693         ret.is_owned = false;
12694         return ret;
12695 }
12696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12697         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
12698         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
12699         int64_t ret_ref = 0;
12700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12702         return ret_ref;
12703 }
12704
12705 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
12706 CHECK(!owner->result_ok);
12707         return DecodeError_clone(&*owner->contents.err);
12708 }
12709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12710         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
12711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12712         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
12713         int64_t ret_ref = tag_ptr(ret_copy, true);
12714         return ret_ref;
12715 }
12716
12717 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
12718         LDKTxAbort ret = *owner->contents.result;
12719         ret.is_owned = false;
12720         return ret;
12721 }
12722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12723         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
12724         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
12725         int64_t ret_ref = 0;
12726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12728         return ret_ref;
12729 }
12730
12731 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
12732 CHECK(!owner->result_ok);
12733         return DecodeError_clone(&*owner->contents.err);
12734 }
12735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12736         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
12737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12738         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
12739         int64_t ret_ref = tag_ptr(ret_copy, true);
12740         return ret_ref;
12741 }
12742
12743 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
12744         LDKAnnouncementSignatures ret = *owner->contents.result;
12745         ret.is_owned = false;
12746         return ret;
12747 }
12748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12749         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
12750         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
12751         int64_t ret_ref = 0;
12752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12754         return ret_ref;
12755 }
12756
12757 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
12758 CHECK(!owner->result_ok);
12759         return DecodeError_clone(&*owner->contents.err);
12760 }
12761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12762         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
12763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12764         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
12765         int64_t ret_ref = tag_ptr(ret_copy, true);
12766         return ret_ref;
12767 }
12768
12769 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
12770         LDKChannelReestablish ret = *owner->contents.result;
12771         ret.is_owned = false;
12772         return ret;
12773 }
12774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12775         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
12776         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
12777         int64_t ret_ref = 0;
12778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12780         return ret_ref;
12781 }
12782
12783 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
12784 CHECK(!owner->result_ok);
12785         return DecodeError_clone(&*owner->contents.err);
12786 }
12787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12788         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
12789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12790         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
12791         int64_t ret_ref = tag_ptr(ret_copy, true);
12792         return ret_ref;
12793 }
12794
12795 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
12796         LDKClosingSigned ret = *owner->contents.result;
12797         ret.is_owned = false;
12798         return ret;
12799 }
12800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12801         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
12802         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
12803         int64_t ret_ref = 0;
12804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12806         return ret_ref;
12807 }
12808
12809 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
12810 CHECK(!owner->result_ok);
12811         return DecodeError_clone(&*owner->contents.err);
12812 }
12813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12814         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
12815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12816         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
12817         int64_t ret_ref = tag_ptr(ret_copy, true);
12818         return ret_ref;
12819 }
12820
12821 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
12822         LDKClosingSignedFeeRange ret = *owner->contents.result;
12823         ret.is_owned = false;
12824         return ret;
12825 }
12826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12827         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
12828         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
12829         int64_t ret_ref = 0;
12830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12832         return ret_ref;
12833 }
12834
12835 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
12836 CHECK(!owner->result_ok);
12837         return DecodeError_clone(&*owner->contents.err);
12838 }
12839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12840         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
12841         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12842         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
12843         int64_t ret_ref = tag_ptr(ret_copy, true);
12844         return ret_ref;
12845 }
12846
12847 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
12848         LDKCommitmentSigned ret = *owner->contents.result;
12849         ret.is_owned = false;
12850         return ret;
12851 }
12852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12853         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
12854         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
12855         int64_t ret_ref = 0;
12856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12858         return ret_ref;
12859 }
12860
12861 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
12862 CHECK(!owner->result_ok);
12863         return DecodeError_clone(&*owner->contents.err);
12864 }
12865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12866         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
12867         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12868         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
12869         int64_t ret_ref = tag_ptr(ret_copy, true);
12870         return ret_ref;
12871 }
12872
12873 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12874         LDKFundingCreated ret = *owner->contents.result;
12875         ret.is_owned = false;
12876         return ret;
12877 }
12878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12879         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12880         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
12881         int64_t ret_ref = 0;
12882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12884         return ret_ref;
12885 }
12886
12887 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12888 CHECK(!owner->result_ok);
12889         return DecodeError_clone(&*owner->contents.err);
12890 }
12891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12892         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12893         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12894         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
12895         int64_t ret_ref = tag_ptr(ret_copy, true);
12896         return ret_ref;
12897 }
12898
12899 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12900         LDKFundingSigned ret = *owner->contents.result;
12901         ret.is_owned = false;
12902         return ret;
12903 }
12904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12905         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12906         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
12907         int64_t ret_ref = 0;
12908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12910         return ret_ref;
12911 }
12912
12913 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12914 CHECK(!owner->result_ok);
12915         return DecodeError_clone(&*owner->contents.err);
12916 }
12917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12918         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12920         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
12921         int64_t ret_ref = tag_ptr(ret_copy, true);
12922         return ret_ref;
12923 }
12924
12925 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12926         LDKChannelReady ret = *owner->contents.result;
12927         ret.is_owned = false;
12928         return ret;
12929 }
12930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12931         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12932         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
12933         int64_t ret_ref = 0;
12934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12936         return ret_ref;
12937 }
12938
12939 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12940 CHECK(!owner->result_ok);
12941         return DecodeError_clone(&*owner->contents.err);
12942 }
12943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12944         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12946         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
12947         int64_t ret_ref = tag_ptr(ret_copy, true);
12948         return ret_ref;
12949 }
12950
12951 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12952         LDKInit ret = *owner->contents.result;
12953         ret.is_owned = false;
12954         return ret;
12955 }
12956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12957         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12958         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
12959         int64_t ret_ref = 0;
12960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12962         return ret_ref;
12963 }
12964
12965 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12966 CHECK(!owner->result_ok);
12967         return DecodeError_clone(&*owner->contents.err);
12968 }
12969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12970         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12972         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
12973         int64_t ret_ref = tag_ptr(ret_copy, true);
12974         return ret_ref;
12975 }
12976
12977 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
12978         LDKOpenChannel ret = *owner->contents.result;
12979         ret.is_owned = false;
12980         return ret;
12981 }
12982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12983         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
12984         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
12985         int64_t ret_ref = 0;
12986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12988         return ret_ref;
12989 }
12990
12991 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
12992 CHECK(!owner->result_ok);
12993         return DecodeError_clone(&*owner->contents.err);
12994 }
12995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12996         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
12997         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12998         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
12999         int64_t ret_ref = tag_ptr(ret_copy, true);
13000         return ret_ref;
13001 }
13002
13003 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
13004         LDKOpenChannelV2 ret = *owner->contents.result;
13005         ret.is_owned = false;
13006         return ret;
13007 }
13008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13009         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
13010         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
13011         int64_t ret_ref = 0;
13012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13014         return ret_ref;
13015 }
13016
13017 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
13018 CHECK(!owner->result_ok);
13019         return DecodeError_clone(&*owner->contents.err);
13020 }
13021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13022         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
13023         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13024         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
13025         int64_t ret_ref = tag_ptr(ret_copy, true);
13026         return ret_ref;
13027 }
13028
13029 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
13030         LDKRevokeAndACK ret = *owner->contents.result;
13031         ret.is_owned = false;
13032         return ret;
13033 }
13034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13035         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
13036         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
13037         int64_t ret_ref = 0;
13038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13040         return ret_ref;
13041 }
13042
13043 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
13044 CHECK(!owner->result_ok);
13045         return DecodeError_clone(&*owner->contents.err);
13046 }
13047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13048         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
13049         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13050         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
13051         int64_t ret_ref = tag_ptr(ret_copy, true);
13052         return ret_ref;
13053 }
13054
13055 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
13056         LDKShutdown ret = *owner->contents.result;
13057         ret.is_owned = false;
13058         return ret;
13059 }
13060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13061         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
13062         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
13063         int64_t ret_ref = 0;
13064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13066         return ret_ref;
13067 }
13068
13069 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
13070 CHECK(!owner->result_ok);
13071         return DecodeError_clone(&*owner->contents.err);
13072 }
13073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13074         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
13075         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13076         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
13077         int64_t ret_ref = tag_ptr(ret_copy, true);
13078         return ret_ref;
13079 }
13080
13081 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
13082         LDKUpdateFailHTLC ret = *owner->contents.result;
13083         ret.is_owned = false;
13084         return ret;
13085 }
13086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13087         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
13088         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
13089         int64_t ret_ref = 0;
13090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13092         return ret_ref;
13093 }
13094
13095 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
13096 CHECK(!owner->result_ok);
13097         return DecodeError_clone(&*owner->contents.err);
13098 }
13099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13100         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
13101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13102         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
13103         int64_t ret_ref = tag_ptr(ret_copy, true);
13104         return ret_ref;
13105 }
13106
13107 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
13108         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
13109         ret.is_owned = false;
13110         return ret;
13111 }
13112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13113         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
13114         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
13115         int64_t ret_ref = 0;
13116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13118         return ret_ref;
13119 }
13120
13121 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
13122 CHECK(!owner->result_ok);
13123         return DecodeError_clone(&*owner->contents.err);
13124 }
13125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13126         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
13127         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13128         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
13129         int64_t ret_ref = tag_ptr(ret_copy, true);
13130         return ret_ref;
13131 }
13132
13133 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
13134         LDKUpdateFee ret = *owner->contents.result;
13135         ret.is_owned = false;
13136         return ret;
13137 }
13138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13139         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
13140         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
13141         int64_t ret_ref = 0;
13142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13144         return ret_ref;
13145 }
13146
13147 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
13148 CHECK(!owner->result_ok);
13149         return DecodeError_clone(&*owner->contents.err);
13150 }
13151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13152         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
13153         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13154         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
13155         int64_t ret_ref = tag_ptr(ret_copy, true);
13156         return ret_ref;
13157 }
13158
13159 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
13160         LDKUpdateFulfillHTLC ret = *owner->contents.result;
13161         ret.is_owned = false;
13162         return ret;
13163 }
13164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13165         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
13166         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
13167         int64_t ret_ref = 0;
13168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13170         return ret_ref;
13171 }
13172
13173 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
13174 CHECK(!owner->result_ok);
13175         return DecodeError_clone(&*owner->contents.err);
13176 }
13177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13178         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
13179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13180         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
13181         int64_t ret_ref = tag_ptr(ret_copy, true);
13182         return ret_ref;
13183 }
13184
13185 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
13186         LDKOnionPacket ret = *owner->contents.result;
13187         ret.is_owned = false;
13188         return ret;
13189 }
13190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13191         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
13192         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
13193         int64_t ret_ref = 0;
13194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13196         return ret_ref;
13197 }
13198
13199 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
13200 CHECK(!owner->result_ok);
13201         return DecodeError_clone(&*owner->contents.err);
13202 }
13203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13204         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
13205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13206         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
13207         int64_t ret_ref = tag_ptr(ret_copy, true);
13208         return ret_ref;
13209 }
13210
13211 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
13212         LDKUpdateAddHTLC ret = *owner->contents.result;
13213         ret.is_owned = false;
13214         return ret;
13215 }
13216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13217         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
13218         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
13219         int64_t ret_ref = 0;
13220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13222         return ret_ref;
13223 }
13224
13225 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
13226 CHECK(!owner->result_ok);
13227         return DecodeError_clone(&*owner->contents.err);
13228 }
13229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13230         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
13231         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13232         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
13233         int64_t ret_ref = tag_ptr(ret_copy, true);
13234         return ret_ref;
13235 }
13236
13237 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
13238         LDKOnionMessage ret = *owner->contents.result;
13239         ret.is_owned = false;
13240         return ret;
13241 }
13242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13243         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
13244         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
13245         int64_t ret_ref = 0;
13246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13248         return ret_ref;
13249 }
13250
13251 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
13252 CHECK(!owner->result_ok);
13253         return DecodeError_clone(&*owner->contents.err);
13254 }
13255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13256         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
13257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13258         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
13259         int64_t ret_ref = tag_ptr(ret_copy, true);
13260         return ret_ref;
13261 }
13262
13263 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
13264         LDKFinalOnionHopData ret = *owner->contents.result;
13265         ret.is_owned = false;
13266         return ret;
13267 }
13268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13269         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
13270         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
13271         int64_t ret_ref = 0;
13272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13274         return ret_ref;
13275 }
13276
13277 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
13278 CHECK(!owner->result_ok);
13279         return DecodeError_clone(&*owner->contents.err);
13280 }
13281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13282         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
13283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13284         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
13285         int64_t ret_ref = tag_ptr(ret_copy, true);
13286         return ret_ref;
13287 }
13288
13289 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
13290         LDKPing ret = *owner->contents.result;
13291         ret.is_owned = false;
13292         return ret;
13293 }
13294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13295         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
13296         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
13297         int64_t ret_ref = 0;
13298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13300         return ret_ref;
13301 }
13302
13303 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
13304 CHECK(!owner->result_ok);
13305         return DecodeError_clone(&*owner->contents.err);
13306 }
13307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13308         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
13309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13310         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
13311         int64_t ret_ref = tag_ptr(ret_copy, true);
13312         return ret_ref;
13313 }
13314
13315 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
13316         LDKPong ret = *owner->contents.result;
13317         ret.is_owned = false;
13318         return ret;
13319 }
13320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13321         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
13322         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
13323         int64_t ret_ref = 0;
13324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13326         return ret_ref;
13327 }
13328
13329 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
13330 CHECK(!owner->result_ok);
13331         return DecodeError_clone(&*owner->contents.err);
13332 }
13333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13334         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
13335         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13336         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
13337         int64_t ret_ref = tag_ptr(ret_copy, true);
13338         return ret_ref;
13339 }
13340
13341 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13342         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
13343         ret.is_owned = false;
13344         return ret;
13345 }
13346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13347         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13348         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
13349         int64_t ret_ref = 0;
13350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13352         return ret_ref;
13353 }
13354
13355 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13356 CHECK(!owner->result_ok);
13357         return DecodeError_clone(&*owner->contents.err);
13358 }
13359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13360         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13361         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13362         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
13363         int64_t ret_ref = tag_ptr(ret_copy, true);
13364         return ret_ref;
13365 }
13366
13367 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13368         LDKChannelAnnouncement ret = *owner->contents.result;
13369         ret.is_owned = false;
13370         return ret;
13371 }
13372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13373         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13374         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
13375         int64_t ret_ref = 0;
13376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13378         return ret_ref;
13379 }
13380
13381 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13382 CHECK(!owner->result_ok);
13383         return DecodeError_clone(&*owner->contents.err);
13384 }
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13386         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13388         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
13389         int64_t ret_ref = tag_ptr(ret_copy, true);
13390         return ret_ref;
13391 }
13392
13393 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13394         LDKUnsignedChannelUpdate ret = *owner->contents.result;
13395         ret.is_owned = false;
13396         return ret;
13397 }
13398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13399         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13400         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
13401         int64_t ret_ref = 0;
13402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13404         return ret_ref;
13405 }
13406
13407 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13408 CHECK(!owner->result_ok);
13409         return DecodeError_clone(&*owner->contents.err);
13410 }
13411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13412         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13413         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13414         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
13415         int64_t ret_ref = tag_ptr(ret_copy, true);
13416         return ret_ref;
13417 }
13418
13419 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13420         LDKChannelUpdate ret = *owner->contents.result;
13421         ret.is_owned = false;
13422         return ret;
13423 }
13424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13425         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13426         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
13427         int64_t ret_ref = 0;
13428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13430         return ret_ref;
13431 }
13432
13433 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13434 CHECK(!owner->result_ok);
13435         return DecodeError_clone(&*owner->contents.err);
13436 }
13437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13438         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13439         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13440         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
13441         int64_t ret_ref = tag_ptr(ret_copy, true);
13442         return ret_ref;
13443 }
13444
13445 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
13446         LDKErrorMessage ret = *owner->contents.result;
13447         ret.is_owned = false;
13448         return ret;
13449 }
13450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13451         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
13452         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
13453         int64_t ret_ref = 0;
13454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13456         return ret_ref;
13457 }
13458
13459 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
13460 CHECK(!owner->result_ok);
13461         return DecodeError_clone(&*owner->contents.err);
13462 }
13463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13464         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
13465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13466         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
13467         int64_t ret_ref = tag_ptr(ret_copy, true);
13468         return ret_ref;
13469 }
13470
13471 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
13472         LDKWarningMessage ret = *owner->contents.result;
13473         ret.is_owned = false;
13474         return ret;
13475 }
13476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13477         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
13478         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
13479         int64_t ret_ref = 0;
13480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13482         return ret_ref;
13483 }
13484
13485 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
13486 CHECK(!owner->result_ok);
13487         return DecodeError_clone(&*owner->contents.err);
13488 }
13489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13490         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
13491         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13492         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
13493         int64_t ret_ref = tag_ptr(ret_copy, true);
13494         return ret_ref;
13495 }
13496
13497 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13498         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
13499         ret.is_owned = false;
13500         return ret;
13501 }
13502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13503         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13504         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
13505         int64_t ret_ref = 0;
13506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13508         return ret_ref;
13509 }
13510
13511 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13512 CHECK(!owner->result_ok);
13513         return DecodeError_clone(&*owner->contents.err);
13514 }
13515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13516         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13517         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13518         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
13519         int64_t ret_ref = tag_ptr(ret_copy, true);
13520         return ret_ref;
13521 }
13522
13523 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13524         LDKNodeAnnouncement ret = *owner->contents.result;
13525         ret.is_owned = false;
13526         return ret;
13527 }
13528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13529         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13530         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
13531         int64_t ret_ref = 0;
13532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13534         return ret_ref;
13535 }
13536
13537 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13538 CHECK(!owner->result_ok);
13539         return DecodeError_clone(&*owner->contents.err);
13540 }
13541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13542         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13543         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13544         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
13545         int64_t ret_ref = tag_ptr(ret_copy, true);
13546         return ret_ref;
13547 }
13548
13549 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
13550         LDKQueryShortChannelIds ret = *owner->contents.result;
13551         ret.is_owned = false;
13552         return ret;
13553 }
13554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13555         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
13556         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
13557         int64_t ret_ref = 0;
13558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13560         return ret_ref;
13561 }
13562
13563 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
13564 CHECK(!owner->result_ok);
13565         return DecodeError_clone(&*owner->contents.err);
13566 }
13567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13568         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
13569         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13570         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
13571         int64_t ret_ref = tag_ptr(ret_copy, true);
13572         return ret_ref;
13573 }
13574
13575 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
13576         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
13577         ret.is_owned = false;
13578         return ret;
13579 }
13580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13581         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
13582         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
13583         int64_t ret_ref = 0;
13584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13586         return ret_ref;
13587 }
13588
13589 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
13590 CHECK(!owner->result_ok);
13591         return DecodeError_clone(&*owner->contents.err);
13592 }
13593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13594         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
13595         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13596         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
13597         int64_t ret_ref = tag_ptr(ret_copy, true);
13598         return ret_ref;
13599 }
13600
13601 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13602         LDKQueryChannelRange ret = *owner->contents.result;
13603         ret.is_owned = false;
13604         return ret;
13605 }
13606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13607         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
13608         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
13609         int64_t ret_ref = 0;
13610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13612         return ret_ref;
13613 }
13614
13615 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13616 CHECK(!owner->result_ok);
13617         return DecodeError_clone(&*owner->contents.err);
13618 }
13619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13620         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
13621         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13622         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
13623         int64_t ret_ref = tag_ptr(ret_copy, true);
13624         return ret_ref;
13625 }
13626
13627 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13628         LDKReplyChannelRange ret = *owner->contents.result;
13629         ret.is_owned = false;
13630         return ret;
13631 }
13632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13633         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
13634         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
13635         int64_t ret_ref = 0;
13636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13638         return ret_ref;
13639 }
13640
13641 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13642 CHECK(!owner->result_ok);
13643         return DecodeError_clone(&*owner->contents.err);
13644 }
13645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13646         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
13647         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13648         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
13649         int64_t ret_ref = tag_ptr(ret_copy, true);
13650         return ret_ref;
13651 }
13652
13653 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
13654         LDKGossipTimestampFilter ret = *owner->contents.result;
13655         ret.is_owned = false;
13656         return ret;
13657 }
13658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13659         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
13660         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
13661         int64_t ret_ref = 0;
13662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13664         return ret_ref;
13665 }
13666
13667 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
13668 CHECK(!owner->result_ok);
13669         return DecodeError_clone(&*owner->contents.err);
13670 }
13671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13672         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
13673         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13674         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
13675         int64_t ret_ref = tag_ptr(ret_copy, true);
13676         return ret_ref;
13677 }
13678
13679 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
13680         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
13681         for (size_t i = 0; i < ret.datalen; i++) {
13682                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
13683         }
13684         return ret;
13685 }
13686 static jclass LDKSignOrCreationError_SignError_class = NULL;
13687 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
13688 static jclass LDKSignOrCreationError_CreationError_class = NULL;
13689 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
13690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
13691         LDKSignOrCreationError_SignError_class =
13692                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
13693         CHECK(LDKSignOrCreationError_SignError_class != NULL);
13694         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
13695         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
13696         LDKSignOrCreationError_CreationError_class =
13697                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
13698         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
13699         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
13700         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
13701 }
13702 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13703         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
13704         switch(obj->tag) {
13705                 case LDKSignOrCreationError_SignError: {
13706                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
13707                 }
13708                 case LDKSignOrCreationError_CreationError: {
13709                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
13710                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
13711                 }
13712                 default: abort();
13713         }
13714 }
13715 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
13716         LDKBolt11Invoice ret = *owner->contents.result;
13717         ret.is_owned = false;
13718         return ret;
13719 }
13720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13721         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
13722         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_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 LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
13730 CHECK(!owner->result_ok);
13731         return SignOrCreationError_clone(&*owner->contents.err);
13732 }
13733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13734         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
13735         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
13736         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
13737         int64_t ret_ref = tag_ptr(ret_copy, true);
13738         return ret_ref;
13739 }
13740
13741 static jclass LDKCOption_InboundHTLCStateDetailsZ_Some_class = NULL;
13742 static jmethodID LDKCOption_InboundHTLCStateDetailsZ_Some_meth = NULL;
13743 static jclass LDKCOption_InboundHTLCStateDetailsZ_None_class = NULL;
13744 static jmethodID LDKCOption_InboundHTLCStateDetailsZ_None_meth = NULL;
13745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1InboundHTLCStateDetailsZ_init (JNIEnv *env, jclass clz) {
13746         LDKCOption_InboundHTLCStateDetailsZ_Some_class =
13747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_InboundHTLCStateDetailsZ$Some"));
13748         CHECK(LDKCOption_InboundHTLCStateDetailsZ_Some_class != NULL);
13749         LDKCOption_InboundHTLCStateDetailsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_InboundHTLCStateDetailsZ_Some_class, "<init>", "(Lorg/ldk/enums/InboundHTLCStateDetails;)V");
13750         CHECK(LDKCOption_InboundHTLCStateDetailsZ_Some_meth != NULL);
13751         LDKCOption_InboundHTLCStateDetailsZ_None_class =
13752                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_InboundHTLCStateDetailsZ$None"));
13753         CHECK(LDKCOption_InboundHTLCStateDetailsZ_None_class != NULL);
13754         LDKCOption_InboundHTLCStateDetailsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_InboundHTLCStateDetailsZ_None_class, "<init>", "()V");
13755         CHECK(LDKCOption_InboundHTLCStateDetailsZ_None_meth != NULL);
13756 }
13757 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1InboundHTLCStateDetailsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13758         LDKCOption_InboundHTLCStateDetailsZ *obj = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(ptr);
13759         switch(obj->tag) {
13760                 case LDKCOption_InboundHTLCStateDetailsZ_Some: {
13761                         jclass some_conv = LDKInboundHTLCStateDetails_to_java(env, obj->some);
13762                         return (*env)->NewObject(env, LDKCOption_InboundHTLCStateDetailsZ_Some_class, LDKCOption_InboundHTLCStateDetailsZ_Some_meth, some_conv);
13763                 }
13764                 case LDKCOption_InboundHTLCStateDetailsZ_None: {
13765                         return (*env)->NewObject(env, LDKCOption_InboundHTLCStateDetailsZ_None_class, LDKCOption_InboundHTLCStateDetailsZ_None_meth);
13766                 }
13767                 default: abort();
13768         }
13769 }
13770 static inline struct LDKCOption_InboundHTLCStateDetailsZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
13771 CHECK(owner->result_ok);
13772         return COption_InboundHTLCStateDetailsZ_clone(&*owner->contents.result);
13773 }
13774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13775         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
13776         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
13777         *ret_copy = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(owner_conv);
13778         int64_t ret_ref = tag_ptr(ret_copy, true);
13779         return ret_ref;
13780 }
13781
13782 static inline struct LDKDecodeError CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
13783 CHECK(!owner->result_ok);
13784         return DecodeError_clone(&*owner->contents.err);
13785 }
13786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13787         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
13788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13789         *ret_copy = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(owner_conv);
13790         int64_t ret_ref = tag_ptr(ret_copy, true);
13791         return ret_ref;
13792 }
13793
13794 static inline struct LDKInboundHTLCDetails CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
13795         LDKInboundHTLCDetails ret = *owner->contents.result;
13796         ret.is_owned = false;
13797         return ret;
13798 }
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13800         LDKCResult_InboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
13801         LDKInboundHTLCDetails ret_var = CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(owner_conv);
13802         int64_t ret_ref = 0;
13803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13805         return ret_ref;
13806 }
13807
13808 static inline struct LDKDecodeError CResult_InboundHTLCDetailsDecodeErrorZ_get_err(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
13809 CHECK(!owner->result_ok);
13810         return DecodeError_clone(&*owner->contents.err);
13811 }
13812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13813         LDKCResult_InboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
13814         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13815         *ret_copy = CResult_InboundHTLCDetailsDecodeErrorZ_get_err(owner_conv);
13816         int64_t ret_ref = tag_ptr(ret_copy, true);
13817         return ret_ref;
13818 }
13819
13820 static jclass LDKCOption_OutboundHTLCStateDetailsZ_Some_class = NULL;
13821 static jmethodID LDKCOption_OutboundHTLCStateDetailsZ_Some_meth = NULL;
13822 static jclass LDKCOption_OutboundHTLCStateDetailsZ_None_class = NULL;
13823 static jmethodID LDKCOption_OutboundHTLCStateDetailsZ_None_meth = NULL;
13824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OutboundHTLCStateDetailsZ_init (JNIEnv *env, jclass clz) {
13825         LDKCOption_OutboundHTLCStateDetailsZ_Some_class =
13826                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OutboundHTLCStateDetailsZ$Some"));
13827         CHECK(LDKCOption_OutboundHTLCStateDetailsZ_Some_class != NULL);
13828         LDKCOption_OutboundHTLCStateDetailsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OutboundHTLCStateDetailsZ_Some_class, "<init>", "(Lorg/ldk/enums/OutboundHTLCStateDetails;)V");
13829         CHECK(LDKCOption_OutboundHTLCStateDetailsZ_Some_meth != NULL);
13830         LDKCOption_OutboundHTLCStateDetailsZ_None_class =
13831                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OutboundHTLCStateDetailsZ$None"));
13832         CHECK(LDKCOption_OutboundHTLCStateDetailsZ_None_class != NULL);
13833         LDKCOption_OutboundHTLCStateDetailsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OutboundHTLCStateDetailsZ_None_class, "<init>", "()V");
13834         CHECK(LDKCOption_OutboundHTLCStateDetailsZ_None_meth != NULL);
13835 }
13836 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OutboundHTLCStateDetailsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13837         LDKCOption_OutboundHTLCStateDetailsZ *obj = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(ptr);
13838         switch(obj->tag) {
13839                 case LDKCOption_OutboundHTLCStateDetailsZ_Some: {
13840                         jclass some_conv = LDKOutboundHTLCStateDetails_to_java(env, obj->some);
13841                         return (*env)->NewObject(env, LDKCOption_OutboundHTLCStateDetailsZ_Some_class, LDKCOption_OutboundHTLCStateDetailsZ_Some_meth, some_conv);
13842                 }
13843                 case LDKCOption_OutboundHTLCStateDetailsZ_None: {
13844                         return (*env)->NewObject(env, LDKCOption_OutboundHTLCStateDetailsZ_None_class, LDKCOption_OutboundHTLCStateDetailsZ_None_meth);
13845                 }
13846                 default: abort();
13847         }
13848 }
13849 static inline struct LDKCOption_OutboundHTLCStateDetailsZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
13850 CHECK(owner->result_ok);
13851         return COption_OutboundHTLCStateDetailsZ_clone(&*owner->contents.result);
13852 }
13853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13854         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
13855         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
13856         *ret_copy = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(owner_conv);
13857         int64_t ret_ref = tag_ptr(ret_copy, true);
13858         return ret_ref;
13859 }
13860
13861 static inline struct LDKDecodeError CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
13862 CHECK(!owner->result_ok);
13863         return DecodeError_clone(&*owner->contents.err);
13864 }
13865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13866         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
13867         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13868         *ret_copy = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(owner_conv);
13869         int64_t ret_ref = tag_ptr(ret_copy, true);
13870         return ret_ref;
13871 }
13872
13873 static inline struct LDKOutboundHTLCDetails CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
13874         LDKOutboundHTLCDetails ret = *owner->contents.result;
13875         ret.is_owned = false;
13876         return ret;
13877 }
13878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13879         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
13880         LDKOutboundHTLCDetails ret_var = CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(owner_conv);
13881         int64_t ret_ref = 0;
13882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13884         return ret_ref;
13885 }
13886
13887 static inline struct LDKDecodeError CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
13888 CHECK(!owner->result_ok);
13889         return DecodeError_clone(&*owner->contents.err);
13890 }
13891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13892         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
13893         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13894         *ret_copy = CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(owner_conv);
13895         int64_t ret_ref = tag_ptr(ret_copy, true);
13896         return ret_ref;
13897 }
13898
13899 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
13900         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
13901         ret.is_owned = false;
13902         return ret;
13903 }
13904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13905         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
13906         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
13907         int64_t ret_ref = 0;
13908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13910         return ret_ref;
13911 }
13912
13913 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
13914 CHECK(!owner->result_ok);
13915         return DecodeError_clone(&*owner->contents.err);
13916 }
13917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13918         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
13919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13920         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
13921         int64_t ret_ref = tag_ptr(ret_copy, true);
13922         return ret_ref;
13923 }
13924
13925 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
13926         LDKChannelCounterparty ret = *owner->contents.result;
13927         ret.is_owned = false;
13928         return ret;
13929 }
13930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13931         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
13932         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
13933         int64_t ret_ref = 0;
13934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13936         return ret_ref;
13937 }
13938
13939 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
13940 CHECK(!owner->result_ok);
13941         return DecodeError_clone(&*owner->contents.err);
13942 }
13943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13944         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
13945         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13946         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
13947         int64_t ret_ref = tag_ptr(ret_copy, true);
13948         return ret_ref;
13949 }
13950
13951 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
13952 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
13953 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
13954 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
13955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
13956         LDKCOption_ChannelShutdownStateZ_Some_class =
13957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
13958         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
13959         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
13960         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
13961         LDKCOption_ChannelShutdownStateZ_None_class =
13962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
13963         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
13964         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
13965         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
13966 }
13967 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13968         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
13969         switch(obj->tag) {
13970                 case LDKCOption_ChannelShutdownStateZ_Some: {
13971                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
13972                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
13973                 }
13974                 case LDKCOption_ChannelShutdownStateZ_None: {
13975                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
13976                 }
13977                 default: abort();
13978         }
13979 }
13980 static inline LDKCVec_InboundHTLCDetailsZ CVec_InboundHTLCDetailsZ_clone(const LDKCVec_InboundHTLCDetailsZ *orig) {
13981         LDKCVec_InboundHTLCDetailsZ ret = { .data = MALLOC(sizeof(LDKInboundHTLCDetails) * orig->datalen, "LDKCVec_InboundHTLCDetailsZ clone bytes"), .datalen = orig->datalen };
13982         for (size_t i = 0; i < ret.datalen; i++) {
13983                 ret.data[i] = InboundHTLCDetails_clone(&orig->data[i]);
13984         }
13985         return ret;
13986 }
13987 static inline LDKCVec_OutboundHTLCDetailsZ CVec_OutboundHTLCDetailsZ_clone(const LDKCVec_OutboundHTLCDetailsZ *orig) {
13988         LDKCVec_OutboundHTLCDetailsZ ret = { .data = MALLOC(sizeof(LDKOutboundHTLCDetails) * orig->datalen, "LDKCVec_OutboundHTLCDetailsZ clone bytes"), .datalen = orig->datalen };
13989         for (size_t i = 0; i < ret.datalen; i++) {
13990                 ret.data[i] = OutboundHTLCDetails_clone(&orig->data[i]);
13991         }
13992         return ret;
13993 }
13994 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
13995         LDKChannelDetails ret = *owner->contents.result;
13996         ret.is_owned = false;
13997         return ret;
13998 }
13999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14000         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
14001         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
14002         int64_t ret_ref = 0;
14003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14005         return ret_ref;
14006 }
14007
14008 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
14009 CHECK(!owner->result_ok);
14010         return DecodeError_clone(&*owner->contents.err);
14011 }
14012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14013         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
14014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14015         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
14016         int64_t ret_ref = tag_ptr(ret_copy, true);
14017         return ret_ref;
14018 }
14019
14020 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
14021 CHECK(owner->result_ok);
14022         return ChannelShutdownState_clone(&*owner->contents.result);
14023 }
14024 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14025         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
14026         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
14027         return ret_conv;
14028 }
14029
14030 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
14031 CHECK(!owner->result_ok);
14032         return DecodeError_clone(&*owner->contents.err);
14033 }
14034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14035         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
14036         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14037         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
14038         int64_t ret_ref = tag_ptr(ret_copy, true);
14039         return ret_ref;
14040 }
14041
14042 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
14043 CHECK(owner->result_ok);
14044         return OffersMessage_clone(&*owner->contents.result);
14045 }
14046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14047         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
14048         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14049         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
14050         int64_t ret_ref = tag_ptr(ret_copy, true);
14051         return ret_ref;
14052 }
14053
14054 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
14055 CHECK(!owner->result_ok);
14056         return DecodeError_clone(&*owner->contents.err);
14057 }
14058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14059         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
14060         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14061         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
14062         int64_t ret_ref = tag_ptr(ret_copy, true);
14063         return ret_ref;
14064 }
14065
14066 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
14067 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
14068 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
14069 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
14070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
14071         LDKCOption_HTLCClaimZ_Some_class =
14072                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
14073         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
14074         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
14075         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
14076         LDKCOption_HTLCClaimZ_None_class =
14077                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
14078         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
14079         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
14080         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
14081 }
14082 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14083         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
14084         switch(obj->tag) {
14085                 case LDKCOption_HTLCClaimZ_Some: {
14086                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
14087                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
14088                 }
14089                 case LDKCOption_HTLCClaimZ_None: {
14090                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
14091                 }
14092                 default: abort();
14093         }
14094 }
14095 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
14096         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
14097         ret.is_owned = false;
14098         return ret;
14099 }
14100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14101         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
14102         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
14103         int64_t ret_ref = 0;
14104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14106         return ret_ref;
14107 }
14108
14109 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
14110 CHECK(!owner->result_ok);
14111         return DecodeError_clone(&*owner->contents.err);
14112 }
14113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14114         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
14115         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14116         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
14117         int64_t ret_ref = tag_ptr(ret_copy, true);
14118         return ret_ref;
14119 }
14120
14121 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
14122         LDKTxCreationKeys ret = *owner->contents.result;
14123         ret.is_owned = false;
14124         return ret;
14125 }
14126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14127         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
14128         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
14129         int64_t ret_ref = 0;
14130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14132         return ret_ref;
14133 }
14134
14135 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
14136 CHECK(!owner->result_ok);
14137         return DecodeError_clone(&*owner->contents.err);
14138 }
14139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14140         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
14141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14142         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
14143         int64_t ret_ref = tag_ptr(ret_copy, true);
14144         return ret_ref;
14145 }
14146
14147 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
14148         LDKChannelPublicKeys ret = *owner->contents.result;
14149         ret.is_owned = false;
14150         return ret;
14151 }
14152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14153         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
14154         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
14155         int64_t ret_ref = 0;
14156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14158         return ret_ref;
14159 }
14160
14161 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
14162 CHECK(!owner->result_ok);
14163         return DecodeError_clone(&*owner->contents.err);
14164 }
14165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14166         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
14167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14168         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
14169         int64_t ret_ref = tag_ptr(ret_copy, true);
14170         return ret_ref;
14171 }
14172
14173 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
14174         LDKHTLCOutputInCommitment ret = *owner->contents.result;
14175         ret.is_owned = false;
14176         return ret;
14177 }
14178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14179         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
14180         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
14181         int64_t ret_ref = 0;
14182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14184         return ret_ref;
14185 }
14186
14187 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
14188 CHECK(!owner->result_ok);
14189         return DecodeError_clone(&*owner->contents.err);
14190 }
14191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14192         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
14193         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14194         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
14195         int64_t ret_ref = tag_ptr(ret_copy, true);
14196         return ret_ref;
14197 }
14198
14199 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
14200         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
14201         ret.is_owned = false;
14202         return ret;
14203 }
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14205         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
14206         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
14207         int64_t ret_ref = 0;
14208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14210         return ret_ref;
14211 }
14212
14213 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
14214 CHECK(!owner->result_ok);
14215         return DecodeError_clone(&*owner->contents.err);
14216 }
14217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14218         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
14219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14220         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
14221         int64_t ret_ref = tag_ptr(ret_copy, true);
14222         return ret_ref;
14223 }
14224
14225 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
14226         LDKChannelTransactionParameters ret = *owner->contents.result;
14227         ret.is_owned = false;
14228         return ret;
14229 }
14230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14231         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
14232         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
14233         int64_t ret_ref = 0;
14234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14236         return ret_ref;
14237 }
14238
14239 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
14240 CHECK(!owner->result_ok);
14241         return DecodeError_clone(&*owner->contents.err);
14242 }
14243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14244         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
14245         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14246         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
14247         int64_t ret_ref = tag_ptr(ret_copy, true);
14248         return ret_ref;
14249 }
14250
14251 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14252         LDKHolderCommitmentTransaction ret = *owner->contents.result;
14253         ret.is_owned = false;
14254         return ret;
14255 }
14256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14257         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14258         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14259         int64_t ret_ref = 0;
14260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14262         return ret_ref;
14263 }
14264
14265 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14266 CHECK(!owner->result_ok);
14267         return DecodeError_clone(&*owner->contents.err);
14268 }
14269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14270         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14271         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14272         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14273         int64_t ret_ref = tag_ptr(ret_copy, true);
14274         return ret_ref;
14275 }
14276
14277 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14278         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
14279         ret.is_owned = false;
14280         return ret;
14281 }
14282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14283         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14284         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14285         int64_t ret_ref = 0;
14286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14288         return ret_ref;
14289 }
14290
14291 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14292 CHECK(!owner->result_ok);
14293         return DecodeError_clone(&*owner->contents.err);
14294 }
14295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14296         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14297         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14298         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14299         int64_t ret_ref = tag_ptr(ret_copy, true);
14300         return ret_ref;
14301 }
14302
14303 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
14304         LDKTrustedClosingTransaction ret = *owner->contents.result;
14305         ret.is_owned = false;
14306         return ret;
14307 }
14308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14309         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
14310         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
14311         int64_t ret_ref = 0;
14312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14314         return ret_ref;
14315 }
14316
14317 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
14318 CHECK(!owner->result_ok);
14319         return *owner->contents.err;
14320 }
14321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14322         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
14323         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
14324 }
14325
14326 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14327         LDKCommitmentTransaction ret = *owner->contents.result;
14328         ret.is_owned = false;
14329         return ret;
14330 }
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14332         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14333         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14334         int64_t ret_ref = 0;
14335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14337         return ret_ref;
14338 }
14339
14340 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14341 CHECK(!owner->result_ok);
14342         return DecodeError_clone(&*owner->contents.err);
14343 }
14344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14345         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14347         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14348         int64_t ret_ref = tag_ptr(ret_copy, true);
14349         return ret_ref;
14350 }
14351
14352 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
14353         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
14354         ret.is_owned = false;
14355         return ret;
14356 }
14357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14358         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
14359         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
14360         int64_t ret_ref = 0;
14361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14363         return ret_ref;
14364 }
14365
14366 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
14367 CHECK(!owner->result_ok);
14368         return *owner->contents.err;
14369 }
14370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14371         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
14372         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
14373 }
14374
14375 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
14376 CHECK(owner->result_ok);
14377         return *owner->contents.result;
14378 }
14379 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14380         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
14381         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
14382         jobjectArray ret_arr = NULL;
14383         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14384         ;
14385         for (size_t i = 0; i < ret_var.datalen; i++) {
14386                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
14387                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
14388                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14389         }
14390         
14391         return ret_arr;
14392 }
14393
14394 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
14395 CHECK(!owner->result_ok);
14396         return *owner->contents.err;
14397 }
14398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14399         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
14400         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
14401 }
14402
14403 static jclass LDKCOption_usizeZ_Some_class = NULL;
14404 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
14405 static jclass LDKCOption_usizeZ_None_class = NULL;
14406 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
14407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
14408         LDKCOption_usizeZ_Some_class =
14409                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
14410         CHECK(LDKCOption_usizeZ_Some_class != NULL);
14411         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
14412         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
14413         LDKCOption_usizeZ_None_class =
14414                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
14415         CHECK(LDKCOption_usizeZ_None_class != NULL);
14416         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
14417         CHECK(LDKCOption_usizeZ_None_meth != NULL);
14418 }
14419 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14420         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
14421         switch(obj->tag) {
14422                 case LDKCOption_usizeZ_Some: {
14423                         int64_t some_conv = obj->some;
14424                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
14425                 }
14426                 case LDKCOption_usizeZ_None: {
14427                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
14428                 }
14429                 default: abort();
14430         }
14431 }
14432 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
14433         LDKShutdownScript ret = *owner->contents.result;
14434         ret.is_owned = false;
14435         return ret;
14436 }
14437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14438         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
14439         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
14440         int64_t ret_ref = 0;
14441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14443         return ret_ref;
14444 }
14445
14446 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
14447 CHECK(!owner->result_ok);
14448         return DecodeError_clone(&*owner->contents.err);
14449 }
14450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14451         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
14452         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14453         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
14454         int64_t ret_ref = tag_ptr(ret_copy, true);
14455         return ret_ref;
14456 }
14457
14458 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
14459         LDKShutdownScript ret = *owner->contents.result;
14460         ret.is_owned = false;
14461         return ret;
14462 }
14463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14464         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
14465         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
14466         int64_t ret_ref = 0;
14467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14469         return ret_ref;
14470 }
14471
14472 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
14473         LDKInvalidShutdownScript ret = *owner->contents.err;
14474         ret.is_owned = false;
14475         return ret;
14476 }
14477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14478         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
14479         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
14480         int64_t ret_ref = 0;
14481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14483         return ret_ref;
14484 }
14485
14486 static jclass LDKPaymentPurpose_Bolt11InvoicePayment_class = NULL;
14487 static jmethodID LDKPaymentPurpose_Bolt11InvoicePayment_meth = NULL;
14488 static jclass LDKPaymentPurpose_Bolt12OfferPayment_class = NULL;
14489 static jmethodID LDKPaymentPurpose_Bolt12OfferPayment_meth = NULL;
14490 static jclass LDKPaymentPurpose_Bolt12RefundPayment_class = NULL;
14491 static jmethodID LDKPaymentPurpose_Bolt12RefundPayment_meth = NULL;
14492 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
14493 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
14494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
14495         LDKPaymentPurpose_Bolt11InvoicePayment_class =
14496                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt11InvoicePayment"));
14497         CHECK(LDKPaymentPurpose_Bolt11InvoicePayment_class != NULL);
14498         LDKPaymentPurpose_Bolt11InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt11InvoicePayment_class, "<init>", "(J[B)V");
14499         CHECK(LDKPaymentPurpose_Bolt11InvoicePayment_meth != NULL);
14500         LDKPaymentPurpose_Bolt12OfferPayment_class =
14501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt12OfferPayment"));
14502         CHECK(LDKPaymentPurpose_Bolt12OfferPayment_class != NULL);
14503         LDKPaymentPurpose_Bolt12OfferPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt12OfferPayment_class, "<init>", "(J[BJ)V");
14504         CHECK(LDKPaymentPurpose_Bolt12OfferPayment_meth != NULL);
14505         LDKPaymentPurpose_Bolt12RefundPayment_class =
14506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt12RefundPayment"));
14507         CHECK(LDKPaymentPurpose_Bolt12RefundPayment_class != NULL);
14508         LDKPaymentPurpose_Bolt12RefundPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt12RefundPayment_class, "<init>", "(J[BJ)V");
14509         CHECK(LDKPaymentPurpose_Bolt12RefundPayment_meth != NULL);
14510         LDKPaymentPurpose_SpontaneousPayment_class =
14511                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
14512         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
14513         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
14514         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
14515 }
14516 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14517         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
14518         switch(obj->tag) {
14519                 case LDKPaymentPurpose_Bolt11InvoicePayment: {
14520                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
14521                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14522                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt11_invoice_payment.payment_secret.data);
14523                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt11InvoicePayment_class, LDKPaymentPurpose_Bolt11InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
14524                 }
14525                 case LDKPaymentPurpose_Bolt12OfferPayment: {
14526                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
14527                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14528                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt12_offer_payment.payment_secret.data);
14529                         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
14530                         int64_t payment_context_ref = 0;
14531                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
14532                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
14533                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt12OfferPayment_class, LDKPaymentPurpose_Bolt12OfferPayment_meth, payment_preimage_ref, payment_secret_arr, payment_context_ref);
14534                 }
14535                 case LDKPaymentPurpose_Bolt12RefundPayment: {
14536                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
14537                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14538                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt12_refund_payment.payment_secret.data);
14539                         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
14540                         int64_t payment_context_ref = 0;
14541                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
14542                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
14543                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt12RefundPayment_class, LDKPaymentPurpose_Bolt12RefundPayment_meth, payment_preimage_ref, payment_secret_arr, payment_context_ref);
14544                 }
14545                 case LDKPaymentPurpose_SpontaneousPayment: {
14546                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
14547                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
14548                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
14549                 }
14550                 default: abort();
14551         }
14552 }
14553 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
14554 CHECK(owner->result_ok);
14555         return PaymentPurpose_clone(&*owner->contents.result);
14556 }
14557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14558         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
14559         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14560         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
14561         int64_t ret_ref = tag_ptr(ret_copy, true);
14562         return ret_ref;
14563 }
14564
14565 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
14566 CHECK(!owner->result_ok);
14567         return DecodeError_clone(&*owner->contents.err);
14568 }
14569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14570         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
14571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14572         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
14573         int64_t ret_ref = tag_ptr(ret_copy, true);
14574         return ret_ref;
14575 }
14576
14577 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
14578         LDKClaimedHTLC ret = *owner->contents.result;
14579         ret.is_owned = false;
14580         return ret;
14581 }
14582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14583         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
14584         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
14585         int64_t ret_ref = 0;
14586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14588         return ret_ref;
14589 }
14590
14591 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
14592 CHECK(!owner->result_ok);
14593         return DecodeError_clone(&*owner->contents.err);
14594 }
14595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14596         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
14597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14598         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
14599         int64_t ret_ref = tag_ptr(ret_copy, true);
14600         return ret_ref;
14601 }
14602
14603 static jclass LDKPathFailure_InitialSend_class = NULL;
14604 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
14605 static jclass LDKPathFailure_OnPath_class = NULL;
14606 static jmethodID LDKPathFailure_OnPath_meth = NULL;
14607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
14608         LDKPathFailure_InitialSend_class =
14609                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
14610         CHECK(LDKPathFailure_InitialSend_class != NULL);
14611         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
14612         CHECK(LDKPathFailure_InitialSend_meth != NULL);
14613         LDKPathFailure_OnPath_class =
14614                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
14615         CHECK(LDKPathFailure_OnPath_class != NULL);
14616         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
14617         CHECK(LDKPathFailure_OnPath_meth != NULL);
14618 }
14619 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14620         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
14621         switch(obj->tag) {
14622                 case LDKPathFailure_InitialSend: {
14623                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
14624                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
14625                 }
14626                 case LDKPathFailure_OnPath: {
14627                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
14628                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
14629                 }
14630                 default: abort();
14631         }
14632 }
14633 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
14634 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
14635 static jclass LDKCOption_PathFailureZ_None_class = NULL;
14636 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
14637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
14638         LDKCOption_PathFailureZ_Some_class =
14639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
14640         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
14641         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
14642         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
14643         LDKCOption_PathFailureZ_None_class =
14644                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
14645         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
14646         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
14647         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
14648 }
14649 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14650         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
14651         switch(obj->tag) {
14652                 case LDKCOption_PathFailureZ_Some: {
14653                         int64_t some_ref = tag_ptr(&obj->some, false);
14654                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
14655                 }
14656                 case LDKCOption_PathFailureZ_None: {
14657                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
14658                 }
14659                 default: abort();
14660         }
14661 }
14662 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
14663 CHECK(owner->result_ok);
14664         return COption_PathFailureZ_clone(&*owner->contents.result);
14665 }
14666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14667         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
14668         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14669         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
14670         int64_t ret_ref = tag_ptr(ret_copy, true);
14671         return ret_ref;
14672 }
14673
14674 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
14675 CHECK(!owner->result_ok);
14676         return DecodeError_clone(&*owner->contents.err);
14677 }
14678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14679         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
14680         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14681         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
14682         int64_t ret_ref = tag_ptr(ret_copy, true);
14683         return ret_ref;
14684 }
14685
14686 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
14687 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
14688 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
14689 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
14690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
14691         LDKCOption_ClosureReasonZ_Some_class =
14692                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
14693         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
14694         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
14695         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
14696         LDKCOption_ClosureReasonZ_None_class =
14697                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
14698         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
14699         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
14700         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
14701 }
14702 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14703         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
14704         switch(obj->tag) {
14705                 case LDKCOption_ClosureReasonZ_Some: {
14706                         int64_t some_ref = tag_ptr(&obj->some, false);
14707                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
14708                 }
14709                 case LDKCOption_ClosureReasonZ_None: {
14710                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
14711                 }
14712                 default: abort();
14713         }
14714 }
14715 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
14716 CHECK(owner->result_ok);
14717         return COption_ClosureReasonZ_clone(&*owner->contents.result);
14718 }
14719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14720         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
14721         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14722         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
14723         int64_t ret_ref = tag_ptr(ret_copy, true);
14724         return ret_ref;
14725 }
14726
14727 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
14728 CHECK(!owner->result_ok);
14729         return DecodeError_clone(&*owner->contents.err);
14730 }
14731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14732         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
14733         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14734         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
14735         int64_t ret_ref = tag_ptr(ret_copy, true);
14736         return ret_ref;
14737 }
14738
14739 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
14740 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
14741 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
14742 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
14743 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
14744 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
14745 static jclass LDKHTLCDestination_InvalidOnion_class = NULL;
14746 static jmethodID LDKHTLCDestination_InvalidOnion_meth = NULL;
14747 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
14748 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
14749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
14750         LDKHTLCDestination_NextHopChannel_class =
14751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
14752         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
14753         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([BJ)V");
14754         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
14755         LDKHTLCDestination_UnknownNextHop_class =
14756                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
14757         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
14758         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
14759         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
14760         LDKHTLCDestination_InvalidForward_class =
14761                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
14762         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
14763         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
14764         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
14765         LDKHTLCDestination_InvalidOnion_class =
14766                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidOnion"));
14767         CHECK(LDKHTLCDestination_InvalidOnion_class != NULL);
14768         LDKHTLCDestination_InvalidOnion_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidOnion_class, "<init>", "()V");
14769         CHECK(LDKHTLCDestination_InvalidOnion_meth != NULL);
14770         LDKHTLCDestination_FailedPayment_class =
14771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
14772         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
14773         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
14774         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
14775 }
14776 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14777         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
14778         switch(obj->tag) {
14779                 case LDKHTLCDestination_NextHopChannel: {
14780                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14781                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
14782                         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
14783                         int64_t channel_id_ref = 0;
14784                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14785                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14786                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_ref);
14787                 }
14788                 case LDKHTLCDestination_UnknownNextHop: {
14789                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
14790                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
14791                 }
14792                 case LDKHTLCDestination_InvalidForward: {
14793                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
14794                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
14795                 }
14796                 case LDKHTLCDestination_InvalidOnion: {
14797                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidOnion_class, LDKHTLCDestination_InvalidOnion_meth);
14798                 }
14799                 case LDKHTLCDestination_FailedPayment: {
14800                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14801                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
14802                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
14803                 }
14804                 default: abort();
14805         }
14806 }
14807 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
14808 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
14809 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
14810 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
14811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
14812         LDKCOption_HTLCDestinationZ_Some_class =
14813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
14814         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
14815         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
14816         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
14817         LDKCOption_HTLCDestinationZ_None_class =
14818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
14819         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
14820         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
14821         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
14822 }
14823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14824         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
14825         switch(obj->tag) {
14826                 case LDKCOption_HTLCDestinationZ_Some: {
14827                         int64_t some_ref = tag_ptr(&obj->some, false);
14828                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
14829                 }
14830                 case LDKCOption_HTLCDestinationZ_None: {
14831                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
14832                 }
14833                 default: abort();
14834         }
14835 }
14836 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
14837 CHECK(owner->result_ok);
14838         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
14839 }
14840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14841         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
14842         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
14843         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
14844         int64_t ret_ref = tag_ptr(ret_copy, true);
14845         return ret_ref;
14846 }
14847
14848 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
14849 CHECK(!owner->result_ok);
14850         return DecodeError_clone(&*owner->contents.err);
14851 }
14852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14853         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
14854         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14855         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
14856         int64_t ret_ref = tag_ptr(ret_copy, true);
14857         return ret_ref;
14858 }
14859
14860 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
14861 CHECK(owner->result_ok);
14862         return PaymentFailureReason_clone(&*owner->contents.result);
14863 }
14864 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14865         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
14866         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
14867         return ret_conv;
14868 }
14869
14870 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
14871 CHECK(!owner->result_ok);
14872         return DecodeError_clone(&*owner->contents.err);
14873 }
14874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14875         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
14876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14877         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
14878         int64_t ret_ref = tag_ptr(ret_copy, true);
14879         return ret_ref;
14880 }
14881
14882 static jclass LDKCOption_U128Z_Some_class = NULL;
14883 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
14884 static jclass LDKCOption_U128Z_None_class = NULL;
14885 static jmethodID LDKCOption_U128Z_None_meth = NULL;
14886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
14887         LDKCOption_U128Z_Some_class =
14888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
14889         CHECK(LDKCOption_U128Z_Some_class != NULL);
14890         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
14891         CHECK(LDKCOption_U128Z_Some_meth != NULL);
14892         LDKCOption_U128Z_None_class =
14893                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
14894         CHECK(LDKCOption_U128Z_None_class != NULL);
14895         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
14896         CHECK(LDKCOption_U128Z_None_meth != NULL);
14897 }
14898 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14899         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
14900         switch(obj->tag) {
14901                 case LDKCOption_U128Z_Some: {
14902                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
14903                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
14904                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
14905                 }
14906                 case LDKCOption_U128Z_None: {
14907                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
14908                 }
14909                 default: abort();
14910         }
14911 }
14912 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
14913         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
14914         for (size_t i = 0; i < ret.datalen; i++) {
14915                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
14916         }
14917         return ret;
14918 }
14919 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
14920 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
14921 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
14922 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
14923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
14924         LDKCOption_PaymentFailureReasonZ_Some_class =
14925                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
14926         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
14927         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
14928         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
14929         LDKCOption_PaymentFailureReasonZ_None_class =
14930                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
14931         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
14932         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
14933         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
14934 }
14935 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14936         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
14937         switch(obj->tag) {
14938                 case LDKCOption_PaymentFailureReasonZ_Some: {
14939                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
14940                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
14941                 }
14942                 case LDKCOption_PaymentFailureReasonZ_None: {
14943                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
14944                 }
14945                 default: abort();
14946         }
14947 }
14948 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
14949 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
14950 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
14951 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
14952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
14953         LDKBumpTransactionEvent_ChannelClose_class =
14954                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
14955         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
14956         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "(J[B[BI[BJJ[J)V");
14957         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
14958         LDKBumpTransactionEvent_HTLCResolution_class =
14959                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
14960         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
14961         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "(J[B[BI[JI)V");
14962         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
14963 }
14964 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14965         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
14966         switch(obj->tag) {
14967                 case LDKBumpTransactionEvent_ChannelClose: {
14968                         LDKChannelId channel_id_var = obj->channel_close.channel_id;
14969                         int64_t channel_id_ref = 0;
14970                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14971                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14972                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14973                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_close.counterparty_node_id.compressed_form);
14974                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
14975                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
14976                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
14977                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
14978                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
14979                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
14980                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
14981                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
14982                         int64_t anchor_descriptor_ref = 0;
14983                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
14984                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
14985                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
14986                         int64_tArray pending_htlcs_arr = NULL;
14987                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
14988                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
14989                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
14990                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
14991                                 int64_t pending_htlcs_conv_24_ref = 0;
14992                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
14993                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
14994                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
14995                         }
14996                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
14997                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, channel_id_ref, counterparty_node_id_arr, 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);
14998                 }
14999                 case LDKBumpTransactionEvent_HTLCResolution: {
15000                         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
15001                         int64_t channel_id_ref = 0;
15002                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15003                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15004                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15005                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->htlc_resolution.counterparty_node_id.compressed_form);
15006                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
15007                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
15008                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
15009                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
15010                         int64_tArray htlc_descriptors_arr = NULL;
15011                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
15012                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
15013                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
15014                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
15015                                 int64_t htlc_descriptors_conv_16_ref = 0;
15016                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
15017                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
15018                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
15019                         }
15020                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
15021                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
15022                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, channel_id_ref, counterparty_node_id_arr, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
15023                 }
15024                 default: abort();
15025         }
15026 }
15027 static jclass LDKEvent_FundingGenerationReady_class = NULL;
15028 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
15029 static jclass LDKEvent_PaymentClaimable_class = NULL;
15030 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
15031 static jclass LDKEvent_PaymentClaimed_class = NULL;
15032 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
15033 static jclass LDKEvent_ConnectionNeeded_class = NULL;
15034 static jmethodID LDKEvent_ConnectionNeeded_meth = NULL;
15035 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
15036 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
15037 static jclass LDKEvent_PaymentSent_class = NULL;
15038 static jmethodID LDKEvent_PaymentSent_meth = NULL;
15039 static jclass LDKEvent_PaymentFailed_class = NULL;
15040 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
15041 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
15042 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
15043 static jclass LDKEvent_PaymentPathFailed_class = NULL;
15044 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
15045 static jclass LDKEvent_ProbeSuccessful_class = NULL;
15046 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
15047 static jclass LDKEvent_ProbeFailed_class = NULL;
15048 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
15049 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
15050 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
15051 static jclass LDKEvent_HTLCIntercepted_class = NULL;
15052 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
15053 static jclass LDKEvent_SpendableOutputs_class = NULL;
15054 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
15055 static jclass LDKEvent_PaymentForwarded_class = NULL;
15056 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
15057 static jclass LDKEvent_ChannelPending_class = NULL;
15058 static jmethodID LDKEvent_ChannelPending_meth = NULL;
15059 static jclass LDKEvent_ChannelReady_class = NULL;
15060 static jmethodID LDKEvent_ChannelReady_meth = NULL;
15061 static jclass LDKEvent_ChannelClosed_class = NULL;
15062 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
15063 static jclass LDKEvent_DiscardFunding_class = NULL;
15064 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
15065 static jclass LDKEvent_OpenChannelRequest_class = NULL;
15066 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
15067 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
15068 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
15069 static jclass LDKEvent_BumpTransaction_class = NULL;
15070 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
15071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
15072         LDKEvent_FundingGenerationReady_class =
15073                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
15074         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
15075         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "(J[BJ[B[B)V");
15076         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
15077         LDKEvent_PaymentClaimable_class =
15078                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
15079         CHECK(LDKEvent_PaymentClaimable_class != NULL);
15080         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
15081         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
15082         LDKEvent_PaymentClaimed_class =
15083                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
15084         CHECK(LDKEvent_PaymentClaimed_class != NULL);
15085         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
15086         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
15087         LDKEvent_ConnectionNeeded_class =
15088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ConnectionNeeded"));
15089         CHECK(LDKEvent_ConnectionNeeded_class != NULL);
15090         LDKEvent_ConnectionNeeded_meth = (*env)->GetMethodID(env, LDKEvent_ConnectionNeeded_class, "<init>", "([B[J)V");
15091         CHECK(LDKEvent_ConnectionNeeded_meth != NULL);
15092         LDKEvent_InvoiceRequestFailed_class =
15093                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
15094         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
15095         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
15096         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
15097         LDKEvent_PaymentSent_class =
15098                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
15099         CHECK(LDKEvent_PaymentSent_class != NULL);
15100         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
15101         CHECK(LDKEvent_PaymentSent_meth != NULL);
15102         LDKEvent_PaymentFailed_class =
15103                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
15104         CHECK(LDKEvent_PaymentFailed_class != NULL);
15105         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
15106         CHECK(LDKEvent_PaymentFailed_meth != NULL);
15107         LDKEvent_PaymentPathSuccessful_class =
15108                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
15109         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
15110         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
15111         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
15112         LDKEvent_PaymentPathFailed_class =
15113                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
15114         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
15115         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
15116         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
15117         LDKEvent_ProbeSuccessful_class =
15118                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
15119         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
15120         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
15121         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
15122         LDKEvent_ProbeFailed_class =
15123                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
15124         CHECK(LDKEvent_ProbeFailed_class != NULL);
15125         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
15126         CHECK(LDKEvent_ProbeFailed_meth != NULL);
15127         LDKEvent_PendingHTLCsForwardable_class =
15128                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
15129         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
15130         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
15131         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
15132         LDKEvent_HTLCIntercepted_class =
15133                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
15134         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
15135         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
15136         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
15137         LDKEvent_SpendableOutputs_class =
15138                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
15139         CHECK(LDKEvent_SpendableOutputs_class != NULL);
15140         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
15141         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
15142         LDKEvent_PaymentForwarded_class =
15143                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
15144         CHECK(LDKEvent_PaymentForwarded_class != NULL);
15145         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJJJJZJ)V");
15146         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
15147         LDKEvent_ChannelPending_class =
15148                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
15149         CHECK(LDKEvent_ChannelPending_class != NULL);
15150         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "(J[BJ[BJJ)V");
15151         CHECK(LDKEvent_ChannelPending_meth != NULL);
15152         LDKEvent_ChannelReady_class =
15153                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
15154         CHECK(LDKEvent_ChannelReady_class != NULL);
15155         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "(J[B[BJ)V");
15156         CHECK(LDKEvent_ChannelReady_meth != NULL);
15157         LDKEvent_ChannelClosed_class =
15158                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
15159         CHECK(LDKEvent_ChannelClosed_class != NULL);
15160         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "(J[BJ[BJJ)V");
15161         CHECK(LDKEvent_ChannelClosed_meth != NULL);
15162         LDKEvent_DiscardFunding_class =
15163                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
15164         CHECK(LDKEvent_DiscardFunding_class != NULL);
15165         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "(J[B)V");
15166         CHECK(LDKEvent_DiscardFunding_meth != NULL);
15167         LDKEvent_OpenChannelRequest_class =
15168                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
15169         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
15170         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "(J[BJJJ)V");
15171         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
15172         LDKEvent_HTLCHandlingFailed_class =
15173                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
15174         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
15175         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "(JJ)V");
15176         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
15177         LDKEvent_BumpTransaction_class =
15178                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
15179         CHECK(LDKEvent_BumpTransaction_class != NULL);
15180         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
15181         CHECK(LDKEvent_BumpTransaction_meth != NULL);
15182 }
15183 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15184         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
15185         switch(obj->tag) {
15186                 case LDKEvent_FundingGenerationReady: {
15187                         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
15188                         int64_t temporary_channel_id_ref = 0;
15189                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
15190                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
15191                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15192                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
15193                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
15194                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
15195                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
15196                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
15197                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15198                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
15199                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_ref, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
15200                 }
15201                 case LDKEvent_PaymentClaimable: {
15202                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
15203                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
15204                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15205                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
15206                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
15207                         int64_t onion_fields_ref = 0;
15208                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
15209                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
15210                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
15211                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
15212                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
15213                         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
15214                         int64_t via_channel_id_ref = 0;
15215                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
15216                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
15217                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
15218                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
15219                         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);
15220                 }
15221                 case LDKEvent_PaymentClaimed: {
15222                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
15223                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
15224                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15225                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
15226                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
15227                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
15228                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
15229                         int64_tArray htlcs_arr = NULL;
15230                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
15231                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
15232                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
15233                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
15234                                 int64_t htlcs_conv_13_ref = 0;
15235                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
15236                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
15237                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
15238                         }
15239                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
15240                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
15241                         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);
15242                 }
15243                 case LDKEvent_ConnectionNeeded: {
15244                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
15245                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->connection_needed.node_id.compressed_form);
15246                         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
15247                         int64_tArray addresses_arr = NULL;
15248                         addresses_arr = (*env)->NewLongArray(env, addresses_var.datalen);
15249                         int64_t *addresses_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, addresses_arr, NULL);
15250                         for (size_t p = 0; p < addresses_var.datalen; p++) {
15251                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
15252                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
15253                         }
15254                         (*env)->ReleasePrimitiveArrayCritical(env, addresses_arr, addresses_arr_ptr, 0);
15255                         return (*env)->NewObject(env, LDKEvent_ConnectionNeeded_class, LDKEvent_ConnectionNeeded_meth, node_id_arr, addresses_arr);
15256                 }
15257                 case LDKEvent_InvoiceRequestFailed: {
15258                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15259                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
15260                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
15261                 }
15262                 case LDKEvent_PaymentSent: {
15263                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
15264                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
15265                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
15266                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15267                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
15268                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
15269                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
15270                 }
15271                 case LDKEvent_PaymentFailed: {
15272                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15273                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
15274                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15275                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
15276                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
15277                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
15278                 }
15279                 case LDKEvent_PaymentPathSuccessful: {
15280                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15281                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
15282                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
15283                         LDKPath path_var = obj->payment_path_successful.path;
15284                         int64_t path_ref = 0;
15285                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15286                         path_ref = tag_ptr(path_var.inner, false);
15287                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
15288                 }
15289                 case LDKEvent_PaymentPathFailed: {
15290                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
15291                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15292                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
15293                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
15294                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
15295                         LDKPath path_var = obj->payment_path_failed.path;
15296                         int64_t path_ref = 0;
15297                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15298                         path_ref = tag_ptr(path_var.inner, false);
15299                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
15300                         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);
15301                 }
15302                 case LDKEvent_ProbeSuccessful: {
15303                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15304                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
15305                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15306                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
15307                         LDKPath path_var = obj->probe_successful.path;
15308                         int64_t path_ref = 0;
15309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15310                         path_ref = tag_ptr(path_var.inner, false);
15311                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
15312                 }
15313                 case LDKEvent_ProbeFailed: {
15314                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15315                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
15316                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15317                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
15318                         LDKPath path_var = obj->probe_failed.path;
15319                         int64_t path_ref = 0;
15320                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15321                         path_ref = tag_ptr(path_var.inner, false);
15322                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
15323                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
15324                 }
15325                 case LDKEvent_PendingHTLCsForwardable: {
15326                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
15327                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
15328                 }
15329                 case LDKEvent_HTLCIntercepted: {
15330                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
15331                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
15332                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
15333                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15334                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
15335                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
15336                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
15337                         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);
15338                 }
15339                 case LDKEvent_SpendableOutputs: {
15340                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
15341                         int64_tArray outputs_arr = NULL;
15342                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
15343                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
15344                         for (size_t b = 0; b < outputs_var.datalen; b++) {
15345                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
15346                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
15347                         }
15348                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
15349                         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
15350                         int64_t channel_id_ref = 0;
15351                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15352                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15353                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
15354                 }
15355                 case LDKEvent_PaymentForwarded: {
15356                         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
15357                         int64_t prev_channel_id_ref = 0;
15358                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
15359                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
15360                         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
15361                         int64_t next_channel_id_ref = 0;
15362                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
15363                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
15364                         int64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
15365                         int64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
15366                         int64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
15367                         int64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
15368                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
15369                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
15370                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, prev_user_channel_id_ref, next_user_channel_id_ref, total_fee_earned_msat_ref, skimmed_fee_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
15371                 }
15372                 case LDKEvent_ChannelPending: {
15373                         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
15374                         int64_t channel_id_ref = 0;
15375                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15376                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15377                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15378                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
15379                         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
15380                         int64_t former_temporary_channel_id_ref = 0;
15381                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
15382                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
15383                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15384                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
15385                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
15386                         int64_t funding_txo_ref = 0;
15387                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
15388                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
15389                         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
15390                         int64_t channel_type_ref = 0;
15391                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15392                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15393                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_ref, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref, channel_type_ref);
15394                 }
15395                 case LDKEvent_ChannelReady: {
15396                         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
15397                         int64_t channel_id_ref = 0;
15398                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15399                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15400                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15401                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
15402                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15403                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
15404                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
15405                         int64_t channel_type_ref = 0;
15406                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15407                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15408                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_ref, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
15409                 }
15410                 case LDKEvent_ChannelClosed: {
15411                         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
15412                         int64_t channel_id_ref = 0;
15413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15414                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15415                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15416                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
15417                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
15418                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15419                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
15420                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
15421                         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
15422                         int64_t channel_funding_txo_ref = 0;
15423                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
15424                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
15425                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_ref, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref, channel_funding_txo_ref);
15426                 }
15427                 case LDKEvent_DiscardFunding: {
15428                         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
15429                         int64_t channel_id_ref = 0;
15430                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15431                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15432                         LDKTransaction transaction_var = obj->discard_funding.transaction;
15433                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
15434                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
15435                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_ref, transaction_arr);
15436                 }
15437                 case LDKEvent_OpenChannelRequest: {
15438                         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
15439                         int64_t temporary_channel_id_ref = 0;
15440                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
15441                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
15442                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15443                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
15444                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
15445                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
15446                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
15447                         int64_t channel_type_ref = 0;
15448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15449                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15450                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_ref, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
15451                 }
15452                 case LDKEvent_HTLCHandlingFailed: {
15453                         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
15454                         int64_t prev_channel_id_ref = 0;
15455                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
15456                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
15457                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
15458                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_ref, failed_next_destination_ref);
15459                 }
15460                 case LDKEvent_BumpTransaction: {
15461                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
15462                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
15463                 }
15464                 default: abort();
15465         }
15466 }
15467 static jclass LDKCOption_EventZ_Some_class = NULL;
15468 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
15469 static jclass LDKCOption_EventZ_None_class = NULL;
15470 static jmethodID LDKCOption_EventZ_None_meth = NULL;
15471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
15472         LDKCOption_EventZ_Some_class =
15473                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
15474         CHECK(LDKCOption_EventZ_Some_class != NULL);
15475         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
15476         CHECK(LDKCOption_EventZ_Some_meth != NULL);
15477         LDKCOption_EventZ_None_class =
15478                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
15479         CHECK(LDKCOption_EventZ_None_class != NULL);
15480         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
15481         CHECK(LDKCOption_EventZ_None_meth != NULL);
15482 }
15483 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15484         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
15485         switch(obj->tag) {
15486                 case LDKCOption_EventZ_Some: {
15487                         int64_t some_ref = tag_ptr(&obj->some, false);
15488                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
15489                 }
15490                 case LDKCOption_EventZ_None: {
15491                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
15492                 }
15493                 default: abort();
15494         }
15495 }
15496 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
15497 CHECK(owner->result_ok);
15498         return COption_EventZ_clone(&*owner->contents.result);
15499 }
15500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15501         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
15502         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15503         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
15504         int64_t ret_ref = tag_ptr(ret_copy, true);
15505         return ret_ref;
15506 }
15507
15508 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
15509 CHECK(!owner->result_ok);
15510         return DecodeError_clone(&*owner->contents.err);
15511 }
15512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15513         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
15514         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15515         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
15516         int64_t ret_ref = tag_ptr(ret_copy, true);
15517         return ret_ref;
15518 }
15519
15520 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
15521 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
15522 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
15523 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
15524 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
15525 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
15526 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
15527 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
15528 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
15529 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
15530 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
15531 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
15532 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
15533 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
15534 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
15535 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
15536 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
15537 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
15538 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
15539 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
15540 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
15541 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
15542 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
15543 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
15544 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
15545 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
15546 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
15547 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
15548 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
15549 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
15550 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
15551 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
15552 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
15553 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
15554 static jclass LDKBolt11ParseError_Skip_class = NULL;
15555 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
15556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
15557         LDKBolt11ParseError_Bech32Error_class =
15558                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
15559         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
15560         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
15561         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
15562         LDKBolt11ParseError_ParseAmountError_class =
15563                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
15564         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
15565         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
15566         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
15567         LDKBolt11ParseError_MalformedSignature_class =
15568                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
15569         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
15570         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
15571         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
15572         LDKBolt11ParseError_BadPrefix_class =
15573                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
15574         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
15575         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
15576         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
15577         LDKBolt11ParseError_UnknownCurrency_class =
15578                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
15579         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
15580         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
15581         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
15582         LDKBolt11ParseError_UnknownSiPrefix_class =
15583                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
15584         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
15585         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
15586         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
15587         LDKBolt11ParseError_MalformedHRP_class =
15588                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
15589         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
15590         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
15591         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
15592         LDKBolt11ParseError_TooShortDataPart_class =
15593                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
15594         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
15595         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
15596         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
15597         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
15598                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
15599         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
15600         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
15601         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
15602         LDKBolt11ParseError_DescriptionDecodeError_class =
15603                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
15604         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
15605         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
15606         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
15607         LDKBolt11ParseError_PaddingError_class =
15608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
15609         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
15610         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
15611         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
15612         LDKBolt11ParseError_IntegerOverflowError_class =
15613                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
15614         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
15615         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
15616         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
15617         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
15618                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
15619         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
15620         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
15621         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
15622         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
15623                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
15624         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
15625         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
15626         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
15627         LDKBolt11ParseError_InvalidScriptHashLength_class =
15628                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
15629         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
15630         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
15631         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
15632         LDKBolt11ParseError_InvalidRecoveryId_class =
15633                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
15634         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
15635         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
15636         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
15637         LDKBolt11ParseError_InvalidSliceLength_class =
15638                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
15639         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
15640         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
15641         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
15642         LDKBolt11ParseError_Skip_class =
15643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
15644         CHECK(LDKBolt11ParseError_Skip_class != NULL);
15645         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
15646         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
15647 }
15648 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15649         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
15650         switch(obj->tag) {
15651                 case LDKBolt11ParseError_Bech32Error: {
15652                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
15653                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
15654                 }
15655                 case LDKBolt11ParseError_ParseAmountError: {
15656                         /*obj->parse_amount_error*/
15657                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
15658                 }
15659                 case LDKBolt11ParseError_MalformedSignature: {
15660                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
15661                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
15662                 }
15663                 case LDKBolt11ParseError_BadPrefix: {
15664                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
15665                 }
15666                 case LDKBolt11ParseError_UnknownCurrency: {
15667                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
15668                 }
15669                 case LDKBolt11ParseError_UnknownSiPrefix: {
15670                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
15671                 }
15672                 case LDKBolt11ParseError_MalformedHRP: {
15673                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
15674                 }
15675                 case LDKBolt11ParseError_TooShortDataPart: {
15676                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
15677                 }
15678                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
15679                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
15680                 }
15681                 case LDKBolt11ParseError_DescriptionDecodeError: {
15682                         /*obj->description_decode_error*/
15683                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
15684                 }
15685                 case LDKBolt11ParseError_PaddingError: {
15686                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
15687                 }
15688                 case LDKBolt11ParseError_IntegerOverflowError: {
15689                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
15690                 }
15691                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
15692                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
15693                 }
15694                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
15695                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
15696                 }
15697                 case LDKBolt11ParseError_InvalidScriptHashLength: {
15698                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
15699                 }
15700                 case LDKBolt11ParseError_InvalidRecoveryId: {
15701                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
15702                 }
15703                 case LDKBolt11ParseError_InvalidSliceLength: {
15704                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
15705                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
15706                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
15707                 }
15708                 case LDKBolt11ParseError_Skip: {
15709                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
15710                 }
15711                 default: abort();
15712         }
15713 }
15714 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
15715 CHECK(owner->result_ok);
15716         return SiPrefix_clone(&*owner->contents.result);
15717 }
15718 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15719         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
15720         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
15721         return ret_conv;
15722 }
15723
15724 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
15725 CHECK(!owner->result_ok);
15726         return Bolt11ParseError_clone(&*owner->contents.err);
15727 }
15728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15729         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
15730         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
15731         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
15732         int64_t ret_ref = tag_ptr(ret_copy, true);
15733         return ret_ref;
15734 }
15735
15736 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
15737 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
15738 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
15739 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
15740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
15741         LDKParseOrSemanticError_ParseError_class =
15742                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
15743         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
15744         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
15745         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
15746         LDKParseOrSemanticError_SemanticError_class =
15747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
15748         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
15749         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
15750         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
15751 }
15752 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15753         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
15754         switch(obj->tag) {
15755                 case LDKParseOrSemanticError_ParseError: {
15756                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
15757                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
15758                 }
15759                 case LDKParseOrSemanticError_SemanticError: {
15760                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
15761                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
15762                 }
15763                 default: abort();
15764         }
15765 }
15766 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
15767         LDKBolt11Invoice ret = *owner->contents.result;
15768         ret.is_owned = false;
15769         return ret;
15770 }
15771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15772         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
15773         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
15774         int64_t ret_ref = 0;
15775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15777         return ret_ref;
15778 }
15779
15780 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
15781 CHECK(!owner->result_ok);
15782         return ParseOrSemanticError_clone(&*owner->contents.err);
15783 }
15784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15785         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
15786         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
15787         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
15788         int64_t ret_ref = tag_ptr(ret_copy, true);
15789         return ret_ref;
15790 }
15791
15792 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
15793         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
15794         ret.is_owned = false;
15795         return ret;
15796 }
15797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15798         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
15799         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
15800         int64_t ret_ref = 0;
15801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15803         return ret_ref;
15804 }
15805
15806 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
15807 CHECK(!owner->result_ok);
15808         return Bolt11ParseError_clone(&*owner->contents.err);
15809 }
15810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15811         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
15812         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
15813         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
15814         int64_t ret_ref = tag_ptr(ret_copy, true);
15815         return ret_ref;
15816 }
15817
15818 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15819         LDKRawBolt11Invoice ret = owner->a;
15820         ret.is_owned = false;
15821         return ret;
15822 }
15823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15824         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15825         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
15826         int64_t ret_ref = 0;
15827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15829         return ret_ref;
15830 }
15831
15832 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15833         return ThirtyTwoBytes_clone(&owner->b);
15834 }
15835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15836         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15837         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15838         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
15839         return ret_arr;
15840 }
15841
15842 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15843         LDKBolt11InvoiceSignature ret = owner->c;
15844         ret.is_owned = false;
15845         return ret;
15846 }
15847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15848         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15849         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
15850         int64_t ret_ref = 0;
15851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15853         return ret_ref;
15854 }
15855
15856 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
15857         LDKPayeePubKey ret = *owner->contents.result;
15858         ret.is_owned = false;
15859         return ret;
15860 }
15861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15862         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
15863         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
15864         int64_t ret_ref = 0;
15865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15867         return ret_ref;
15868 }
15869
15870 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
15871 CHECK(!owner->result_ok);
15872         return *owner->contents.err;
15873 }
15874 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15875         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
15876         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
15877         return ret_conv;
15878 }
15879
15880 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
15881         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
15882         for (size_t i = 0; i < ret.datalen; i++) {
15883                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
15884         }
15885         return ret;
15886 }
15887 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
15888         LDKPositiveTimestamp ret = *owner->contents.result;
15889         ret.is_owned = false;
15890         return ret;
15891 }
15892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15893         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
15894         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
15895         int64_t ret_ref = 0;
15896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15898         return ret_ref;
15899 }
15900
15901 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
15902 CHECK(!owner->result_ok);
15903         return CreationError_clone(&*owner->contents.err);
15904 }
15905 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15906         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
15907         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
15908         return ret_conv;
15909 }
15910
15911 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
15912 CHECK(owner->result_ok);
15913         return *owner->contents.result;
15914 }
15915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15916         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
15917         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
15918 }
15919
15920 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
15921 CHECK(!owner->result_ok);
15922         return Bolt11SemanticError_clone(&*owner->contents.err);
15923 }
15924 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15925         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
15926         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
15927         return ret_conv;
15928 }
15929
15930 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
15931         LDKBolt11Invoice ret = *owner->contents.result;
15932         ret.is_owned = false;
15933         return ret;
15934 }
15935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15936         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
15937         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
15938         int64_t ret_ref = 0;
15939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15941         return ret_ref;
15942 }
15943
15944 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
15945 CHECK(!owner->result_ok);
15946         return Bolt11SemanticError_clone(&*owner->contents.err);
15947 }
15948 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15949         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
15950         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
15951         return ret_conv;
15952 }
15953
15954 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
15955         LDKDescription ret = *owner->contents.result;
15956         ret.is_owned = false;
15957         return ret;
15958 }
15959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15960         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
15961         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
15962         int64_t ret_ref = 0;
15963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15965         return ret_ref;
15966 }
15967
15968 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
15969 CHECK(!owner->result_ok);
15970         return CreationError_clone(&*owner->contents.err);
15971 }
15972 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15973         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
15974         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
15975         return ret_conv;
15976 }
15977
15978 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
15979         LDKPrivateRoute ret = *owner->contents.result;
15980         ret.is_owned = false;
15981         return ret;
15982 }
15983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15984         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
15985         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
15986         int64_t ret_ref = 0;
15987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15989         return ret_ref;
15990 }
15991
15992 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
15993 CHECK(!owner->result_ok);
15994         return CreationError_clone(&*owner->contents.err);
15995 }
15996 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15997         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
15998         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
15999         return ret_conv;
16000 }
16001
16002 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
16003         LDKOutPoint ret = *owner->contents.result;
16004         ret.is_owned = false;
16005         return ret;
16006 }
16007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16008         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
16009         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
16010         int64_t ret_ref = 0;
16011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16013         return ret_ref;
16014 }
16015
16016 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
16017 CHECK(!owner->result_ok);
16018         return DecodeError_clone(&*owner->contents.err);
16019 }
16020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16021         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
16022         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16023         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
16024         int64_t ret_ref = tag_ptr(ret_copy, true);
16025         return ret_ref;
16026 }
16027
16028 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
16029         LDKBigSize ret = *owner->contents.result;
16030         ret.is_owned = false;
16031         return ret;
16032 }
16033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16034         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
16035         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
16036         int64_t ret_ref = 0;
16037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16039         return ret_ref;
16040 }
16041
16042 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
16043 CHECK(!owner->result_ok);
16044         return DecodeError_clone(&*owner->contents.err);
16045 }
16046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16047         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
16048         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16049         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
16050         int64_t ret_ref = tag_ptr(ret_copy, true);
16051         return ret_ref;
16052 }
16053
16054 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
16055         LDKHostname ret = *owner->contents.result;
16056         ret.is_owned = false;
16057         return ret;
16058 }
16059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16060         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
16061         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
16062         int64_t ret_ref = 0;
16063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16065         return ret_ref;
16066 }
16067
16068 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
16069 CHECK(!owner->result_ok);
16070         return DecodeError_clone(&*owner->contents.err);
16071 }
16072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16073         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
16074         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16075         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
16076         int64_t ret_ref = tag_ptr(ret_copy, true);
16077         return ret_ref;
16078 }
16079
16080 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
16081         LDKTransactionU16LenLimited ret = *owner->contents.result;
16082         ret.is_owned = false;
16083         return ret;
16084 }
16085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16086         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
16087         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
16088         int64_t ret_ref = 0;
16089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16091         return ret_ref;
16092 }
16093
16094 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
16095 CHECK(!owner->result_ok);
16096         return *owner->contents.err;
16097 }
16098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16099         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
16100         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
16101 }
16102
16103 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
16104         LDKTransactionU16LenLimited ret = *owner->contents.result;
16105         ret.is_owned = false;
16106         return ret;
16107 }
16108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16109         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
16110         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
16111         int64_t ret_ref = 0;
16112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16114         return ret_ref;
16115 }
16116
16117 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
16118 CHECK(!owner->result_ok);
16119         return DecodeError_clone(&*owner->contents.err);
16120 }
16121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16122         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
16123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16124         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
16125         int64_t ret_ref = tag_ptr(ret_copy, true);
16126         return ret_ref;
16127 }
16128
16129 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
16130         LDKUntrustedString ret = *owner->contents.result;
16131         ret.is_owned = false;
16132         return ret;
16133 }
16134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16135         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
16136         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
16137         int64_t ret_ref = 0;
16138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16140         return ret_ref;
16141 }
16142
16143 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
16144 CHECK(!owner->result_ok);
16145         return DecodeError_clone(&*owner->contents.err);
16146 }
16147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16148         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
16149         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16150         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
16151         int64_t ret_ref = tag_ptr(ret_copy, true);
16152         return ret_ref;
16153 }
16154
16155 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
16156         LDKChannelId ret = *owner->contents.result;
16157         ret.is_owned = false;
16158         return ret;
16159 }
16160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16161         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
16162         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
16163         int64_t ret_ref = 0;
16164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16166         return ret_ref;
16167 }
16168
16169 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
16170 CHECK(!owner->result_ok);
16171         return DecodeError_clone(&*owner->contents.err);
16172 }
16173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16174         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
16175         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16176         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
16177         int64_t ret_ref = tag_ptr(ret_copy, true);
16178         return ret_ref;
16179 }
16180
16181 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
16182         return ThirtyTwoBytes_clone(&owner->a);
16183 }
16184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16185         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
16186         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple__u832u16Z_get_a(owner_conv).data);
16188         return ret_arr;
16189 }
16190
16191 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
16192         return owner->b;
16193 }
16194 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16195         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
16196         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
16197         return ret_conv;
16198 }
16199
16200 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
16201         LDKPaymentRelay ret = *owner->contents.result;
16202         ret.is_owned = false;
16203         return ret;
16204 }
16205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16206         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
16207         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
16208         int64_t ret_ref = 0;
16209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16211         return ret_ref;
16212 }
16213
16214 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
16215 CHECK(!owner->result_ok);
16216         return DecodeError_clone(&*owner->contents.err);
16217 }
16218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16219         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
16220         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16221         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
16222         int64_t ret_ref = tag_ptr(ret_copy, true);
16223         return ret_ref;
16224 }
16225
16226 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
16227         LDKPaymentConstraints ret = *owner->contents.result;
16228         ret.is_owned = false;
16229         return ret;
16230 }
16231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16232         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
16233         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
16234         int64_t ret_ref = 0;
16235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16237         return ret_ref;
16238 }
16239
16240 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
16241 CHECK(!owner->result_ok);
16242         return DecodeError_clone(&*owner->contents.err);
16243 }
16244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16245         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
16246         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16247         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
16248         int64_t ret_ref = tag_ptr(ret_copy, true);
16249         return ret_ref;
16250 }
16251
16252 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
16253 CHECK(owner->result_ok);
16254         return PaymentContext_clone(&*owner->contents.result);
16255 }
16256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16257         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
16258         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
16259         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
16260         int64_t ret_ref = tag_ptr(ret_copy, true);
16261         return ret_ref;
16262 }
16263
16264 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
16265 CHECK(!owner->result_ok);
16266         return DecodeError_clone(&*owner->contents.err);
16267 }
16268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16269         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
16270         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16271         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
16272         int64_t ret_ref = tag_ptr(ret_copy, true);
16273         return ret_ref;
16274 }
16275
16276 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
16277         LDKUnknownPaymentContext ret = *owner->contents.result;
16278         ret.is_owned = false;
16279         return ret;
16280 }
16281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16282         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
16283         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
16284         int64_t ret_ref = 0;
16285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16287         return ret_ref;
16288 }
16289
16290 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
16291 CHECK(!owner->result_ok);
16292         return DecodeError_clone(&*owner->contents.err);
16293 }
16294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16295         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
16296         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16297         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
16298         int64_t ret_ref = tag_ptr(ret_copy, true);
16299         return ret_ref;
16300 }
16301
16302 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
16303         LDKBolt12OfferContext ret = *owner->contents.result;
16304         ret.is_owned = false;
16305         return ret;
16306 }
16307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16308         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
16309         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
16310         int64_t ret_ref = 0;
16311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16313         return ret_ref;
16314 }
16315
16316 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
16317 CHECK(!owner->result_ok);
16318         return DecodeError_clone(&*owner->contents.err);
16319 }
16320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16321         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
16322         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16323         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
16324         int64_t ret_ref = tag_ptr(ret_copy, true);
16325         return ret_ref;
16326 }
16327
16328 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
16329         LDKBolt12RefundContext ret = *owner->contents.result;
16330         ret.is_owned = false;
16331         return ret;
16332 }
16333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16334         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
16335         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
16336         int64_t ret_ref = 0;
16337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16339         return ret_ref;
16340 }
16341
16342 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
16343 CHECK(!owner->result_ok);
16344         return DecodeError_clone(&*owner->contents.err);
16345 }
16346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16347         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
16348         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16349         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
16350         int64_t ret_ref = tag_ptr(ret_copy, true);
16351         return ret_ref;
16352 }
16353
16354 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
16355 CHECK(owner->result_ok);
16356         return *owner->contents.result;
16357 }
16358 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16359         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
16360         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
16361         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16362         return ret_conv;
16363 }
16364
16365 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
16366 CHECK(!owner->result_ok);
16367         return *owner->contents.err;
16368 }
16369 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16370         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
16371         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
16372         return ret_conv;
16373 }
16374
16375 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16376         return ThirtyTwoBytes_clone(&owner->a);
16377 }
16378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16379         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16380         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16381         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data);
16382         return ret_arr;
16383 }
16384
16385 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16386         LDKRecipientOnionFields ret = owner->b;
16387         ret.is_owned = false;
16388         return ret;
16389 }
16390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16391         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16392         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
16393         int64_t ret_ref = 0;
16394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16396         return ret_ref;
16397 }
16398
16399 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16400         LDKRouteParameters ret = owner->c;
16401         ret.is_owned = false;
16402         return ret;
16403 }
16404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
16405         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16406         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
16407         int64_t ret_ref = 0;
16408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16410         return ret_ref;
16411 }
16412
16413 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
16414 CHECK(owner->result_ok);
16415         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
16416 }
16417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16418         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
16419         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
16420         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
16421         return tag_ptr(ret_conv, true);
16422 }
16423
16424 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
16425 CHECK(!owner->result_ok);
16426         return *owner->contents.err;
16427 }
16428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16429         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
16430         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
16431 }
16432
16433 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16434         return owner->a;
16435 }
16436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16437         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16438         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form);
16440         return ret_arr;
16441 }
16442
16443 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16444         LDKOnionMessage ret = owner->b;
16445         ret.is_owned = false;
16446         return ret;
16447 }
16448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16449         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16450         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
16451         int64_t ret_ref = 0;
16452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16454         return ret_ref;
16455 }
16456
16457 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16458         return COption_CVec_SocketAddressZZ_clone(&owner->c);
16459 }
16460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
16461         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16462         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
16463         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
16464         int64_t ret_ref = tag_ptr(ret_copy, true);
16465         return ret_ref;
16466 }
16467
16468 static jclass LDKSendError_Secp256k1_class = NULL;
16469 static jmethodID LDKSendError_Secp256k1_meth = NULL;
16470 static jclass LDKSendError_TooBigPacket_class = NULL;
16471 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
16472 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
16473 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
16474 static jclass LDKSendError_InvalidFirstHop_class = NULL;
16475 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
16476 static jclass LDKSendError_PathNotFound_class = NULL;
16477 static jmethodID LDKSendError_PathNotFound_meth = NULL;
16478 static jclass LDKSendError_InvalidMessage_class = NULL;
16479 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
16480 static jclass LDKSendError_BufferFull_class = NULL;
16481 static jmethodID LDKSendError_BufferFull_meth = NULL;
16482 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
16483 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
16484 static jclass LDKSendError_UnresolvedIntroductionNode_class = NULL;
16485 static jmethodID LDKSendError_UnresolvedIntroductionNode_meth = NULL;
16486 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
16487 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
16488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
16489         LDKSendError_Secp256k1_class =
16490                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
16491         CHECK(LDKSendError_Secp256k1_class != NULL);
16492         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
16493         CHECK(LDKSendError_Secp256k1_meth != NULL);
16494         LDKSendError_TooBigPacket_class =
16495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
16496         CHECK(LDKSendError_TooBigPacket_class != NULL);
16497         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
16498         CHECK(LDKSendError_TooBigPacket_meth != NULL);
16499         LDKSendError_TooFewBlindedHops_class =
16500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
16501         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
16502         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
16503         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
16504         LDKSendError_InvalidFirstHop_class =
16505                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
16506         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
16507         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "([B)V");
16508         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
16509         LDKSendError_PathNotFound_class =
16510                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$PathNotFound"));
16511         CHECK(LDKSendError_PathNotFound_class != NULL);
16512         LDKSendError_PathNotFound_meth = (*env)->GetMethodID(env, LDKSendError_PathNotFound_class, "<init>", "()V");
16513         CHECK(LDKSendError_PathNotFound_meth != NULL);
16514         LDKSendError_InvalidMessage_class =
16515                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
16516         CHECK(LDKSendError_InvalidMessage_class != NULL);
16517         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
16518         CHECK(LDKSendError_InvalidMessage_meth != NULL);
16519         LDKSendError_BufferFull_class =
16520                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
16521         CHECK(LDKSendError_BufferFull_class != NULL);
16522         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
16523         CHECK(LDKSendError_BufferFull_meth != NULL);
16524         LDKSendError_GetNodeIdFailed_class =
16525                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
16526         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
16527         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
16528         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
16529         LDKSendError_UnresolvedIntroductionNode_class =
16530                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$UnresolvedIntroductionNode"));
16531         CHECK(LDKSendError_UnresolvedIntroductionNode_class != NULL);
16532         LDKSendError_UnresolvedIntroductionNode_meth = (*env)->GetMethodID(env, LDKSendError_UnresolvedIntroductionNode_class, "<init>", "()V");
16533         CHECK(LDKSendError_UnresolvedIntroductionNode_meth != NULL);
16534         LDKSendError_BlindedPathAdvanceFailed_class =
16535                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
16536         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
16537         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
16538         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
16539 }
16540 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16541         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
16542         switch(obj->tag) {
16543                 case LDKSendError_Secp256k1: {
16544                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
16545                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
16546                 }
16547                 case LDKSendError_TooBigPacket: {
16548                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
16549                 }
16550                 case LDKSendError_TooFewBlindedHops: {
16551                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
16552                 }
16553                 case LDKSendError_InvalidFirstHop: {
16554                         int8_tArray invalid_first_hop_arr = (*env)->NewByteArray(env, 33);
16555                         (*env)->SetByteArrayRegion(env, invalid_first_hop_arr, 0, 33, obj->invalid_first_hop.compressed_form);
16556                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth, invalid_first_hop_arr);
16557                 }
16558                 case LDKSendError_PathNotFound: {
16559                         return (*env)->NewObject(env, LDKSendError_PathNotFound_class, LDKSendError_PathNotFound_meth);
16560                 }
16561                 case LDKSendError_InvalidMessage: {
16562                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
16563                 }
16564                 case LDKSendError_BufferFull: {
16565                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
16566                 }
16567                 case LDKSendError_GetNodeIdFailed: {
16568                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
16569                 }
16570                 case LDKSendError_UnresolvedIntroductionNode: {
16571                         return (*env)->NewObject(env, LDKSendError_UnresolvedIntroductionNode_class, LDKSendError_UnresolvedIntroductionNode_meth);
16572                 }
16573                 case LDKSendError_BlindedPathAdvanceFailed: {
16574                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
16575                 }
16576                 default: abort();
16577         }
16578 }
16579 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
16580 CHECK(owner->result_ok);
16581         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
16582 }
16583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16584         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
16585         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
16586         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
16587         return tag_ptr(ret_conv, true);
16588 }
16589
16590 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
16591 CHECK(!owner->result_ok);
16592         return SendError_clone(&*owner->contents.err);
16593 }
16594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16595         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
16596         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
16597         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
16598         int64_t ret_ref = tag_ptr(ret_copy, true);
16599         return ret_ref;
16600 }
16601
16602 static jclass LDKNextMessageHop_NodeId_class = NULL;
16603 static jmethodID LDKNextMessageHop_NodeId_meth = NULL;
16604 static jclass LDKNextMessageHop_ShortChannelId_class = NULL;
16605 static jmethodID LDKNextMessageHop_ShortChannelId_meth = NULL;
16606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNextMessageHop_init (JNIEnv *env, jclass clz) {
16607         LDKNextMessageHop_NodeId_class =
16608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNextMessageHop$NodeId"));
16609         CHECK(LDKNextMessageHop_NodeId_class != NULL);
16610         LDKNextMessageHop_NodeId_meth = (*env)->GetMethodID(env, LDKNextMessageHop_NodeId_class, "<init>", "([B)V");
16611         CHECK(LDKNextMessageHop_NodeId_meth != NULL);
16612         LDKNextMessageHop_ShortChannelId_class =
16613                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNextMessageHop$ShortChannelId"));
16614         CHECK(LDKNextMessageHop_ShortChannelId_class != NULL);
16615         LDKNextMessageHop_ShortChannelId_meth = (*env)->GetMethodID(env, LDKNextMessageHop_ShortChannelId_class, "<init>", "(J)V");
16616         CHECK(LDKNextMessageHop_ShortChannelId_meth != NULL);
16617 }
16618 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNextMessageHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16619         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
16620         switch(obj->tag) {
16621                 case LDKNextMessageHop_NodeId: {
16622                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
16623                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_id.compressed_form);
16624                         return (*env)->NewObject(env, LDKNextMessageHop_NodeId_class, LDKNextMessageHop_NodeId_meth, node_id_arr);
16625                 }
16626                 case LDKNextMessageHop_ShortChannelId: {
16627                         int64_t short_channel_id_conv = obj->short_channel_id;
16628                         return (*env)->NewObject(env, LDKNextMessageHop_ShortChannelId_class, LDKNextMessageHop_ShortChannelId_meth, short_channel_id_conv);
16629                 }
16630                 default: abort();
16631         }
16632 }
16633 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
16634 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
16635 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
16636 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
16637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
16638         LDKParsedOnionMessageContents_Offers_class =
16639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
16640         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
16641         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
16642         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
16643         LDKParsedOnionMessageContents_Custom_class =
16644                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
16645         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
16646         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
16647         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
16648 }
16649 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16650         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
16651         switch(obj->tag) {
16652                 case LDKParsedOnionMessageContents_Offers: {
16653                         int64_t offers_ref = tag_ptr(&obj->offers, false);
16654                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
16655                 }
16656                 case LDKParsedOnionMessageContents_Custom: {
16657                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
16658                         *custom_ret = OnionMessageContents_clone(&obj->custom);
16659                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
16660                 }
16661                 default: abort();
16662         }
16663 }
16664 static jclass LDKPeeledOnion_Forward_class = NULL;
16665 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
16666 static jclass LDKPeeledOnion_Receive_class = NULL;
16667 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
16668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
16669         LDKPeeledOnion_Forward_class =
16670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
16671         CHECK(LDKPeeledOnion_Forward_class != NULL);
16672         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "(JJ)V");
16673         CHECK(LDKPeeledOnion_Forward_meth != NULL);
16674         LDKPeeledOnion_Receive_class =
16675                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
16676         CHECK(LDKPeeledOnion_Receive_class != NULL);
16677         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
16678         CHECK(LDKPeeledOnion_Receive_meth != NULL);
16679 }
16680 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16681         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
16682         switch(obj->tag) {
16683                 case LDKPeeledOnion_Forward: {
16684                         int64_t _0_ref = tag_ptr(&obj->forward._0, false);
16685                         LDKOnionMessage _1_var = obj->forward._1;
16686                         int64_t _1_ref = 0;
16687                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
16688                         _1_ref = tag_ptr(_1_var.inner, false);
16689                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_ref, _1_ref);
16690                 }
16691                 case LDKPeeledOnion_Receive: {
16692                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
16693                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
16694                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
16695                         LDKBlindedPath _2_var = obj->receive._2;
16696                         int64_t _2_ref = 0;
16697                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
16698                         _2_ref = tag_ptr(_2_var.inner, false);
16699                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
16700                 }
16701                 default: abort();
16702         }
16703 }
16704 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
16705 CHECK(owner->result_ok);
16706         return PeeledOnion_clone(&*owner->contents.result);
16707 }
16708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16709         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
16710         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
16711         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
16712         int64_t ret_ref = tag_ptr(ret_copy, true);
16713         return ret_ref;
16714 }
16715
16716 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
16717 CHECK(!owner->result_ok);
16718         return *owner->contents.err;
16719 }
16720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16721         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
16722         CResult_PeeledOnionNoneZ_get_err(owner_conv);
16723 }
16724
16725 static jclass LDKSendSuccess_Buffered_class = NULL;
16726 static jmethodID LDKSendSuccess_Buffered_meth = NULL;
16727 static jclass LDKSendSuccess_BufferedAwaitingConnection_class = NULL;
16728 static jmethodID LDKSendSuccess_BufferedAwaitingConnection_meth = NULL;
16729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendSuccess_init (JNIEnv *env, jclass clz) {
16730         LDKSendSuccess_Buffered_class =
16731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$Buffered"));
16732         CHECK(LDKSendSuccess_Buffered_class != NULL);
16733         LDKSendSuccess_Buffered_meth = (*env)->GetMethodID(env, LDKSendSuccess_Buffered_class, "<init>", "()V");
16734         CHECK(LDKSendSuccess_Buffered_meth != NULL);
16735         LDKSendSuccess_BufferedAwaitingConnection_class =
16736                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$BufferedAwaitingConnection"));
16737         CHECK(LDKSendSuccess_BufferedAwaitingConnection_class != NULL);
16738         LDKSendSuccess_BufferedAwaitingConnection_meth = (*env)->GetMethodID(env, LDKSendSuccess_BufferedAwaitingConnection_class, "<init>", "([B)V");
16739         CHECK(LDKSendSuccess_BufferedAwaitingConnection_meth != NULL);
16740 }
16741 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendSuccess_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16742         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
16743         switch(obj->tag) {
16744                 case LDKSendSuccess_Buffered: {
16745                         return (*env)->NewObject(env, LDKSendSuccess_Buffered_class, LDKSendSuccess_Buffered_meth);
16746                 }
16747                 case LDKSendSuccess_BufferedAwaitingConnection: {
16748                         int8_tArray buffered_awaiting_connection_arr = (*env)->NewByteArray(env, 33);
16749                         (*env)->SetByteArrayRegion(env, buffered_awaiting_connection_arr, 0, 33, obj->buffered_awaiting_connection.compressed_form);
16750                         return (*env)->NewObject(env, LDKSendSuccess_BufferedAwaitingConnection_class, LDKSendSuccess_BufferedAwaitingConnection_meth, buffered_awaiting_connection_arr);
16751                 }
16752                 default: abort();
16753         }
16754 }
16755 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
16756 CHECK(owner->result_ok);
16757         return SendSuccess_clone(&*owner->contents.result);
16758 }
16759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16760         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
16761         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
16762         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
16763         int64_t ret_ref = tag_ptr(ret_copy, true);
16764         return ret_ref;
16765 }
16766
16767 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
16768 CHECK(!owner->result_ok);
16769         return SendError_clone(&*owner->contents.err);
16770 }
16771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16772         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
16773         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
16774         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
16775         int64_t ret_ref = tag_ptr(ret_copy, true);
16776         return ret_ref;
16777 }
16778
16779 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
16780         LDKBlindedPath ret = *owner->contents.result;
16781         ret.is_owned = false;
16782         return ret;
16783 }
16784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16785         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
16786         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
16787         int64_t ret_ref = 0;
16788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16790         return ret_ref;
16791 }
16792
16793 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
16794 CHECK(!owner->result_ok);
16795         return *owner->contents.err;
16796 }
16797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16798         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
16799         CResult_BlindedPathNoneZ_get_err(owner_conv);
16800 }
16801
16802 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
16803 CHECK(owner->result_ok);
16804         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
16805 }
16806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16807         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
16808         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
16809         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
16810         return tag_ptr(ret_conv, true);
16811 }
16812
16813 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
16814 CHECK(!owner->result_ok);
16815         return *owner->contents.err;
16816 }
16817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16818         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
16819         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
16820 }
16821
16822 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
16823         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
16824         for (size_t i = 0; i < ret.datalen; i++) {
16825                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
16826         }
16827         return ret;
16828 }
16829 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
16830         LDKBlindedPath ret = *owner->contents.result;
16831         ret.is_owned = false;
16832         return ret;
16833 }
16834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16835         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
16836         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
16837         int64_t ret_ref = 0;
16838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16840         return ret_ref;
16841 }
16842
16843 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
16844 CHECK(!owner->result_ok);
16845         return DecodeError_clone(&*owner->contents.err);
16846 }
16847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16848         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
16849         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16850         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
16851         int64_t ret_ref = tag_ptr(ret_copy, true);
16852         return ret_ref;
16853 }
16854
16855 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
16856         LDKBlindedHop ret = *owner->contents.result;
16857         ret.is_owned = false;
16858         return ret;
16859 }
16860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16861         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
16862         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
16863         int64_t ret_ref = 0;
16864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16866         return ret_ref;
16867 }
16868
16869 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
16870 CHECK(!owner->result_ok);
16871         return DecodeError_clone(&*owner->contents.err);
16872 }
16873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16874         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
16875         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16876         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
16877         int64_t ret_ref = tag_ptr(ret_copy, true);
16878         return ret_ref;
16879 }
16880
16881 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
16882         LDKInvoiceError ret = *owner->contents.result;
16883         ret.is_owned = false;
16884         return ret;
16885 }
16886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16887         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
16888         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
16889         int64_t ret_ref = 0;
16890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16892         return ret_ref;
16893 }
16894
16895 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
16896 CHECK(!owner->result_ok);
16897         return DecodeError_clone(&*owner->contents.err);
16898 }
16899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16900         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
16901         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16902         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
16903         int64_t ret_ref = tag_ptr(ret_copy, true);
16904         return ret_ref;
16905 }
16906
16907 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
16908         LDKTrackedSpendableOutput ret = *owner->contents.result;
16909         ret.is_owned = false;
16910         return ret;
16911 }
16912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16913         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
16914         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
16915         int64_t ret_ref = 0;
16916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16918         return ret_ref;
16919 }
16920
16921 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
16922 CHECK(!owner->result_ok);
16923         return DecodeError_clone(&*owner->contents.err);
16924 }
16925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16926         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
16927         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16928         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
16929         int64_t ret_ref = tag_ptr(ret_copy, true);
16930         return ret_ref;
16931 }
16932
16933 static jclass LDKOutputSpendStatus_PendingInitialBroadcast_class = NULL;
16934 static jmethodID LDKOutputSpendStatus_PendingInitialBroadcast_meth = NULL;
16935 static jclass LDKOutputSpendStatus_PendingFirstConfirmation_class = NULL;
16936 static jmethodID LDKOutputSpendStatus_PendingFirstConfirmation_meth = NULL;
16937 static jclass LDKOutputSpendStatus_PendingThresholdConfirmations_class = NULL;
16938 static jmethodID LDKOutputSpendStatus_PendingThresholdConfirmations_meth = NULL;
16939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOutputSpendStatus_init (JNIEnv *env, jclass clz) {
16940         LDKOutputSpendStatus_PendingInitialBroadcast_class =
16941                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingInitialBroadcast"));
16942         CHECK(LDKOutputSpendStatus_PendingInitialBroadcast_class != NULL);
16943         LDKOutputSpendStatus_PendingInitialBroadcast_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingInitialBroadcast_class, "<init>", "(J)V");
16944         CHECK(LDKOutputSpendStatus_PendingInitialBroadcast_meth != NULL);
16945         LDKOutputSpendStatus_PendingFirstConfirmation_class =
16946                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingFirstConfirmation"));
16947         CHECK(LDKOutputSpendStatus_PendingFirstConfirmation_class != NULL);
16948         LDKOutputSpendStatus_PendingFirstConfirmation_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingFirstConfirmation_class, "<init>", "([BI[B)V");
16949         CHECK(LDKOutputSpendStatus_PendingFirstConfirmation_meth != NULL);
16950         LDKOutputSpendStatus_PendingThresholdConfirmations_class =
16951                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingThresholdConfirmations"));
16952         CHECK(LDKOutputSpendStatus_PendingThresholdConfirmations_class != NULL);
16953         LDKOutputSpendStatus_PendingThresholdConfirmations_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingThresholdConfirmations_class, "<init>", "([BI[BI[B)V");
16954         CHECK(LDKOutputSpendStatus_PendingThresholdConfirmations_meth != NULL);
16955 }
16956 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOutputSpendStatus_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16957         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
16958         switch(obj->tag) {
16959                 case LDKOutputSpendStatus_PendingInitialBroadcast: {
16960                         int64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
16961                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingInitialBroadcast_class, LDKOutputSpendStatus_PendingInitialBroadcast_meth, delayed_until_height_ref);
16962                 }
16963                 case LDKOutputSpendStatus_PendingFirstConfirmation: {
16964                         int8_tArray first_broadcast_hash_arr = (*env)->NewByteArray(env, 32);
16965                         (*env)->SetByteArrayRegion(env, first_broadcast_hash_arr, 0, 32, obj->pending_first_confirmation.first_broadcast_hash.data);
16966                         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
16967                         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
16968                         int8_tArray latest_spending_tx_arr = (*env)->NewByteArray(env, latest_spending_tx_var.datalen);
16969                         (*env)->SetByteArrayRegion(env, latest_spending_tx_arr, 0, latest_spending_tx_var.datalen, latest_spending_tx_var.data);
16970                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingFirstConfirmation_class, LDKOutputSpendStatus_PendingFirstConfirmation_meth, first_broadcast_hash_arr, latest_broadcast_height_conv, latest_spending_tx_arr);
16971                 }
16972                 case LDKOutputSpendStatus_PendingThresholdConfirmations: {
16973                         int8_tArray first_broadcast_hash_arr = (*env)->NewByteArray(env, 32);
16974                         (*env)->SetByteArrayRegion(env, first_broadcast_hash_arr, 0, 32, obj->pending_threshold_confirmations.first_broadcast_hash.data);
16975                         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
16976                         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
16977                         int8_tArray latest_spending_tx_arr = (*env)->NewByteArray(env, latest_spending_tx_var.datalen);
16978                         (*env)->SetByteArrayRegion(env, latest_spending_tx_arr, 0, latest_spending_tx_var.datalen, latest_spending_tx_var.data);
16979                         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
16980                         int8_tArray confirmation_hash_arr = (*env)->NewByteArray(env, 32);
16981                         (*env)->SetByteArrayRegion(env, confirmation_hash_arr, 0, 32, obj->pending_threshold_confirmations.confirmation_hash.data);
16982                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingThresholdConfirmations_class, LDKOutputSpendStatus_PendingThresholdConfirmations_meth, first_broadcast_hash_arr, latest_broadcast_height_conv, latest_spending_tx_arr, confirmation_height_conv, confirmation_hash_arr);
16983                 }
16984                 default: abort();
16985         }
16986 }
16987 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
16988 CHECK(owner->result_ok);
16989         return OutputSpendStatus_clone(&*owner->contents.result);
16990 }
16991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16992         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
16993         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
16994         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
16995         int64_t ret_ref = tag_ptr(ret_copy, true);
16996         return ret_ref;
16997 }
16998
16999 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
17000 CHECK(!owner->result_ok);
17001         return DecodeError_clone(&*owner->contents.err);
17002 }
17003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17004         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
17005         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17006         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
17007         int64_t ret_ref = tag_ptr(ret_copy, true);
17008         return ret_ref;
17009 }
17010
17011 typedef struct LDKFilter_JCalls {
17012         atomic_size_t refcnt;
17013         JavaVM *vm;
17014         jweak o;
17015         jmethodID register_tx_meth;
17016         jmethodID register_output_meth;
17017 } LDKFilter_JCalls;
17018 static void LDKFilter_JCalls_free(void* this_arg) {
17019         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
17020         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17021                 JNIEnv *env;
17022                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17023                 if (get_jenv_res == JNI_EDETACHED) {
17024                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17025                 } else {
17026                         DO_ASSERT(get_jenv_res == JNI_OK);
17027                 }
17028                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17029                 if (get_jenv_res == JNI_EDETACHED) {
17030                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17031                 }
17032                 FREE(j_calls);
17033         }
17034 }
17035 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
17036         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
17037         JNIEnv *env;
17038         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17039         if (get_jenv_res == JNI_EDETACHED) {
17040                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17041         } else {
17042                 DO_ASSERT(get_jenv_res == JNI_OK);
17043         }
17044         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
17045         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
17046         LDKu8slice script_pubkey_var = script_pubkey;
17047         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
17048         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
17049         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17050         CHECK(obj != NULL);
17051         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
17052         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17053                 (*env)->ExceptionDescribe(env);
17054                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
17055         }
17056         if (get_jenv_res == JNI_EDETACHED) {
17057                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17058         }
17059 }
17060 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
17061         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
17062         JNIEnv *env;
17063         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17064         if (get_jenv_res == JNI_EDETACHED) {
17065                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17066         } else {
17067                 DO_ASSERT(get_jenv_res == JNI_OK);
17068         }
17069         LDKWatchedOutput output_var = output;
17070         int64_t output_ref = 0;
17071         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
17072         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
17073         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17074         CHECK(obj != NULL);
17075         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
17076         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17077                 (*env)->ExceptionDescribe(env);
17078                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
17079         }
17080         if (get_jenv_res == JNI_EDETACHED) {
17081                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17082         }
17083 }
17084 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
17085         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
17086         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17087 }
17088 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
17089         jclass c = (*env)->GetObjectClass(env, o);
17090         CHECK(c != NULL);
17091         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
17092         atomic_init(&calls->refcnt, 1);
17093         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17094         calls->o = (*env)->NewWeakGlobalRef(env, o);
17095         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
17096         CHECK(calls->register_tx_meth != NULL);
17097         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
17098         CHECK(calls->register_output_meth != NULL);
17099
17100         LDKFilter ret = {
17101                 .this_arg = (void*) calls,
17102                 .register_tx = register_tx_LDKFilter_jcall,
17103                 .register_output = register_output_LDKFilter_jcall,
17104                 .free = LDKFilter_JCalls_free,
17105         };
17106         return ret;
17107 }
17108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
17109         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
17110         *res_ptr = LDKFilter_init(env, clz, o);
17111         return tag_ptr(res_ptr, true);
17112 }
17113 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) {
17114         void* this_arg_ptr = untag_ptr(this_arg);
17115         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17116         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
17117         uint8_t txid_arr[32];
17118         CHECK((*env)->GetArrayLength(env, txid) == 32);
17119         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
17120         uint8_t (*txid_ref)[32] = &txid_arr;
17121         LDKu8slice script_pubkey_ref;
17122         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
17123         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
17124         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
17125         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
17126 }
17127
17128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
17129         void* this_arg_ptr = untag_ptr(this_arg);
17130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17131         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
17132         LDKWatchedOutput output_conv;
17133         output_conv.inner = untag_ptr(output);
17134         output_conv.is_owned = ptr_is_owned(output);
17135         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
17136         output_conv = WatchedOutput_clone(&output_conv);
17137         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
17138 }
17139
17140 static jclass LDKCOption_FilterZ_Some_class = NULL;
17141 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
17142 static jclass LDKCOption_FilterZ_None_class = NULL;
17143 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
17144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
17145         LDKCOption_FilterZ_Some_class =
17146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
17147         CHECK(LDKCOption_FilterZ_Some_class != NULL);
17148         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
17149         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
17150         LDKCOption_FilterZ_None_class =
17151                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
17152         CHECK(LDKCOption_FilterZ_None_class != NULL);
17153         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
17154         CHECK(LDKCOption_FilterZ_None_meth != NULL);
17155 }
17156 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
17157         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
17158         switch(obj->tag) {
17159                 case LDKCOption_FilterZ_Some: {
17160                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
17161                         *some_ret = obj->some;
17162                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
17163                         if ((*some_ret).free == LDKFilter_JCalls_free) {
17164                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17165                                 LDKFilter_JCalls_cloned(&(*some_ret));
17166                         }
17167                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
17168                 }
17169                 case LDKCOption_FilterZ_None: {
17170                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
17171                 }
17172                 default: abort();
17173         }
17174 }
17175 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
17176         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
17177         for (size_t i = 0; i < ret.datalen; i++) {
17178                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
17179         }
17180         return ret;
17181 }
17182 typedef struct LDKChangeDestinationSource_JCalls {
17183         atomic_size_t refcnt;
17184         JavaVM *vm;
17185         jweak o;
17186         jmethodID get_change_destination_script_meth;
17187 } LDKChangeDestinationSource_JCalls;
17188 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
17189         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
17190         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17191                 JNIEnv *env;
17192                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17193                 if (get_jenv_res == JNI_EDETACHED) {
17194                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17195                 } else {
17196                         DO_ASSERT(get_jenv_res == JNI_OK);
17197                 }
17198                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17199                 if (get_jenv_res == JNI_EDETACHED) {
17200                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17201                 }
17202                 FREE(j_calls);
17203         }
17204 }
17205 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
17206         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
17207         JNIEnv *env;
17208         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17209         if (get_jenv_res == JNI_EDETACHED) {
17210                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17211         } else {
17212                 DO_ASSERT(get_jenv_res == JNI_OK);
17213         }
17214         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17215         CHECK(obj != NULL);
17216         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_destination_script_meth);
17217         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17218                 (*env)->ExceptionDescribe(env);
17219                 (*env)->FatalError(env, "A call to get_change_destination_script in LDKChangeDestinationSource from rust threw an exception.");
17220         }
17221         void* ret_ptr = untag_ptr(ret);
17222         CHECK_ACCESS(ret_ptr);
17223         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
17224         FREE(untag_ptr(ret));
17225         if (get_jenv_res == JNI_EDETACHED) {
17226                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17227         }
17228         return ret_conv;
17229 }
17230 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
17231         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
17232         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17233 }
17234 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (JNIEnv *env, jclass clz, jobject o) {
17235         jclass c = (*env)->GetObjectClass(env, o);
17236         CHECK(c != NULL);
17237         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
17238         atomic_init(&calls->refcnt, 1);
17239         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17240         calls->o = (*env)->NewWeakGlobalRef(env, o);
17241         calls->get_change_destination_script_meth = (*env)->GetMethodID(env, c, "get_change_destination_script", "()J");
17242         CHECK(calls->get_change_destination_script_meth != NULL);
17243
17244         LDKChangeDestinationSource ret = {
17245                 .this_arg = (void*) calls,
17246                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
17247                 .free = LDKChangeDestinationSource_JCalls_free,
17248         };
17249         return ret;
17250 }
17251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChangeDestinationSource_1new(JNIEnv *env, jclass clz, jobject o) {
17252         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
17253         *res_ptr = LDKChangeDestinationSource_init(env, clz, o);
17254         return tag_ptr(res_ptr, true);
17255 }
17256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChangeDestinationSource_1get_1change_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
17257         void* this_arg_ptr = untag_ptr(this_arg);
17258         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17259         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
17260         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17261         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
17262         return tag_ptr(ret_conv, true);
17263 }
17264
17265 typedef struct LDKKVStore_JCalls {
17266         atomic_size_t refcnt;
17267         JavaVM *vm;
17268         jweak o;
17269         jmethodID read_meth;
17270         jmethodID write_meth;
17271         jmethodID remove_meth;
17272         jmethodID list_meth;
17273 } LDKKVStore_JCalls;
17274 static void LDKKVStore_JCalls_free(void* this_arg) {
17275         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17276         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17277                 JNIEnv *env;
17278                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17279                 if (get_jenv_res == JNI_EDETACHED) {
17280                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17281                 } else {
17282                         DO_ASSERT(get_jenv_res == JNI_OK);
17283                 }
17284                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17285                 if (get_jenv_res == JNI_EDETACHED) {
17286                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17287                 }
17288                 FREE(j_calls);
17289         }
17290 }
17291 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
17292         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17293         JNIEnv *env;
17294         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17295         if (get_jenv_res == JNI_EDETACHED) {
17296                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17297         } else {
17298                 DO_ASSERT(get_jenv_res == JNI_OK);
17299         }
17300         LDKStr primary_namespace_str = primary_namespace;
17301         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17302         Str_free(primary_namespace_str);
17303         LDKStr secondary_namespace_str = secondary_namespace;
17304         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17305         Str_free(secondary_namespace_str);
17306         LDKStr key_str = key;
17307         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17308         Str_free(key_str);
17309         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17310         CHECK(obj != NULL);
17311         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
17312         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17313                 (*env)->ExceptionDescribe(env);
17314                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
17315         }
17316         void* ret_ptr = untag_ptr(ret);
17317         CHECK_ACCESS(ret_ptr);
17318         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
17319         FREE(untag_ptr(ret));
17320         if (get_jenv_res == JNI_EDETACHED) {
17321                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17322         }
17323         return ret_conv;
17324 }
17325 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
17326         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17327         JNIEnv *env;
17328         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17329         if (get_jenv_res == JNI_EDETACHED) {
17330                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17331         } else {
17332                 DO_ASSERT(get_jenv_res == JNI_OK);
17333         }
17334         LDKStr primary_namespace_str = primary_namespace;
17335         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17336         Str_free(primary_namespace_str);
17337         LDKStr secondary_namespace_str = secondary_namespace;
17338         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17339         Str_free(secondary_namespace_str);
17340         LDKStr key_str = key;
17341         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17342         Str_free(key_str);
17343         LDKu8slice buf_var = buf;
17344         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
17345         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
17346         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17347         CHECK(obj != NULL);
17348         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
17349         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17350                 (*env)->ExceptionDescribe(env);
17351                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
17352         }
17353         void* ret_ptr = untag_ptr(ret);
17354         CHECK_ACCESS(ret_ptr);
17355         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17356         FREE(untag_ptr(ret));
17357         if (get_jenv_res == JNI_EDETACHED) {
17358                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17359         }
17360         return ret_conv;
17361 }
17362 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
17363         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17364         JNIEnv *env;
17365         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17366         if (get_jenv_res == JNI_EDETACHED) {
17367                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17368         } else {
17369                 DO_ASSERT(get_jenv_res == JNI_OK);
17370         }
17371         LDKStr primary_namespace_str = primary_namespace;
17372         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17373         Str_free(primary_namespace_str);
17374         LDKStr secondary_namespace_str = secondary_namespace;
17375         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17376         Str_free(secondary_namespace_str);
17377         LDKStr key_str = key;
17378         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17379         Str_free(key_str);
17380         jboolean lazy_conv = lazy;
17381         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17382         CHECK(obj != NULL);
17383         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
17384         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17385                 (*env)->ExceptionDescribe(env);
17386                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
17387         }
17388         void* ret_ptr = untag_ptr(ret);
17389         CHECK_ACCESS(ret_ptr);
17390         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17391         FREE(untag_ptr(ret));
17392         if (get_jenv_res == JNI_EDETACHED) {
17393                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17394         }
17395         return ret_conv;
17396 }
17397 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
17398         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17399         JNIEnv *env;
17400         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17401         if (get_jenv_res == JNI_EDETACHED) {
17402                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17403         } else {
17404                 DO_ASSERT(get_jenv_res == JNI_OK);
17405         }
17406         LDKStr primary_namespace_str = primary_namespace;
17407         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17408         Str_free(primary_namespace_str);
17409         LDKStr secondary_namespace_str = secondary_namespace;
17410         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17411         Str_free(secondary_namespace_str);
17412         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17413         CHECK(obj != NULL);
17414         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
17415         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17416                 (*env)->ExceptionDescribe(env);
17417                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
17418         }
17419         void* ret_ptr = untag_ptr(ret);
17420         CHECK_ACCESS(ret_ptr);
17421         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
17422         FREE(untag_ptr(ret));
17423         if (get_jenv_res == JNI_EDETACHED) {
17424                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17425         }
17426         return ret_conv;
17427 }
17428 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
17429         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
17430         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17431 }
17432 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
17433         jclass c = (*env)->GetObjectClass(env, o);
17434         CHECK(c != NULL);
17435         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
17436         atomic_init(&calls->refcnt, 1);
17437         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17438         calls->o = (*env)->NewWeakGlobalRef(env, o);
17439         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
17440         CHECK(calls->read_meth != NULL);
17441         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
17442         CHECK(calls->write_meth != NULL);
17443         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
17444         CHECK(calls->remove_meth != NULL);
17445         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
17446         CHECK(calls->list_meth != NULL);
17447
17448         LDKKVStore ret = {
17449                 .this_arg = (void*) calls,
17450                 .read = read_LDKKVStore_jcall,
17451                 .write = write_LDKKVStore_jcall,
17452                 .remove = remove_LDKKVStore_jcall,
17453                 .list = list_LDKKVStore_jcall,
17454                 .free = LDKKVStore_JCalls_free,
17455         };
17456         return ret;
17457 }
17458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
17459         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
17460         *res_ptr = LDKKVStore_init(env, clz, o);
17461         return tag_ptr(res_ptr, true);
17462 }
17463 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) {
17464         void* this_arg_ptr = untag_ptr(this_arg);
17465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17466         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17467         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17468         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17469         LDKStr key_conv = java_to_owned_str(env, key);
17470         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
17471         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
17472         return tag_ptr(ret_conv, true);
17473 }
17474
17475 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) {
17476         void* this_arg_ptr = untag_ptr(this_arg);
17477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17478         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17479         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17480         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17481         LDKStr key_conv = java_to_owned_str(env, key);
17482         LDKu8slice buf_ref;
17483         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
17484         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
17485         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17486         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
17487         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
17488         return tag_ptr(ret_conv, true);
17489 }
17490
17491 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) {
17492         void* this_arg_ptr = untag_ptr(this_arg);
17493         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17494         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17495         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17496         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17497         LDKStr key_conv = java_to_owned_str(env, key);
17498         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17499         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
17500         return tag_ptr(ret_conv, true);
17501 }
17502
17503 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) {
17504         void* this_arg_ptr = untag_ptr(this_arg);
17505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17506         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17507         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17508         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17509         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
17510         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
17511         return tag_ptr(ret_conv, true);
17512 }
17513
17514 typedef struct LDKOutputSpender_JCalls {
17515         atomic_size_t refcnt;
17516         JavaVM *vm;
17517         jweak o;
17518         jmethodID spend_spendable_outputs_meth;
17519 } LDKOutputSpender_JCalls;
17520 static void LDKOutputSpender_JCalls_free(void* this_arg) {
17521         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
17522         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17523                 JNIEnv *env;
17524                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17525                 if (get_jenv_res == JNI_EDETACHED) {
17526                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17527                 } else {
17528                         DO_ASSERT(get_jenv_res == JNI_OK);
17529                 }
17530                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17531                 if (get_jenv_res == JNI_EDETACHED) {
17532                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17533                 }
17534                 FREE(j_calls);
17535         }
17536 }
17537 LDKCResult_TransactionNoneZ spend_spendable_outputs_LDKOutputSpender_jcall(const void* this_arg, LDKCVec_SpendableOutputDescriptorZ descriptors, LDKCVec_TxOutZ outputs, LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, LDKCOption_u32Z locktime) {
17538         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
17539         JNIEnv *env;
17540         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17541         if (get_jenv_res == JNI_EDETACHED) {
17542                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17543         } else {
17544                 DO_ASSERT(get_jenv_res == JNI_OK);
17545         }
17546         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
17547         int64_tArray descriptors_arr = NULL;
17548         descriptors_arr = (*env)->NewLongArray(env, descriptors_var.datalen);
17549         int64_t *descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, descriptors_arr, NULL);
17550         for (size_t b = 0; b < descriptors_var.datalen; b++) {
17551                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17552                 *descriptors_conv_27_copy = descriptors_var.data[b];
17553                 int64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
17554                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
17555         }
17556         (*env)->ReleasePrimitiveArrayCritical(env, descriptors_arr, descriptors_arr_ptr, 0);
17557         FREE(descriptors_var.data);
17558         LDKCVec_TxOutZ outputs_var = outputs;
17559         int64_tArray outputs_arr = NULL;
17560         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
17561         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
17562         for (size_t h = 0; h < outputs_var.datalen; h++) {
17563                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17564                 *outputs_conv_7_ref = outputs_var.data[h];
17565                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
17566         }
17567         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
17568         FREE(outputs_var.data);
17569         LDKCVec_u8Z change_destination_script_var = change_destination_script;
17570         int8_tArray change_destination_script_arr = (*env)->NewByteArray(env, change_destination_script_var.datalen);
17571         (*env)->SetByteArrayRegion(env, change_destination_script_arr, 0, change_destination_script_var.datalen, change_destination_script_var.data);
17572         CVec_u8Z_free(change_destination_script_var);
17573         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
17574         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17575         *locktime_copy = locktime;
17576         int64_t locktime_ref = tag_ptr(locktime_copy, true);
17577         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17578         CHECK(obj != NULL);
17579         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->spend_spendable_outputs_meth, descriptors_arr, outputs_arr, change_destination_script_arr, feerate_sat_per_1000_weight_conv, locktime_ref);
17580         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17581                 (*env)->ExceptionDescribe(env);
17582                 (*env)->FatalError(env, "A call to spend_spendable_outputs in LDKOutputSpender from rust threw an exception.");
17583         }
17584         void* ret_ptr = untag_ptr(ret);
17585         CHECK_ACCESS(ret_ptr);
17586         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17587         FREE(untag_ptr(ret));
17588         if (get_jenv_res == JNI_EDETACHED) {
17589                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17590         }
17591         return ret_conv;
17592 }
17593 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
17594         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
17595         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17596 }
17597 static inline LDKOutputSpender LDKOutputSpender_init (JNIEnv *env, jclass clz, jobject o) {
17598         jclass c = (*env)->GetObjectClass(env, o);
17599         CHECK(c != NULL);
17600         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
17601         atomic_init(&calls->refcnt, 1);
17602         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17603         calls->o = (*env)->NewWeakGlobalRef(env, o);
17604         calls->spend_spendable_outputs_meth = (*env)->GetMethodID(env, c, "spend_spendable_outputs", "([J[J[BIJ)J");
17605         CHECK(calls->spend_spendable_outputs_meth != NULL);
17606
17607         LDKOutputSpender ret = {
17608                 .this_arg = (void*) calls,
17609                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
17610                 .free = LDKOutputSpender_JCalls_free,
17611         };
17612         return ret;
17613 }
17614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOutputSpender_1new(JNIEnv *env, jclass clz, jobject o) {
17615         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
17616         *res_ptr = LDKOutputSpender_init(env, clz, o);
17617         return tag_ptr(res_ptr, true);
17618 }
17619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpender_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) {
17620         void* this_arg_ptr = untag_ptr(this_arg);
17621         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17622         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
17623         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
17624         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
17625         if (descriptors_constr.datalen > 0)
17626                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17627         else
17628                 descriptors_constr.data = NULL;
17629         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
17630         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
17631                 int64_t descriptors_conv_27 = descriptors_vals[b];
17632                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
17633                 CHECK_ACCESS(descriptors_conv_27_ptr);
17634                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
17635                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
17636                 descriptors_constr.data[b] = descriptors_conv_27_conv;
17637         }
17638         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
17639         LDKCVec_TxOutZ outputs_constr;
17640         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
17641         if (outputs_constr.datalen > 0)
17642                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17643         else
17644                 outputs_constr.data = NULL;
17645         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
17646         for (size_t h = 0; h < outputs_constr.datalen; h++) {
17647                 int64_t outputs_conv_7 = outputs_vals[h];
17648                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
17649                 CHECK_ACCESS(outputs_conv_7_ptr);
17650                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
17651                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
17652                 outputs_constr.data[h] = outputs_conv_7_conv;
17653         }
17654         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
17655         LDKCVec_u8Z change_destination_script_ref;
17656         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
17657         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
17658         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
17659         void* locktime_ptr = untag_ptr(locktime);
17660         CHECK_ACCESS(locktime_ptr);
17661         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
17662         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
17663         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17664         *ret_conv = (this_arg_conv->spend_spendable_outputs)(this_arg_conv->this_arg, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
17665         return tag_ptr(ret_conv, true);
17666 }
17667
17668 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
17669         LDKOutputSweeper ret = *owner->contents.result;
17670         ret.is_owned = false;
17671         return ret;
17672 }
17673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17674         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
17675         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
17676         int64_t ret_ref = 0;
17677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17679         return ret_ref;
17680 }
17681
17682 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
17683 CHECK(!owner->result_ok);
17684         return DecodeError_clone(&*owner->contents.err);
17685 }
17686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17687         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
17688         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17689         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
17690         int64_t ret_ref = tag_ptr(ret_copy, true);
17691         return ret_ref;
17692 }
17693
17694 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
17695         LDKBestBlock ret = owner->a;
17696         ret.is_owned = false;
17697         return ret;
17698 }
17699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17700         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
17701         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
17702         int64_t ret_ref = 0;
17703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17705         return ret_ref;
17706 }
17707
17708 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
17709         LDKOutputSweeper ret = owner->b;
17710         ret.is_owned = false;
17711         return ret;
17712 }
17713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17714         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
17715         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
17716         int64_t ret_ref = 0;
17717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17719         return ret_ref;
17720 }
17721
17722 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
17723 CHECK(owner->result_ok);
17724         return &*owner->contents.result;
17725 }
17726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17727         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
17728         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
17729         return ret_ret;
17730 }
17731
17732 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
17733 CHECK(!owner->result_ok);
17734         return DecodeError_clone(&*owner->contents.err);
17735 }
17736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17737         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
17738         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17739         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
17740         int64_t ret_ref = tag_ptr(ret_copy, true);
17741         return ret_ref;
17742 }
17743
17744 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
17745         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
17746         ret.is_owned = false;
17747         return ret;
17748 }
17749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17750         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
17751         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
17752         int64_t ret_ref = 0;
17753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17755         return ret_ref;
17756 }
17757
17758 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
17759 CHECK(!owner->result_ok);
17760         return DecodeError_clone(&*owner->contents.err);
17761 }
17762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17763         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
17764         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17765         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
17766         int64_t ret_ref = tag_ptr(ret_copy, true);
17767         return ret_ref;
17768 }
17769
17770 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
17771         LDKDelayedPaymentKey ret = *owner->contents.result;
17772         ret.is_owned = false;
17773         return ret;
17774 }
17775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17776         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
17777         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
17778         int64_t ret_ref = 0;
17779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17781         return ret_ref;
17782 }
17783
17784 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
17785 CHECK(!owner->result_ok);
17786         return DecodeError_clone(&*owner->contents.err);
17787 }
17788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17789         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
17790         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17791         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
17792         int64_t ret_ref = tag_ptr(ret_copy, true);
17793         return ret_ref;
17794 }
17795
17796 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
17797         LDKHtlcBasepoint ret = *owner->contents.result;
17798         ret.is_owned = false;
17799         return ret;
17800 }
17801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17802         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
17803         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
17804         int64_t ret_ref = 0;
17805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17807         return ret_ref;
17808 }
17809
17810 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
17811 CHECK(!owner->result_ok);
17812         return DecodeError_clone(&*owner->contents.err);
17813 }
17814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17815         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
17816         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17817         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
17818         int64_t ret_ref = tag_ptr(ret_copy, true);
17819         return ret_ref;
17820 }
17821
17822 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
17823         LDKHtlcKey ret = *owner->contents.result;
17824         ret.is_owned = false;
17825         return ret;
17826 }
17827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17828         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
17829         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
17830         int64_t ret_ref = 0;
17831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17833         return ret_ref;
17834 }
17835
17836 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
17837 CHECK(!owner->result_ok);
17838         return DecodeError_clone(&*owner->contents.err);
17839 }
17840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17841         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
17842         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17843         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
17844         int64_t ret_ref = tag_ptr(ret_copy, true);
17845         return ret_ref;
17846 }
17847
17848 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
17849         LDKRevocationBasepoint ret = *owner->contents.result;
17850         ret.is_owned = false;
17851         return ret;
17852 }
17853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17854         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
17855         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
17856         int64_t ret_ref = 0;
17857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17859         return ret_ref;
17860 }
17861
17862 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
17863 CHECK(!owner->result_ok);
17864         return DecodeError_clone(&*owner->contents.err);
17865 }
17866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17867         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
17868         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17869         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
17870         int64_t ret_ref = tag_ptr(ret_copy, true);
17871         return ret_ref;
17872 }
17873
17874 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
17875         LDKRevocationKey ret = *owner->contents.result;
17876         ret.is_owned = false;
17877         return ret;
17878 }
17879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17880         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
17881         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
17882         int64_t ret_ref = 0;
17883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17885         return ret_ref;
17886 }
17887
17888 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
17889 CHECK(!owner->result_ok);
17890         return DecodeError_clone(&*owner->contents.err);
17891 }
17892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17893         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
17894         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17895         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
17896         int64_t ret_ref = tag_ptr(ret_copy, true);
17897         return ret_ref;
17898 }
17899
17900 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
17901         LDKLockedChannelMonitor ret = *owner->contents.result;
17902         ret.is_owned = false;
17903         return ret;
17904 }
17905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17906         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
17907         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
17908         int64_t ret_ref = 0;
17909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17911         return ret_ref;
17912 }
17913
17914 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
17915 CHECK(!owner->result_ok);
17916         return *owner->contents.err;
17917 }
17918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17919         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
17920         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
17921 }
17922
17923 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
17924         LDKOutPoint ret = owner->a;
17925         ret.is_owned = false;
17926         return ret;
17927 }
17928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17929         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
17930         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
17931         int64_t ret_ref = 0;
17932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17934         return ret_ref;
17935 }
17936
17937 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
17938         LDKChannelId ret = owner->b;
17939         ret.is_owned = false;
17940         return ret;
17941 }
17942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17943         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
17944         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
17945         int64_t ret_ref = 0;
17946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17948         return ret_ref;
17949 }
17950
17951 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
17952         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
17953         for (size_t i = 0; i < ret.datalen; i++) {
17954                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
17955         }
17956         return ret;
17957 }
17958 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
17959         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
17960         for (size_t i = 0; i < ret.datalen; i++) {
17961                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
17962         }
17963         return ret;
17964 }
17965 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
17966         LDKOutPoint ret = owner->a;
17967         ret.is_owned = false;
17968         return ret;
17969 }
17970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17971         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
17972         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
17973         int64_t ret_ref = 0;
17974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17976         return ret_ref;
17977 }
17978
17979 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
17980         return CVec_MonitorUpdateIdZ_clone(&owner->b);
17981 }
17982 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17983         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
17984         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
17985         int64_tArray ret_arr = NULL;
17986         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17987         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17988         for (size_t r = 0; r < ret_var.datalen; r++) {
17989                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
17990                 int64_t ret_conv_17_ref = 0;
17991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
17992                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
17993                 ret_arr_ptr[r] = ret_conv_17_ref;
17994         }
17995         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17996         FREE(ret_var.data);
17997         return ret_arr;
17998 }
17999
18000 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
18001         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
18002         for (size_t i = 0; i < ret.datalen; i++) {
18003                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
18004         }
18005         return ret;
18006 }
18007 typedef struct LDKPersister_JCalls {
18008         atomic_size_t refcnt;
18009         JavaVM *vm;
18010         jweak o;
18011         jmethodID persist_manager_meth;
18012         jmethodID persist_graph_meth;
18013         jmethodID persist_scorer_meth;
18014 } LDKPersister_JCalls;
18015 static void LDKPersister_JCalls_free(void* this_arg) {
18016         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
18017         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18018                 JNIEnv *env;
18019                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18020                 if (get_jenv_res == JNI_EDETACHED) {
18021                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18022                 } else {
18023                         DO_ASSERT(get_jenv_res == JNI_OK);
18024                 }
18025                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18026                 if (get_jenv_res == JNI_EDETACHED) {
18027                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18028                 }
18029                 FREE(j_calls);
18030         }
18031 }
18032 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
18033         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
18034         JNIEnv *env;
18035         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18036         if (get_jenv_res == JNI_EDETACHED) {
18037                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18038         } else {
18039                 DO_ASSERT(get_jenv_res == JNI_OK);
18040         }
18041         LDKChannelManager channel_manager_var = *channel_manager;
18042         int64_t channel_manager_ref = 0;
18043         // WARNING: we may need a move here but no clone is available for LDKChannelManager
18044         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
18045         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
18046         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18047         CHECK(obj != NULL);
18048         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
18049         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18050                 (*env)->ExceptionDescribe(env);
18051                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
18052         }
18053         void* ret_ptr = untag_ptr(ret);
18054         CHECK_ACCESS(ret_ptr);
18055         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
18056         FREE(untag_ptr(ret));
18057         if (get_jenv_res == JNI_EDETACHED) {
18058                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18059         }
18060         return ret_conv;
18061 }
18062 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
18063         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
18064         JNIEnv *env;
18065         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18066         if (get_jenv_res == JNI_EDETACHED) {
18067                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18068         } else {
18069                 DO_ASSERT(get_jenv_res == JNI_OK);
18070         }
18071         LDKNetworkGraph network_graph_var = *network_graph;
18072         int64_t network_graph_ref = 0;
18073         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
18074         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
18075         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
18076         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18077         CHECK(obj != NULL);
18078         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
18079         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18080                 (*env)->ExceptionDescribe(env);
18081                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
18082         }
18083         void* ret_ptr = untag_ptr(ret);
18084         CHECK_ACCESS(ret_ptr);
18085         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
18086         FREE(untag_ptr(ret));
18087         if (get_jenv_res == JNI_EDETACHED) {
18088                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18089         }
18090         return ret_conv;
18091 }
18092 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
18093         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
18094         JNIEnv *env;
18095         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18096         if (get_jenv_res == JNI_EDETACHED) {
18097                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18098         } else {
18099                 DO_ASSERT(get_jenv_res == JNI_OK);
18100         }
18101         // WARNING: This object doesn't live past this scope, needs clone!
18102         int64_t ret_scorer = tag_ptr(scorer, false);
18103         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18104         CHECK(obj != NULL);
18105         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
18106         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18107                 (*env)->ExceptionDescribe(env);
18108                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
18109         }
18110         void* ret_ptr = untag_ptr(ret);
18111         CHECK_ACCESS(ret_ptr);
18112         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
18113         FREE(untag_ptr(ret));
18114         if (get_jenv_res == JNI_EDETACHED) {
18115                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18116         }
18117         return ret_conv;
18118 }
18119 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
18120         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
18121         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18122 }
18123 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
18124         jclass c = (*env)->GetObjectClass(env, o);
18125         CHECK(c != NULL);
18126         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
18127         atomic_init(&calls->refcnt, 1);
18128         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18129         calls->o = (*env)->NewWeakGlobalRef(env, o);
18130         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
18131         CHECK(calls->persist_manager_meth != NULL);
18132         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
18133         CHECK(calls->persist_graph_meth != NULL);
18134         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
18135         CHECK(calls->persist_scorer_meth != NULL);
18136
18137         LDKPersister ret = {
18138                 .this_arg = (void*) calls,
18139                 .persist_manager = persist_manager_LDKPersister_jcall,
18140                 .persist_graph = persist_graph_LDKPersister_jcall,
18141                 .persist_scorer = persist_scorer_LDKPersister_jcall,
18142                 .free = LDKPersister_JCalls_free,
18143         };
18144         return ret;
18145 }
18146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
18147         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
18148         *res_ptr = LDKPersister_init(env, clz, o);
18149         return tag_ptr(res_ptr, true);
18150 }
18151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
18152         void* this_arg_ptr = untag_ptr(this_arg);
18153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18154         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
18155         LDKChannelManager channel_manager_conv;
18156         channel_manager_conv.inner = untag_ptr(channel_manager);
18157         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
18158         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
18159         channel_manager_conv.is_owned = false;
18160         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18161         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
18162         return tag_ptr(ret_conv, true);
18163 }
18164
18165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
18166         void* this_arg_ptr = untag_ptr(this_arg);
18167         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18168         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
18169         LDKNetworkGraph network_graph_conv;
18170         network_graph_conv.inner = untag_ptr(network_graph);
18171         network_graph_conv.is_owned = ptr_is_owned(network_graph);
18172         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
18173         network_graph_conv.is_owned = false;
18174         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18175         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
18176         return tag_ptr(ret_conv, true);
18177 }
18178
18179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
18180         void* this_arg_ptr = untag_ptr(this_arg);
18181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18182         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
18183         void* scorer_ptr = untag_ptr(scorer);
18184         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
18185         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
18186         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18187         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
18188         return tag_ptr(ret_conv, true);
18189 }
18190
18191 typedef struct LDKPersist_JCalls {
18192         atomic_size_t refcnt;
18193         JavaVM *vm;
18194         jweak o;
18195         jmethodID persist_new_channel_meth;
18196         jmethodID update_persisted_channel_meth;
18197         jmethodID archive_persisted_channel_meth;
18198 } LDKPersist_JCalls;
18199 static void LDKPersist_JCalls_free(void* this_arg) {
18200         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
18201         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18202                 JNIEnv *env;
18203                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18204                 if (get_jenv_res == JNI_EDETACHED) {
18205                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18206                 } else {
18207                         DO_ASSERT(get_jenv_res == JNI_OK);
18208                 }
18209                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18210                 if (get_jenv_res == JNI_EDETACHED) {
18211                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18212                 }
18213                 FREE(j_calls);
18214         }
18215 }
18216 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
18217         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
18218         JNIEnv *env;
18219         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18220         if (get_jenv_res == JNI_EDETACHED) {
18221                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18222         } else {
18223                 DO_ASSERT(get_jenv_res == JNI_OK);
18224         }
18225         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
18226         int64_t channel_funding_outpoint_ref = 0;
18227         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
18228         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
18229         LDKChannelMonitor data_var = *data;
18230         int64_t data_ref = 0;
18231         data_var = ChannelMonitor_clone(&data_var);
18232         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
18233         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
18234         LDKMonitorUpdateId update_id_var = update_id;
18235         int64_t update_id_ref = 0;
18236         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
18237         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
18238         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18239         CHECK(obj != NULL);
18240         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_funding_outpoint_ref, data_ref, update_id_ref);
18241         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18242                 (*env)->ExceptionDescribe(env);
18243                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
18244         }
18245         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
18246         if (get_jenv_res == JNI_EDETACHED) {
18247                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18248         }
18249         return ret_conv;
18250 }
18251 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
18252         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
18253         JNIEnv *env;
18254         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18255         if (get_jenv_res == JNI_EDETACHED) {
18256                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18257         } else {
18258                 DO_ASSERT(get_jenv_res == JNI_OK);
18259         }
18260         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
18261         int64_t channel_funding_outpoint_ref = 0;
18262         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
18263         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
18264         LDKChannelMonitorUpdate update_var = update;
18265         int64_t update_ref = 0;
18266         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
18267         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
18268         LDKChannelMonitor data_var = *data;
18269         int64_t data_ref = 0;
18270         data_var = ChannelMonitor_clone(&data_var);
18271         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
18272         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
18273         LDKMonitorUpdateId update_id_var = update_id;
18274         int64_t update_id_ref = 0;
18275         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
18276         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
18277         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18278         CHECK(obj != NULL);
18279         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_funding_outpoint_ref, update_ref, data_ref, update_id_ref);
18280         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18281                 (*env)->ExceptionDescribe(env);
18282                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
18283         }
18284         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
18285         if (get_jenv_res == JNI_EDETACHED) {
18286                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18287         }
18288         return ret_conv;
18289 }
18290 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
18291         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
18292         JNIEnv *env;
18293         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18294         if (get_jenv_res == JNI_EDETACHED) {
18295                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18296         } else {
18297                 DO_ASSERT(get_jenv_res == JNI_OK);
18298         }
18299         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
18300         int64_t channel_funding_outpoint_ref = 0;
18301         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
18302         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
18303         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18304         CHECK(obj != NULL);
18305         (*env)->CallVoidMethod(env, obj, j_calls->archive_persisted_channel_meth, channel_funding_outpoint_ref);
18306         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18307                 (*env)->ExceptionDescribe(env);
18308                 (*env)->FatalError(env, "A call to archive_persisted_channel in LDKPersist from rust threw an exception.");
18309         }
18310         if (get_jenv_res == JNI_EDETACHED) {
18311                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18312         }
18313 }
18314 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
18315         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
18316         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18317 }
18318 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
18319         jclass c = (*env)->GetObjectClass(env, o);
18320         CHECK(c != NULL);
18321         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
18322         atomic_init(&calls->refcnt, 1);
18323         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18324         calls->o = (*env)->NewWeakGlobalRef(env, o);
18325         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
18326         CHECK(calls->persist_new_channel_meth != NULL);
18327         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
18328         CHECK(calls->update_persisted_channel_meth != NULL);
18329         calls->archive_persisted_channel_meth = (*env)->GetMethodID(env, c, "archive_persisted_channel", "(J)V");
18330         CHECK(calls->archive_persisted_channel_meth != NULL);
18331
18332         LDKPersist ret = {
18333                 .this_arg = (void*) calls,
18334                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
18335                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
18336                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
18337                 .free = LDKPersist_JCalls_free,
18338         };
18339         return ret;
18340 }
18341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
18342         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
18343         *res_ptr = LDKPersist_init(env, clz, o);
18344         return tag_ptr(res_ptr, true);
18345 }
18346 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint, int64_t data, int64_t update_id) {
18347         void* this_arg_ptr = untag_ptr(this_arg);
18348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18349         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18350         LDKOutPoint channel_funding_outpoint_conv;
18351         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18352         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18353         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18354         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18355         LDKChannelMonitor data_conv;
18356         data_conv.inner = untag_ptr(data);
18357         data_conv.is_owned = ptr_is_owned(data);
18358         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
18359         data_conv.is_owned = false;
18360         LDKMonitorUpdateId update_id_conv;
18361         update_id_conv.inner = untag_ptr(update_id);
18362         update_id_conv.is_owned = ptr_is_owned(update_id);
18363         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
18364         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
18365         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, &data_conv, update_id_conv));
18366         return ret_conv;
18367 }
18368
18369 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint, int64_t update, int64_t data, int64_t update_id) {
18370         void* this_arg_ptr = untag_ptr(this_arg);
18371         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18372         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18373         LDKOutPoint channel_funding_outpoint_conv;
18374         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18375         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18376         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18377         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18378         LDKChannelMonitorUpdate update_conv;
18379         update_conv.inner = untag_ptr(update);
18380         update_conv.is_owned = ptr_is_owned(update);
18381         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
18382         update_conv = ChannelMonitorUpdate_clone(&update_conv);
18383         LDKChannelMonitor data_conv;
18384         data_conv.inner = untag_ptr(data);
18385         data_conv.is_owned = ptr_is_owned(data);
18386         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
18387         data_conv.is_owned = false;
18388         LDKMonitorUpdateId update_id_conv;
18389         update_id_conv.inner = untag_ptr(update_id);
18390         update_id_conv.is_owned = ptr_is_owned(update_id);
18391         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
18392         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
18393         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, update_conv, &data_conv, update_id_conv));
18394         return ret_conv;
18395 }
18396
18397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1archive_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint) {
18398         void* this_arg_ptr = untag_ptr(this_arg);
18399         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18400         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18401         LDKOutPoint channel_funding_outpoint_conv;
18402         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18403         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18404         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18405         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18406         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
18407 }
18408
18409 typedef struct LDKListen_JCalls {
18410         atomic_size_t refcnt;
18411         JavaVM *vm;
18412         jweak o;
18413         jmethodID filtered_block_connected_meth;
18414         jmethodID block_connected_meth;
18415         jmethodID block_disconnected_meth;
18416 } LDKListen_JCalls;
18417 static void LDKListen_JCalls_free(void* this_arg) {
18418         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18419         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18420                 JNIEnv *env;
18421                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18422                 if (get_jenv_res == JNI_EDETACHED) {
18423                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18424                 } else {
18425                         DO_ASSERT(get_jenv_res == JNI_OK);
18426                 }
18427                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18428                 if (get_jenv_res == JNI_EDETACHED) {
18429                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18430                 }
18431                 FREE(j_calls);
18432         }
18433 }
18434 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
18435         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18436         JNIEnv *env;
18437         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18438         if (get_jenv_res == JNI_EDETACHED) {
18439                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18440         } else {
18441                 DO_ASSERT(get_jenv_res == JNI_OK);
18442         }
18443         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18444         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18445         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
18446         int64_tArray txdata_arr = NULL;
18447         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
18448         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
18449         for (size_t c = 0; c < txdata_var.datalen; c++) {
18450                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18451                 *txdata_conv_28_conv = txdata_var.data[c];
18452                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
18453         }
18454         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
18455         FREE(txdata_var.data);
18456         int32_t height_conv = height;
18457         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18458         CHECK(obj != NULL);
18459         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
18460         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18461                 (*env)->ExceptionDescribe(env);
18462                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
18463         }
18464         if (get_jenv_res == JNI_EDETACHED) {
18465                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18466         }
18467 }
18468 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
18469         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18470         JNIEnv *env;
18471         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18472         if (get_jenv_res == JNI_EDETACHED) {
18473                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18474         } else {
18475                 DO_ASSERT(get_jenv_res == JNI_OK);
18476         }
18477         LDKu8slice block_var = block;
18478         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
18479         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
18480         int32_t height_conv = height;
18481         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18482         CHECK(obj != NULL);
18483         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
18484         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18485                 (*env)->ExceptionDescribe(env);
18486                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
18487         }
18488         if (get_jenv_res == JNI_EDETACHED) {
18489                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18490         }
18491 }
18492 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
18493         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18494         JNIEnv *env;
18495         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18496         if (get_jenv_res == JNI_EDETACHED) {
18497                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18498         } else {
18499                 DO_ASSERT(get_jenv_res == JNI_OK);
18500         }
18501         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18502         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18503         int32_t height_conv = height;
18504         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18505         CHECK(obj != NULL);
18506         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
18507         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18508                 (*env)->ExceptionDescribe(env);
18509                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
18510         }
18511         if (get_jenv_res == JNI_EDETACHED) {
18512                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18513         }
18514 }
18515 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
18516         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
18517         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18518 }
18519 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
18520         jclass c = (*env)->GetObjectClass(env, o);
18521         CHECK(c != NULL);
18522         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
18523         atomic_init(&calls->refcnt, 1);
18524         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18525         calls->o = (*env)->NewWeakGlobalRef(env, o);
18526         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
18527         CHECK(calls->filtered_block_connected_meth != NULL);
18528         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
18529         CHECK(calls->block_connected_meth != NULL);
18530         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
18531         CHECK(calls->block_disconnected_meth != NULL);
18532
18533         LDKListen ret = {
18534                 .this_arg = (void*) calls,
18535                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
18536                 .block_connected = block_connected_LDKListen_jcall,
18537                 .block_disconnected = block_disconnected_LDKListen_jcall,
18538                 .free = LDKListen_JCalls_free,
18539         };
18540         return ret;
18541 }
18542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
18543         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
18544         *res_ptr = LDKListen_init(env, clz, o);
18545         return tag_ptr(res_ptr, true);
18546 }
18547 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) {
18548         void* this_arg_ptr = untag_ptr(this_arg);
18549         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18550         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18551         uint8_t header_arr[80];
18552         CHECK((*env)->GetArrayLength(env, header) == 80);
18553         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18554         uint8_t (*header_ref)[80] = &header_arr;
18555         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18556         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18557         if (txdata_constr.datalen > 0)
18558                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18559         else
18560                 txdata_constr.data = NULL;
18561         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18562         for (size_t c = 0; c < txdata_constr.datalen; c++) {
18563                 int64_t txdata_conv_28 = txdata_vals[c];
18564                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
18565                 CHECK_ACCESS(txdata_conv_28_ptr);
18566                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18567                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
18568                 txdata_constr.data[c] = txdata_conv_28_conv;
18569         }
18570         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18571         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
18572 }
18573
18574 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) {
18575         void* this_arg_ptr = untag_ptr(this_arg);
18576         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18577         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18578         LDKu8slice block_ref;
18579         block_ref.datalen = (*env)->GetArrayLength(env, block);
18580         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
18581         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
18582         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
18583 }
18584
18585 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) {
18586         void* this_arg_ptr = untag_ptr(this_arg);
18587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18588         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18589         uint8_t header_arr[80];
18590         CHECK((*env)->GetArrayLength(env, header) == 80);
18591         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18592         uint8_t (*header_ref)[80] = &header_arr;
18593         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
18594 }
18595
18596 typedef struct LDKConfirm_JCalls {
18597         atomic_size_t refcnt;
18598         JavaVM *vm;
18599         jweak o;
18600         jmethodID transactions_confirmed_meth;
18601         jmethodID transaction_unconfirmed_meth;
18602         jmethodID best_block_updated_meth;
18603         jmethodID get_relevant_txids_meth;
18604 } LDKConfirm_JCalls;
18605 static void LDKConfirm_JCalls_free(void* this_arg) {
18606         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18607         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18608                 JNIEnv *env;
18609                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18610                 if (get_jenv_res == JNI_EDETACHED) {
18611                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18612                 } else {
18613                         DO_ASSERT(get_jenv_res == JNI_OK);
18614                 }
18615                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18616                 if (get_jenv_res == JNI_EDETACHED) {
18617                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18618                 }
18619                 FREE(j_calls);
18620         }
18621 }
18622 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
18623         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18624         JNIEnv *env;
18625         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18626         if (get_jenv_res == JNI_EDETACHED) {
18627                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18628         } else {
18629                 DO_ASSERT(get_jenv_res == JNI_OK);
18630         }
18631         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18632         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18633         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
18634         int64_tArray txdata_arr = NULL;
18635         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
18636         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
18637         for (size_t c = 0; c < txdata_var.datalen; c++) {
18638                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18639                 *txdata_conv_28_conv = txdata_var.data[c];
18640                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
18641         }
18642         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
18643         FREE(txdata_var.data);
18644         int32_t height_conv = height;
18645         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18646         CHECK(obj != NULL);
18647         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
18648         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18649                 (*env)->ExceptionDescribe(env);
18650                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
18651         }
18652         if (get_jenv_res == JNI_EDETACHED) {
18653                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18654         }
18655 }
18656 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
18657         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18658         JNIEnv *env;
18659         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18660         if (get_jenv_res == JNI_EDETACHED) {
18661                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18662         } else {
18663                 DO_ASSERT(get_jenv_res == JNI_OK);
18664         }
18665         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
18666         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
18667         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18668         CHECK(obj != NULL);
18669         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
18670         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18671                 (*env)->ExceptionDescribe(env);
18672                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
18673         }
18674         if (get_jenv_res == JNI_EDETACHED) {
18675                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18676         }
18677 }
18678 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
18679         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18680         JNIEnv *env;
18681         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18682         if (get_jenv_res == JNI_EDETACHED) {
18683                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18684         } else {
18685                 DO_ASSERT(get_jenv_res == JNI_OK);
18686         }
18687         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18688         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18689         int32_t height_conv = height;
18690         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18691         CHECK(obj != NULL);
18692         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
18693         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18694                 (*env)->ExceptionDescribe(env);
18695                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
18696         }
18697         if (get_jenv_res == JNI_EDETACHED) {
18698                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18699         }
18700 }
18701 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
18702         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18703         JNIEnv *env;
18704         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18705         if (get_jenv_res == JNI_EDETACHED) {
18706                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18707         } else {
18708                 DO_ASSERT(get_jenv_res == JNI_OK);
18709         }
18710         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18711         CHECK(obj != NULL);
18712         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
18713         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18714                 (*env)->ExceptionDescribe(env);
18715                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
18716         }
18717         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
18718         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18719         if (ret_constr.datalen > 0)
18720                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
18721         else
18722                 ret_constr.data = NULL;
18723         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18724         for (size_t c = 0; c < ret_constr.datalen; c++) {
18725                 int64_t ret_conv_54 = ret_vals[c];
18726                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
18727                 CHECK_ACCESS(ret_conv_54_ptr);
18728                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
18729                 FREE(untag_ptr(ret_conv_54));
18730                 ret_constr.data[c] = ret_conv_54_conv;
18731         }
18732         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18733         if (get_jenv_res == JNI_EDETACHED) {
18734                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18735         }
18736         return ret_constr;
18737 }
18738 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
18739         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
18740         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18741 }
18742 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
18743         jclass c = (*env)->GetObjectClass(env, o);
18744         CHECK(c != NULL);
18745         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
18746         atomic_init(&calls->refcnt, 1);
18747         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18748         calls->o = (*env)->NewWeakGlobalRef(env, o);
18749         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
18750         CHECK(calls->transactions_confirmed_meth != NULL);
18751         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
18752         CHECK(calls->transaction_unconfirmed_meth != NULL);
18753         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
18754         CHECK(calls->best_block_updated_meth != NULL);
18755         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
18756         CHECK(calls->get_relevant_txids_meth != NULL);
18757
18758         LDKConfirm ret = {
18759                 .this_arg = (void*) calls,
18760                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
18761                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
18762                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
18763                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
18764                 .free = LDKConfirm_JCalls_free,
18765         };
18766         return ret;
18767 }
18768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
18769         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18770         *res_ptr = LDKConfirm_init(env, clz, o);
18771         return tag_ptr(res_ptr, true);
18772 }
18773 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) {
18774         void* this_arg_ptr = untag_ptr(this_arg);
18775         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18776         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18777         uint8_t header_arr[80];
18778         CHECK((*env)->GetArrayLength(env, header) == 80);
18779         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18780         uint8_t (*header_ref)[80] = &header_arr;
18781         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18782         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18783         if (txdata_constr.datalen > 0)
18784                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18785         else
18786                 txdata_constr.data = NULL;
18787         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18788         for (size_t c = 0; c < txdata_constr.datalen; c++) {
18789                 int64_t txdata_conv_28 = txdata_vals[c];
18790                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
18791                 CHECK_ACCESS(txdata_conv_28_ptr);
18792                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18793                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
18794                 txdata_constr.data[c] = txdata_conv_28_conv;
18795         }
18796         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18797         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
18798 }
18799
18800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
18801         void* this_arg_ptr = untag_ptr(this_arg);
18802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18803         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18804         uint8_t txid_arr[32];
18805         CHECK((*env)->GetArrayLength(env, txid) == 32);
18806         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
18807         uint8_t (*txid_ref)[32] = &txid_arr;
18808         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
18809 }
18810
18811 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) {
18812         void* this_arg_ptr = untag_ptr(this_arg);
18813         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18814         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18815         uint8_t header_arr[80];
18816         CHECK((*env)->GetArrayLength(env, header) == 80);
18817         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18818         uint8_t (*header_ref)[80] = &header_arr;
18819         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
18820 }
18821
18822 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
18823         void* this_arg_ptr = untag_ptr(this_arg);
18824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18825         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18826         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
18827         int64_tArray ret_arr = NULL;
18828         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18829         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18830         for (size_t c = 0; c < ret_var.datalen; c++) {
18831                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
18832                 *ret_conv_54_conv = ret_var.data[c];
18833                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
18834         }
18835         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18836         FREE(ret_var.data);
18837         return ret_arr;
18838 }
18839
18840 static jclass LDKSpendingDelay_Relative_class = NULL;
18841 static jmethodID LDKSpendingDelay_Relative_meth = NULL;
18842 static jclass LDKSpendingDelay_Absolute_class = NULL;
18843 static jmethodID LDKSpendingDelay_Absolute_meth = NULL;
18844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendingDelay_init (JNIEnv *env, jclass clz) {
18845         LDKSpendingDelay_Relative_class =
18846                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendingDelay$Relative"));
18847         CHECK(LDKSpendingDelay_Relative_class != NULL);
18848         LDKSpendingDelay_Relative_meth = (*env)->GetMethodID(env, LDKSpendingDelay_Relative_class, "<init>", "(I)V");
18849         CHECK(LDKSpendingDelay_Relative_meth != NULL);
18850         LDKSpendingDelay_Absolute_class =
18851                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendingDelay$Absolute"));
18852         CHECK(LDKSpendingDelay_Absolute_class != NULL);
18853         LDKSpendingDelay_Absolute_meth = (*env)->GetMethodID(env, LDKSpendingDelay_Absolute_class, "<init>", "(I)V");
18854         CHECK(LDKSpendingDelay_Absolute_meth != NULL);
18855 }
18856 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendingDelay_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18857         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
18858         switch(obj->tag) {
18859                 case LDKSpendingDelay_Relative: {
18860                         int32_t num_blocks_conv = obj->relative.num_blocks;
18861                         return (*env)->NewObject(env, LDKSpendingDelay_Relative_class, LDKSpendingDelay_Relative_meth, num_blocks_conv);
18862                 }
18863                 case LDKSpendingDelay_Absolute: {
18864                         int32_t height_conv = obj->absolute.height;
18865                         return (*env)->NewObject(env, LDKSpendingDelay_Absolute_class, LDKSpendingDelay_Absolute_meth, height_conv);
18866                 }
18867                 default: abort();
18868         }
18869 }
18870 typedef struct LDKFutureCallback_JCalls {
18871         atomic_size_t refcnt;
18872         JavaVM *vm;
18873         jweak o;
18874         jmethodID call_meth;
18875 } LDKFutureCallback_JCalls;
18876 static void LDKFutureCallback_JCalls_free(void* this_arg) {
18877         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
18878         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18887                 if (get_jenv_res == JNI_EDETACHED) {
18888                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18889                 }
18890                 FREE(j_calls);
18891         }
18892 }
18893 void call_LDKFutureCallback_jcall(const void* this_arg) {
18894         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
18895         JNIEnv *env;
18896         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18897         if (get_jenv_res == JNI_EDETACHED) {
18898                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18899         } else {
18900                 DO_ASSERT(get_jenv_res == JNI_OK);
18901         }
18902         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18903         CHECK(obj != NULL);
18904         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
18905         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18906                 (*env)->ExceptionDescribe(env);
18907                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
18908         }
18909         if (get_jenv_res == JNI_EDETACHED) {
18910                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18911         }
18912 }
18913 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
18914         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
18915         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18916 }
18917 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
18918         jclass c = (*env)->GetObjectClass(env, o);
18919         CHECK(c != NULL);
18920         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
18921         atomic_init(&calls->refcnt, 1);
18922         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18923         calls->o = (*env)->NewWeakGlobalRef(env, o);
18924         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
18925         CHECK(calls->call_meth != NULL);
18926
18927         LDKFutureCallback ret = {
18928                 .this_arg = (void*) calls,
18929                 .call = call_LDKFutureCallback_jcall,
18930                 .free = LDKFutureCallback_JCalls_free,
18931         };
18932         return ret;
18933 }
18934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
18935         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
18936         *res_ptr = LDKFutureCallback_init(env, clz, o);
18937         return tag_ptr(res_ptr, true);
18938 }
18939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
18940         void* this_arg_ptr = untag_ptr(this_arg);
18941         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18942         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
18943         (this_arg_conv->call)(this_arg_conv->this_arg);
18944 }
18945
18946 typedef struct LDKEventHandler_JCalls {
18947         atomic_size_t refcnt;
18948         JavaVM *vm;
18949         jweak o;
18950         jmethodID handle_event_meth;
18951 } LDKEventHandler_JCalls;
18952 static void LDKEventHandler_JCalls_free(void* this_arg) {
18953         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
18954         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18955                 JNIEnv *env;
18956                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18957                 if (get_jenv_res == JNI_EDETACHED) {
18958                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18959                 } else {
18960                         DO_ASSERT(get_jenv_res == JNI_OK);
18961                 }
18962                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18963                 if (get_jenv_res == JNI_EDETACHED) {
18964                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18965                 }
18966                 FREE(j_calls);
18967         }
18968 }
18969 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
18970         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
18971         JNIEnv *env;
18972         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18973         if (get_jenv_res == JNI_EDETACHED) {
18974                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18975         } else {
18976                 DO_ASSERT(get_jenv_res == JNI_OK);
18977         }
18978         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18979         *event_copy = event;
18980         int64_t event_ref = tag_ptr(event_copy, true);
18981         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18982         CHECK(obj != NULL);
18983         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
18984         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18985                 (*env)->ExceptionDescribe(env);
18986                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
18987         }
18988         if (get_jenv_res == JNI_EDETACHED) {
18989                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18990         }
18991 }
18992 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
18993         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
18994         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18995 }
18996 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
18997         jclass c = (*env)->GetObjectClass(env, o);
18998         CHECK(c != NULL);
18999         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
19000         atomic_init(&calls->refcnt, 1);
19001         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19002         calls->o = (*env)->NewWeakGlobalRef(env, o);
19003         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
19004         CHECK(calls->handle_event_meth != NULL);
19005
19006         LDKEventHandler ret = {
19007                 .this_arg = (void*) calls,
19008                 .handle_event = handle_event_LDKEventHandler_jcall,
19009                 .free = LDKEventHandler_JCalls_free,
19010         };
19011         return ret;
19012 }
19013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19014         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
19015         *res_ptr = LDKEventHandler_init(env, clz, o);
19016         return tag_ptr(res_ptr, true);
19017 }
19018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
19019         void* this_arg_ptr = untag_ptr(this_arg);
19020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19021         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
19022         void* event_ptr = untag_ptr(event);
19023         CHECK_ACCESS(event_ptr);
19024         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
19025         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
19026         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
19027 }
19028
19029 typedef struct LDKEventsProvider_JCalls {
19030         atomic_size_t refcnt;
19031         JavaVM *vm;
19032         jweak o;
19033         jmethodID process_pending_events_meth;
19034 } LDKEventsProvider_JCalls;
19035 static void LDKEventsProvider_JCalls_free(void* this_arg) {
19036         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
19037         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19038                 JNIEnv *env;
19039                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19040                 if (get_jenv_res == JNI_EDETACHED) {
19041                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19042                 } else {
19043                         DO_ASSERT(get_jenv_res == JNI_OK);
19044                 }
19045                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19046                 if (get_jenv_res == JNI_EDETACHED) {
19047                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19048                 }
19049                 FREE(j_calls);
19050         }
19051 }
19052 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
19053         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
19054         JNIEnv *env;
19055         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19056         if (get_jenv_res == JNI_EDETACHED) {
19057                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19058         } else {
19059                 DO_ASSERT(get_jenv_res == JNI_OK);
19060         }
19061         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
19062         *handler_ret = handler;
19063         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19064         CHECK(obj != NULL);
19065         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
19066         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19067                 (*env)->ExceptionDescribe(env);
19068                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
19069         }
19070         if (get_jenv_res == JNI_EDETACHED) {
19071                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19072         }
19073 }
19074 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
19075         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
19076         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19077 }
19078 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
19079         jclass c = (*env)->GetObjectClass(env, o);
19080         CHECK(c != NULL);
19081         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
19082         atomic_init(&calls->refcnt, 1);
19083         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19084         calls->o = (*env)->NewWeakGlobalRef(env, o);
19085         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
19086         CHECK(calls->process_pending_events_meth != NULL);
19087
19088         LDKEventsProvider ret = {
19089                 .this_arg = (void*) calls,
19090                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
19091                 .free = LDKEventsProvider_JCalls_free,
19092         };
19093         return ret;
19094 }
19095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
19096         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
19097         *res_ptr = LDKEventsProvider_init(env, clz, o);
19098         return tag_ptr(res_ptr, true);
19099 }
19100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
19101         void* this_arg_ptr = untag_ptr(this_arg);
19102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19103         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
19104         void* handler_ptr = untag_ptr(handler);
19105         CHECK_ACCESS(handler_ptr);
19106         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
19107         if (handler_conv.free == LDKEventHandler_JCalls_free) {
19108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19109                 LDKEventHandler_JCalls_cloned(&handler_conv);
19110         }
19111         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
19112 }
19113
19114 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
19115 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
19116 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
19117 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
19118 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
19119 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
19120 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
19121 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
19122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
19123         LDKFailureCode_TemporaryNodeFailure_class =
19124                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
19125         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
19126         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
19127         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
19128         LDKFailureCode_RequiredNodeFeatureMissing_class =
19129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
19130         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
19131         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
19132         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
19133         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
19134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
19135         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
19136         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
19137         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
19138         LDKFailureCode_InvalidOnionPayload_class =
19139                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
19140         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
19141         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
19142         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
19143 }
19144 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19145         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
19146         switch(obj->tag) {
19147                 case LDKFailureCode_TemporaryNodeFailure: {
19148                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
19149                 }
19150                 case LDKFailureCode_RequiredNodeFeatureMissing: {
19151                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
19152                 }
19153                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
19154                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
19155                 }
19156                 case LDKFailureCode_InvalidOnionPayload: {
19157                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
19158                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
19159                 }
19160                 default: abort();
19161         }
19162 }
19163 typedef struct LDKMessageSendEventsProvider_JCalls {
19164         atomic_size_t refcnt;
19165         JavaVM *vm;
19166         jweak o;
19167         jmethodID get_and_clear_pending_msg_events_meth;
19168 } LDKMessageSendEventsProvider_JCalls;
19169 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
19170         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
19171         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19172                 JNIEnv *env;
19173                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19174                 if (get_jenv_res == JNI_EDETACHED) {
19175                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19176                 } else {
19177                         DO_ASSERT(get_jenv_res == JNI_OK);
19178                 }
19179                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19180                 if (get_jenv_res == JNI_EDETACHED) {
19181                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19182                 }
19183                 FREE(j_calls);
19184         }
19185 }
19186 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
19187         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
19188         JNIEnv *env;
19189         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19190         if (get_jenv_res == JNI_EDETACHED) {
19191                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19192         } else {
19193                 DO_ASSERT(get_jenv_res == JNI_OK);
19194         }
19195         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19196         CHECK(obj != NULL);
19197         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
19198         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19199                 (*env)->ExceptionDescribe(env);
19200                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
19201         }
19202         LDKCVec_MessageSendEventZ ret_constr;
19203         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19204         if (ret_constr.datalen > 0)
19205                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19206         else
19207                 ret_constr.data = NULL;
19208         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19209         for (size_t s = 0; s < ret_constr.datalen; s++) {
19210                 int64_t ret_conv_18 = ret_vals[s];
19211                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
19212                 CHECK_ACCESS(ret_conv_18_ptr);
19213                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
19214                 FREE(untag_ptr(ret_conv_18));
19215                 ret_constr.data[s] = ret_conv_18_conv;
19216         }
19217         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19218         if (get_jenv_res == JNI_EDETACHED) {
19219                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19220         }
19221         return ret_constr;
19222 }
19223 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
19224         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
19225         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19226 }
19227 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
19228         jclass c = (*env)->GetObjectClass(env, o);
19229         CHECK(c != NULL);
19230         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
19231         atomic_init(&calls->refcnt, 1);
19232         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19233         calls->o = (*env)->NewWeakGlobalRef(env, o);
19234         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
19235         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
19236
19237         LDKMessageSendEventsProvider ret = {
19238                 .this_arg = (void*) calls,
19239                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
19240                 .free = LDKMessageSendEventsProvider_JCalls_free,
19241         };
19242         return ret;
19243 }
19244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
19245         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19246         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
19247         return tag_ptr(res_ptr, true);
19248 }
19249 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
19250         void* this_arg_ptr = untag_ptr(this_arg);
19251         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19252         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
19253         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
19254         int64_tArray ret_arr = NULL;
19255         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19256         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19257         for (size_t s = 0; s < ret_var.datalen; s++) {
19258                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19259                 *ret_conv_18_copy = ret_var.data[s];
19260                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
19261                 ret_arr_ptr[s] = ret_conv_18_ref;
19262         }
19263         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19264         FREE(ret_var.data);
19265         return ret_arr;
19266 }
19267
19268 typedef struct LDKChannelMessageHandler_JCalls {
19269         atomic_size_t refcnt;
19270         JavaVM *vm;
19271         jweak o;
19272         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
19273         jmethodID handle_open_channel_meth;
19274         jmethodID handle_open_channel_v2_meth;
19275         jmethodID handle_accept_channel_meth;
19276         jmethodID handle_accept_channel_v2_meth;
19277         jmethodID handle_funding_created_meth;
19278         jmethodID handle_funding_signed_meth;
19279         jmethodID handle_channel_ready_meth;
19280         jmethodID handle_shutdown_meth;
19281         jmethodID handle_closing_signed_meth;
19282         jmethodID handle_stfu_meth;
19283         jmethodID handle_tx_add_input_meth;
19284         jmethodID handle_tx_add_output_meth;
19285         jmethodID handle_tx_remove_input_meth;
19286         jmethodID handle_tx_remove_output_meth;
19287         jmethodID handle_tx_complete_meth;
19288         jmethodID handle_tx_signatures_meth;
19289         jmethodID handle_tx_init_rbf_meth;
19290         jmethodID handle_tx_ack_rbf_meth;
19291         jmethodID handle_tx_abort_meth;
19292         jmethodID handle_update_add_htlc_meth;
19293         jmethodID handle_update_fulfill_htlc_meth;
19294         jmethodID handle_update_fail_htlc_meth;
19295         jmethodID handle_update_fail_malformed_htlc_meth;
19296         jmethodID handle_commitment_signed_meth;
19297         jmethodID handle_revoke_and_ack_meth;
19298         jmethodID handle_update_fee_meth;
19299         jmethodID handle_announcement_signatures_meth;
19300         jmethodID peer_disconnected_meth;
19301         jmethodID peer_connected_meth;
19302         jmethodID handle_channel_reestablish_meth;
19303         jmethodID handle_channel_update_meth;
19304         jmethodID handle_error_meth;
19305         jmethodID provided_node_features_meth;
19306         jmethodID provided_init_features_meth;
19307         jmethodID get_chain_hashes_meth;
19308 } LDKChannelMessageHandler_JCalls;
19309 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
19310         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19311         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19312                 JNIEnv *env;
19313                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19314                 if (get_jenv_res == JNI_EDETACHED) {
19315                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19316                 } else {
19317                         DO_ASSERT(get_jenv_res == JNI_OK);
19318                 }
19319                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19320                 if (get_jenv_res == JNI_EDETACHED) {
19321                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19322                 }
19323                 FREE(j_calls);
19324         }
19325 }
19326 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
19327         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19328         JNIEnv *env;
19329         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19330         if (get_jenv_res == JNI_EDETACHED) {
19331                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19332         } else {
19333                 DO_ASSERT(get_jenv_res == JNI_OK);
19334         }
19335         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19336         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19337         LDKOpenChannel msg_var = *msg;
19338         int64_t msg_ref = 0;
19339         msg_var = OpenChannel_clone(&msg_var);
19340         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19341         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19342         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19343         CHECK(obj != NULL);
19344         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
19345         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19346                 (*env)->ExceptionDescribe(env);
19347                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
19348         }
19349         if (get_jenv_res == JNI_EDETACHED) {
19350                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19351         }
19352 }
19353 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
19354         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19355         JNIEnv *env;
19356         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19357         if (get_jenv_res == JNI_EDETACHED) {
19358                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19359         } else {
19360                 DO_ASSERT(get_jenv_res == JNI_OK);
19361         }
19362         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19363         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19364         LDKOpenChannelV2 msg_var = *msg;
19365         int64_t msg_ref = 0;
19366         msg_var = OpenChannelV2_clone(&msg_var);
19367         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19368         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19369         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19370         CHECK(obj != NULL);
19371         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
19372         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19373                 (*env)->ExceptionDescribe(env);
19374                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
19375         }
19376         if (get_jenv_res == JNI_EDETACHED) {
19377                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19378         }
19379 }
19380 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
19381         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19382         JNIEnv *env;
19383         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19384         if (get_jenv_res == JNI_EDETACHED) {
19385                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19386         } else {
19387                 DO_ASSERT(get_jenv_res == JNI_OK);
19388         }
19389         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19390         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19391         LDKAcceptChannel msg_var = *msg;
19392         int64_t msg_ref = 0;
19393         msg_var = AcceptChannel_clone(&msg_var);
19394         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19395         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19396         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19397         CHECK(obj != NULL);
19398         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
19399         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19400                 (*env)->ExceptionDescribe(env);
19401                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
19402         }
19403         if (get_jenv_res == JNI_EDETACHED) {
19404                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19405         }
19406 }
19407 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
19408         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19409         JNIEnv *env;
19410         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19411         if (get_jenv_res == JNI_EDETACHED) {
19412                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19413         } else {
19414                 DO_ASSERT(get_jenv_res == JNI_OK);
19415         }
19416         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19417         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19418         LDKAcceptChannelV2 msg_var = *msg;
19419         int64_t msg_ref = 0;
19420         msg_var = AcceptChannelV2_clone(&msg_var);
19421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19422         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19423         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19424         CHECK(obj != NULL);
19425         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
19426         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19427                 (*env)->ExceptionDescribe(env);
19428                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
19429         }
19430         if (get_jenv_res == JNI_EDETACHED) {
19431                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19432         }
19433 }
19434 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
19435         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19436         JNIEnv *env;
19437         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19438         if (get_jenv_res == JNI_EDETACHED) {
19439                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19440         } else {
19441                 DO_ASSERT(get_jenv_res == JNI_OK);
19442         }
19443         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19444         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19445         LDKFundingCreated msg_var = *msg;
19446         int64_t msg_ref = 0;
19447         msg_var = FundingCreated_clone(&msg_var);
19448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19449         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19450         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19451         CHECK(obj != NULL);
19452         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
19453         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19454                 (*env)->ExceptionDescribe(env);
19455                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
19456         }
19457         if (get_jenv_res == JNI_EDETACHED) {
19458                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19459         }
19460 }
19461 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
19462         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19463         JNIEnv *env;
19464         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19465         if (get_jenv_res == JNI_EDETACHED) {
19466                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19467         } else {
19468                 DO_ASSERT(get_jenv_res == JNI_OK);
19469         }
19470         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19471         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19472         LDKFundingSigned msg_var = *msg;
19473         int64_t msg_ref = 0;
19474         msg_var = FundingSigned_clone(&msg_var);
19475         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19476         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19477         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19478         CHECK(obj != NULL);
19479         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
19480         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19481                 (*env)->ExceptionDescribe(env);
19482                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
19483         }
19484         if (get_jenv_res == JNI_EDETACHED) {
19485                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19486         }
19487 }
19488 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
19489         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19490         JNIEnv *env;
19491         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19492         if (get_jenv_res == JNI_EDETACHED) {
19493                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19494         } else {
19495                 DO_ASSERT(get_jenv_res == JNI_OK);
19496         }
19497         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19498         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19499         LDKChannelReady msg_var = *msg;
19500         int64_t msg_ref = 0;
19501         msg_var = ChannelReady_clone(&msg_var);
19502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19503         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19504         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19505         CHECK(obj != NULL);
19506         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
19507         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19508                 (*env)->ExceptionDescribe(env);
19509                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
19510         }
19511         if (get_jenv_res == JNI_EDETACHED) {
19512                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19513         }
19514 }
19515 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
19516         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19517         JNIEnv *env;
19518         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19519         if (get_jenv_res == JNI_EDETACHED) {
19520                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19521         } else {
19522                 DO_ASSERT(get_jenv_res == JNI_OK);
19523         }
19524         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19525         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19526         LDKShutdown msg_var = *msg;
19527         int64_t msg_ref = 0;
19528         msg_var = Shutdown_clone(&msg_var);
19529         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19530         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19531         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19532         CHECK(obj != NULL);
19533         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
19534         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19535                 (*env)->ExceptionDescribe(env);
19536                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
19537         }
19538         if (get_jenv_res == JNI_EDETACHED) {
19539                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19540         }
19541 }
19542 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
19543         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19544         JNIEnv *env;
19545         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19546         if (get_jenv_res == JNI_EDETACHED) {
19547                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19548         } else {
19549                 DO_ASSERT(get_jenv_res == JNI_OK);
19550         }
19551         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19552         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19553         LDKClosingSigned msg_var = *msg;
19554         int64_t msg_ref = 0;
19555         msg_var = ClosingSigned_clone(&msg_var);
19556         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19557         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19558         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19559         CHECK(obj != NULL);
19560         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
19561         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19562                 (*env)->ExceptionDescribe(env);
19563                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
19564         }
19565         if (get_jenv_res == JNI_EDETACHED) {
19566                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19567         }
19568 }
19569 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
19570         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19571         JNIEnv *env;
19572         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19573         if (get_jenv_res == JNI_EDETACHED) {
19574                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19575         } else {
19576                 DO_ASSERT(get_jenv_res == JNI_OK);
19577         }
19578         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19579         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19580         LDKStfu msg_var = *msg;
19581         int64_t msg_ref = 0;
19582         msg_var = Stfu_clone(&msg_var);
19583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19584         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19585         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19586         CHECK(obj != NULL);
19587         (*env)->CallVoidMethod(env, obj, j_calls->handle_stfu_meth, their_node_id_arr, msg_ref);
19588         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19589                 (*env)->ExceptionDescribe(env);
19590                 (*env)->FatalError(env, "A call to handle_stfu in LDKChannelMessageHandler from rust threw an exception.");
19591         }
19592         if (get_jenv_res == JNI_EDETACHED) {
19593                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19594         }
19595 }
19596 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
19597         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19598         JNIEnv *env;
19599         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19600         if (get_jenv_res == JNI_EDETACHED) {
19601                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19602         } else {
19603                 DO_ASSERT(get_jenv_res == JNI_OK);
19604         }
19605         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19606         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19607         LDKTxAddInput msg_var = *msg;
19608         int64_t msg_ref = 0;
19609         msg_var = TxAddInput_clone(&msg_var);
19610         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19611         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19612         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19613         CHECK(obj != NULL);
19614         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
19615         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19616                 (*env)->ExceptionDescribe(env);
19617                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
19618         }
19619         if (get_jenv_res == JNI_EDETACHED) {
19620                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19621         }
19622 }
19623 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
19624         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19625         JNIEnv *env;
19626         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19627         if (get_jenv_res == JNI_EDETACHED) {
19628                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19629         } else {
19630                 DO_ASSERT(get_jenv_res == JNI_OK);
19631         }
19632         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19633         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19634         LDKTxAddOutput msg_var = *msg;
19635         int64_t msg_ref = 0;
19636         msg_var = TxAddOutput_clone(&msg_var);
19637         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19638         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19639         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19640         CHECK(obj != NULL);
19641         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
19642         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19643                 (*env)->ExceptionDescribe(env);
19644                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
19645         }
19646         if (get_jenv_res == JNI_EDETACHED) {
19647                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19648         }
19649 }
19650 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
19651         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19652         JNIEnv *env;
19653         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19654         if (get_jenv_res == JNI_EDETACHED) {
19655                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19656         } else {
19657                 DO_ASSERT(get_jenv_res == JNI_OK);
19658         }
19659         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19660         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19661         LDKTxRemoveInput msg_var = *msg;
19662         int64_t msg_ref = 0;
19663         msg_var = TxRemoveInput_clone(&msg_var);
19664         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19665         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19666         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19667         CHECK(obj != NULL);
19668         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
19669         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19670                 (*env)->ExceptionDescribe(env);
19671                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
19672         }
19673         if (get_jenv_res == JNI_EDETACHED) {
19674                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19675         }
19676 }
19677 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
19678         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19679         JNIEnv *env;
19680         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19681         if (get_jenv_res == JNI_EDETACHED) {
19682                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19683         } else {
19684                 DO_ASSERT(get_jenv_res == JNI_OK);
19685         }
19686         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19687         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19688         LDKTxRemoveOutput msg_var = *msg;
19689         int64_t msg_ref = 0;
19690         msg_var = TxRemoveOutput_clone(&msg_var);
19691         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19692         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19693         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19694         CHECK(obj != NULL);
19695         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
19696         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19697                 (*env)->ExceptionDescribe(env);
19698                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
19699         }
19700         if (get_jenv_res == JNI_EDETACHED) {
19701                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19702         }
19703 }
19704 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
19705         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19706         JNIEnv *env;
19707         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19708         if (get_jenv_res == JNI_EDETACHED) {
19709                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19710         } else {
19711                 DO_ASSERT(get_jenv_res == JNI_OK);
19712         }
19713         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19714         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19715         LDKTxComplete msg_var = *msg;
19716         int64_t msg_ref = 0;
19717         msg_var = TxComplete_clone(&msg_var);
19718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19719         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19720         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19721         CHECK(obj != NULL);
19722         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
19723         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19724                 (*env)->ExceptionDescribe(env);
19725                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
19726         }
19727         if (get_jenv_res == JNI_EDETACHED) {
19728                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19729         }
19730 }
19731 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
19732         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19733         JNIEnv *env;
19734         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19735         if (get_jenv_res == JNI_EDETACHED) {
19736                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19737         } else {
19738                 DO_ASSERT(get_jenv_res == JNI_OK);
19739         }
19740         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19741         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19742         LDKTxSignatures msg_var = *msg;
19743         int64_t msg_ref = 0;
19744         msg_var = TxSignatures_clone(&msg_var);
19745         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19746         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19747         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19748         CHECK(obj != NULL);
19749         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
19750         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19751                 (*env)->ExceptionDescribe(env);
19752                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
19753         }
19754         if (get_jenv_res == JNI_EDETACHED) {
19755                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19756         }
19757 }
19758 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
19759         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19760         JNIEnv *env;
19761         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19762         if (get_jenv_res == JNI_EDETACHED) {
19763                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19764         } else {
19765                 DO_ASSERT(get_jenv_res == JNI_OK);
19766         }
19767         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19768         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19769         LDKTxInitRbf msg_var = *msg;
19770         int64_t msg_ref = 0;
19771         msg_var = TxInitRbf_clone(&msg_var);
19772         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19773         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19774         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19775         CHECK(obj != NULL);
19776         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
19777         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19778                 (*env)->ExceptionDescribe(env);
19779                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
19780         }
19781         if (get_jenv_res == JNI_EDETACHED) {
19782                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19783         }
19784 }
19785 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
19786         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19787         JNIEnv *env;
19788         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19789         if (get_jenv_res == JNI_EDETACHED) {
19790                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19791         } else {
19792                 DO_ASSERT(get_jenv_res == JNI_OK);
19793         }
19794         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19795         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19796         LDKTxAckRbf msg_var = *msg;
19797         int64_t msg_ref = 0;
19798         msg_var = TxAckRbf_clone(&msg_var);
19799         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19800         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19801         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19802         CHECK(obj != NULL);
19803         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
19804         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19805                 (*env)->ExceptionDescribe(env);
19806                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
19807         }
19808         if (get_jenv_res == JNI_EDETACHED) {
19809                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19810         }
19811 }
19812 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
19813         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19814         JNIEnv *env;
19815         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19816         if (get_jenv_res == JNI_EDETACHED) {
19817                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19818         } else {
19819                 DO_ASSERT(get_jenv_res == JNI_OK);
19820         }
19821         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19822         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19823         LDKTxAbort msg_var = *msg;
19824         int64_t msg_ref = 0;
19825         msg_var = TxAbort_clone(&msg_var);
19826         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19827         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19828         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19829         CHECK(obj != NULL);
19830         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
19831         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19832                 (*env)->ExceptionDescribe(env);
19833                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
19834         }
19835         if (get_jenv_res == JNI_EDETACHED) {
19836                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19837         }
19838 }
19839 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
19840         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19841         JNIEnv *env;
19842         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19843         if (get_jenv_res == JNI_EDETACHED) {
19844                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19845         } else {
19846                 DO_ASSERT(get_jenv_res == JNI_OK);
19847         }
19848         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19849         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19850         LDKUpdateAddHTLC msg_var = *msg;
19851         int64_t msg_ref = 0;
19852         msg_var = UpdateAddHTLC_clone(&msg_var);
19853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19854         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19855         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19856         CHECK(obj != NULL);
19857         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
19858         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19859                 (*env)->ExceptionDescribe(env);
19860                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
19861         }
19862         if (get_jenv_res == JNI_EDETACHED) {
19863                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19864         }
19865 }
19866 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
19867         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19868         JNIEnv *env;
19869         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19870         if (get_jenv_res == JNI_EDETACHED) {
19871                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19872         } else {
19873                 DO_ASSERT(get_jenv_res == JNI_OK);
19874         }
19875         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19876         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19877         LDKUpdateFulfillHTLC msg_var = *msg;
19878         int64_t msg_ref = 0;
19879         msg_var = UpdateFulfillHTLC_clone(&msg_var);
19880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19881         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19882         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19883         CHECK(obj != NULL);
19884         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
19885         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19886                 (*env)->ExceptionDescribe(env);
19887                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
19888         }
19889         if (get_jenv_res == JNI_EDETACHED) {
19890                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19891         }
19892 }
19893 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
19894         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19895         JNIEnv *env;
19896         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19897         if (get_jenv_res == JNI_EDETACHED) {
19898                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19899         } else {
19900                 DO_ASSERT(get_jenv_res == JNI_OK);
19901         }
19902         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19903         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19904         LDKUpdateFailHTLC msg_var = *msg;
19905         int64_t msg_ref = 0;
19906         msg_var = UpdateFailHTLC_clone(&msg_var);
19907         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19908         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19909         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19910         CHECK(obj != NULL);
19911         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
19912         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19913                 (*env)->ExceptionDescribe(env);
19914                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
19915         }
19916         if (get_jenv_res == JNI_EDETACHED) {
19917                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19918         }
19919 }
19920 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
19921         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19922         JNIEnv *env;
19923         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19924         if (get_jenv_res == JNI_EDETACHED) {
19925                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19926         } else {
19927                 DO_ASSERT(get_jenv_res == JNI_OK);
19928         }
19929         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19930         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19931         LDKUpdateFailMalformedHTLC msg_var = *msg;
19932         int64_t msg_ref = 0;
19933         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
19934         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19935         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19936         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19937         CHECK(obj != NULL);
19938         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
19939         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19940                 (*env)->ExceptionDescribe(env);
19941                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
19942         }
19943         if (get_jenv_res == JNI_EDETACHED) {
19944                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19945         }
19946 }
19947 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
19948         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19949         JNIEnv *env;
19950         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19951         if (get_jenv_res == JNI_EDETACHED) {
19952                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19953         } else {
19954                 DO_ASSERT(get_jenv_res == JNI_OK);
19955         }
19956         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19957         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19958         LDKCommitmentSigned msg_var = *msg;
19959         int64_t msg_ref = 0;
19960         msg_var = CommitmentSigned_clone(&msg_var);
19961         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19962         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19963         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19964         CHECK(obj != NULL);
19965         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
19966         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19967                 (*env)->ExceptionDescribe(env);
19968                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
19969         }
19970         if (get_jenv_res == JNI_EDETACHED) {
19971                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19972         }
19973 }
19974 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
19975         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19976         JNIEnv *env;
19977         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19978         if (get_jenv_res == JNI_EDETACHED) {
19979                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19980         } else {
19981                 DO_ASSERT(get_jenv_res == JNI_OK);
19982         }
19983         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19984         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19985         LDKRevokeAndACK msg_var = *msg;
19986         int64_t msg_ref = 0;
19987         msg_var = RevokeAndACK_clone(&msg_var);
19988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19989         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19990         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19991         CHECK(obj != NULL);
19992         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
19993         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19994                 (*env)->ExceptionDescribe(env);
19995                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
19996         }
19997         if (get_jenv_res == JNI_EDETACHED) {
19998                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19999         }
20000 }
20001 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
20002         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20003         JNIEnv *env;
20004         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20005         if (get_jenv_res == JNI_EDETACHED) {
20006                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20007         } else {
20008                 DO_ASSERT(get_jenv_res == JNI_OK);
20009         }
20010         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20011         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20012         LDKUpdateFee msg_var = *msg;
20013         int64_t msg_ref = 0;
20014         msg_var = UpdateFee_clone(&msg_var);
20015         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20016         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20017         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20018         CHECK(obj != NULL);
20019         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
20020         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20021                 (*env)->ExceptionDescribe(env);
20022                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
20023         }
20024         if (get_jenv_res == JNI_EDETACHED) {
20025                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20026         }
20027 }
20028 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
20029         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20030         JNIEnv *env;
20031         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20032         if (get_jenv_res == JNI_EDETACHED) {
20033                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20034         } else {
20035                 DO_ASSERT(get_jenv_res == JNI_OK);
20036         }
20037         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20038         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20039         LDKAnnouncementSignatures msg_var = *msg;
20040         int64_t msg_ref = 0;
20041         msg_var = AnnouncementSignatures_clone(&msg_var);
20042         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20043         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20044         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20045         CHECK(obj != NULL);
20046         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
20047         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20048                 (*env)->ExceptionDescribe(env);
20049                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
20050         }
20051         if (get_jenv_res == JNI_EDETACHED) {
20052                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20053         }
20054 }
20055 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20056         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20057         JNIEnv *env;
20058         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20059         if (get_jenv_res == JNI_EDETACHED) {
20060                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20061         } else {
20062                 DO_ASSERT(get_jenv_res == JNI_OK);
20063         }
20064         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20065         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20066         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20067         CHECK(obj != NULL);
20068         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
20069         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20070                 (*env)->ExceptionDescribe(env);
20071                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
20072         }
20073         if (get_jenv_res == JNI_EDETACHED) {
20074                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20075         }
20076 }
20077 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
20078         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20079         JNIEnv *env;
20080         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20081         if (get_jenv_res == JNI_EDETACHED) {
20082                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20083         } else {
20084                 DO_ASSERT(get_jenv_res == JNI_OK);
20085         }
20086         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20087         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20088         LDKInit msg_var = *msg;
20089         int64_t msg_ref = 0;
20090         msg_var = Init_clone(&msg_var);
20091         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20092         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20093         jboolean inbound_conv = inbound;
20094         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20095         CHECK(obj != NULL);
20096         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
20097         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20098                 (*env)->ExceptionDescribe(env);
20099                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
20100         }
20101         void* ret_ptr = untag_ptr(ret);
20102         CHECK_ACCESS(ret_ptr);
20103         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
20104         FREE(untag_ptr(ret));
20105         if (get_jenv_res == JNI_EDETACHED) {
20106                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20107         }
20108         return ret_conv;
20109 }
20110 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
20111         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20112         JNIEnv *env;
20113         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20114         if (get_jenv_res == JNI_EDETACHED) {
20115                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20116         } else {
20117                 DO_ASSERT(get_jenv_res == JNI_OK);
20118         }
20119         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20120         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20121         LDKChannelReestablish msg_var = *msg;
20122         int64_t msg_ref = 0;
20123         msg_var = ChannelReestablish_clone(&msg_var);
20124         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20125         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20126         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20127         CHECK(obj != NULL);
20128         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
20129         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20130                 (*env)->ExceptionDescribe(env);
20131                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
20132         }
20133         if (get_jenv_res == JNI_EDETACHED) {
20134                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20135         }
20136 }
20137 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
20138         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20139         JNIEnv *env;
20140         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20141         if (get_jenv_res == JNI_EDETACHED) {
20142                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20143         } else {
20144                 DO_ASSERT(get_jenv_res == JNI_OK);
20145         }
20146         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20147         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20148         LDKChannelUpdate msg_var = *msg;
20149         int64_t msg_ref = 0;
20150         msg_var = ChannelUpdate_clone(&msg_var);
20151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20152         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20153         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20154         CHECK(obj != NULL);
20155         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
20156         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20157                 (*env)->ExceptionDescribe(env);
20158                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
20159         }
20160         if (get_jenv_res == JNI_EDETACHED) {
20161                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20162         }
20163 }
20164 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
20165         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20166         JNIEnv *env;
20167         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20168         if (get_jenv_res == JNI_EDETACHED) {
20169                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20170         } else {
20171                 DO_ASSERT(get_jenv_res == JNI_OK);
20172         }
20173         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20174         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20175         LDKErrorMessage msg_var = *msg;
20176         int64_t msg_ref = 0;
20177         msg_var = ErrorMessage_clone(&msg_var);
20178         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20179         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20180         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20181         CHECK(obj != NULL);
20182         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
20183         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20184                 (*env)->ExceptionDescribe(env);
20185                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
20186         }
20187         if (get_jenv_res == JNI_EDETACHED) {
20188                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20189         }
20190 }
20191 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
20192         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20193         JNIEnv *env;
20194         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20195         if (get_jenv_res == JNI_EDETACHED) {
20196                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20197         } else {
20198                 DO_ASSERT(get_jenv_res == JNI_OK);
20199         }
20200         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20201         CHECK(obj != NULL);
20202         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
20203         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20204                 (*env)->ExceptionDescribe(env);
20205                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
20206         }
20207         LDKNodeFeatures ret_conv;
20208         ret_conv.inner = untag_ptr(ret);
20209         ret_conv.is_owned = ptr_is_owned(ret);
20210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20211         if (get_jenv_res == JNI_EDETACHED) {
20212                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20213         }
20214         return ret_conv;
20215 }
20216 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20217         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20218         JNIEnv *env;
20219         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20220         if (get_jenv_res == JNI_EDETACHED) {
20221                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20222         } else {
20223                 DO_ASSERT(get_jenv_res == JNI_OK);
20224         }
20225         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20226         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20227         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20228         CHECK(obj != NULL);
20229         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
20230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20231                 (*env)->ExceptionDescribe(env);
20232                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
20233         }
20234         LDKInitFeatures ret_conv;
20235         ret_conv.inner = untag_ptr(ret);
20236         ret_conv.is_owned = ptr_is_owned(ret);
20237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20238         if (get_jenv_res == JNI_EDETACHED) {
20239                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20240         }
20241         return ret_conv;
20242 }
20243 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
20244         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
20245         JNIEnv *env;
20246         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20247         if (get_jenv_res == JNI_EDETACHED) {
20248                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20249         } else {
20250                 DO_ASSERT(get_jenv_res == JNI_OK);
20251         }
20252         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20253         CHECK(obj != NULL);
20254         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
20255         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20256                 (*env)->ExceptionDescribe(env);
20257                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
20258         }
20259         void* ret_ptr = untag_ptr(ret);
20260         CHECK_ACCESS(ret_ptr);
20261         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
20262         FREE(untag_ptr(ret));
20263         if (get_jenv_res == JNI_EDETACHED) {
20264                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20265         }
20266         return ret_conv;
20267 }
20268 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
20269         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
20270         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20271         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
20272 }
20273 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
20274         jclass c = (*env)->GetObjectClass(env, o);
20275         CHECK(c != NULL);
20276         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
20277         atomic_init(&calls->refcnt, 1);
20278         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20279         calls->o = (*env)->NewWeakGlobalRef(env, o);
20280         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
20281         CHECK(calls->handle_open_channel_meth != NULL);
20282         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
20283         CHECK(calls->handle_open_channel_v2_meth != NULL);
20284         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
20285         CHECK(calls->handle_accept_channel_meth != NULL);
20286         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
20287         CHECK(calls->handle_accept_channel_v2_meth != NULL);
20288         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
20289         CHECK(calls->handle_funding_created_meth != NULL);
20290         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
20291         CHECK(calls->handle_funding_signed_meth != NULL);
20292         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
20293         CHECK(calls->handle_channel_ready_meth != NULL);
20294         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
20295         CHECK(calls->handle_shutdown_meth != NULL);
20296         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
20297         CHECK(calls->handle_closing_signed_meth != NULL);
20298         calls->handle_stfu_meth = (*env)->GetMethodID(env, c, "handle_stfu", "([BJ)V");
20299         CHECK(calls->handle_stfu_meth != NULL);
20300         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
20301         CHECK(calls->handle_tx_add_input_meth != NULL);
20302         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
20303         CHECK(calls->handle_tx_add_output_meth != NULL);
20304         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
20305         CHECK(calls->handle_tx_remove_input_meth != NULL);
20306         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
20307         CHECK(calls->handle_tx_remove_output_meth != NULL);
20308         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
20309         CHECK(calls->handle_tx_complete_meth != NULL);
20310         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
20311         CHECK(calls->handle_tx_signatures_meth != NULL);
20312         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
20313         CHECK(calls->handle_tx_init_rbf_meth != NULL);
20314         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
20315         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
20316         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
20317         CHECK(calls->handle_tx_abort_meth != NULL);
20318         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
20319         CHECK(calls->handle_update_add_htlc_meth != NULL);
20320         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
20321         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
20322         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
20323         CHECK(calls->handle_update_fail_htlc_meth != NULL);
20324         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
20325         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
20326         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
20327         CHECK(calls->handle_commitment_signed_meth != NULL);
20328         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
20329         CHECK(calls->handle_revoke_and_ack_meth != NULL);
20330         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
20331         CHECK(calls->handle_update_fee_meth != NULL);
20332         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
20333         CHECK(calls->handle_announcement_signatures_meth != NULL);
20334         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
20335         CHECK(calls->peer_disconnected_meth != NULL);
20336         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
20337         CHECK(calls->peer_connected_meth != NULL);
20338         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
20339         CHECK(calls->handle_channel_reestablish_meth != NULL);
20340         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
20341         CHECK(calls->handle_channel_update_meth != NULL);
20342         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
20343         CHECK(calls->handle_error_meth != NULL);
20344         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20345         CHECK(calls->provided_node_features_meth != NULL);
20346         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20347         CHECK(calls->provided_init_features_meth != NULL);
20348         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
20349         CHECK(calls->get_chain_hashes_meth != NULL);
20350
20351         LDKChannelMessageHandler ret = {
20352                 .this_arg = (void*) calls,
20353                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
20354                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
20355                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
20356                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
20357                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
20358                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
20359                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
20360                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
20361                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
20362                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
20363                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
20364                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
20365                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
20366                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
20367                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
20368                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
20369                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
20370                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
20371                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
20372                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
20373                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
20374                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
20375                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
20376                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
20377                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
20378                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
20379                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
20380                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
20381                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
20382                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
20383                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
20384                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
20385                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
20386                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
20387                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
20388                 .free = LDKChannelMessageHandler_JCalls_free,
20389                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
20390         };
20391         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
20392         return ret;
20393 }
20394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
20395         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20396         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
20397         return tag_ptr(res_ptr, true);
20398 }
20399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
20400         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
20401         return tag_ptr(&inp->MessageSendEventsProvider, false);
20402 }
20403 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) {
20404         void* this_arg_ptr = untag_ptr(this_arg);
20405         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20406         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20407         LDKPublicKey their_node_id_ref;
20408         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20409         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20410         LDKOpenChannel msg_conv;
20411         msg_conv.inner = untag_ptr(msg);
20412         msg_conv.is_owned = ptr_is_owned(msg);
20413         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20414         msg_conv.is_owned = false;
20415         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20416 }
20417
20418 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) {
20419         void* this_arg_ptr = untag_ptr(this_arg);
20420         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20421         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20422         LDKPublicKey their_node_id_ref;
20423         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20424         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20425         LDKOpenChannelV2 msg_conv;
20426         msg_conv.inner = untag_ptr(msg);
20427         msg_conv.is_owned = ptr_is_owned(msg);
20428         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20429         msg_conv.is_owned = false;
20430         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20431 }
20432
20433 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) {
20434         void* this_arg_ptr = untag_ptr(this_arg);
20435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20436         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20437         LDKPublicKey their_node_id_ref;
20438         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20439         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20440         LDKAcceptChannel msg_conv;
20441         msg_conv.inner = untag_ptr(msg);
20442         msg_conv.is_owned = ptr_is_owned(msg);
20443         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20444         msg_conv.is_owned = false;
20445         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20446 }
20447
20448 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) {
20449         void* this_arg_ptr = untag_ptr(this_arg);
20450         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20451         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20452         LDKPublicKey their_node_id_ref;
20453         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20454         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20455         LDKAcceptChannelV2 msg_conv;
20456         msg_conv.inner = untag_ptr(msg);
20457         msg_conv.is_owned = ptr_is_owned(msg);
20458         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20459         msg_conv.is_owned = false;
20460         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20461 }
20462
20463 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) {
20464         void* this_arg_ptr = untag_ptr(this_arg);
20465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20466         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20467         LDKPublicKey their_node_id_ref;
20468         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20469         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20470         LDKFundingCreated msg_conv;
20471         msg_conv.inner = untag_ptr(msg);
20472         msg_conv.is_owned = ptr_is_owned(msg);
20473         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20474         msg_conv.is_owned = false;
20475         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20476 }
20477
20478 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) {
20479         void* this_arg_ptr = untag_ptr(this_arg);
20480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20481         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20482         LDKPublicKey their_node_id_ref;
20483         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20484         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20485         LDKFundingSigned msg_conv;
20486         msg_conv.inner = untag_ptr(msg);
20487         msg_conv.is_owned = ptr_is_owned(msg);
20488         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20489         msg_conv.is_owned = false;
20490         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20491 }
20492
20493 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) {
20494         void* this_arg_ptr = untag_ptr(this_arg);
20495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20496         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20497         LDKPublicKey their_node_id_ref;
20498         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20499         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20500         LDKChannelReady msg_conv;
20501         msg_conv.inner = untag_ptr(msg);
20502         msg_conv.is_owned = ptr_is_owned(msg);
20503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20504         msg_conv.is_owned = false;
20505         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20506 }
20507
20508 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) {
20509         void* this_arg_ptr = untag_ptr(this_arg);
20510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20511         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20512         LDKPublicKey their_node_id_ref;
20513         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20514         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20515         LDKShutdown msg_conv;
20516         msg_conv.inner = untag_ptr(msg);
20517         msg_conv.is_owned = ptr_is_owned(msg);
20518         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20519         msg_conv.is_owned = false;
20520         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20521 }
20522
20523 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) {
20524         void* this_arg_ptr = untag_ptr(this_arg);
20525         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20526         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20527         LDKPublicKey their_node_id_ref;
20528         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20529         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20530         LDKClosingSigned msg_conv;
20531         msg_conv.inner = untag_ptr(msg);
20532         msg_conv.is_owned = ptr_is_owned(msg);
20533         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20534         msg_conv.is_owned = false;
20535         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20536 }
20537
20538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1stfu(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
20539         void* this_arg_ptr = untag_ptr(this_arg);
20540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20541         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20542         LDKPublicKey their_node_id_ref;
20543         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20544         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20545         LDKStfu msg_conv;
20546         msg_conv.inner = untag_ptr(msg);
20547         msg_conv.is_owned = ptr_is_owned(msg);
20548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20549         msg_conv.is_owned = false;
20550         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20551 }
20552
20553 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) {
20554         void* this_arg_ptr = untag_ptr(this_arg);
20555         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20556         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20557         LDKPublicKey their_node_id_ref;
20558         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20559         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20560         LDKTxAddInput msg_conv;
20561         msg_conv.inner = untag_ptr(msg);
20562         msg_conv.is_owned = ptr_is_owned(msg);
20563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20564         msg_conv.is_owned = false;
20565         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20566 }
20567
20568 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) {
20569         void* this_arg_ptr = untag_ptr(this_arg);
20570         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20571         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20572         LDKPublicKey their_node_id_ref;
20573         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20574         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20575         LDKTxAddOutput msg_conv;
20576         msg_conv.inner = untag_ptr(msg);
20577         msg_conv.is_owned = ptr_is_owned(msg);
20578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20579         msg_conv.is_owned = false;
20580         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20581 }
20582
20583 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) {
20584         void* this_arg_ptr = untag_ptr(this_arg);
20585         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20586         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20587         LDKPublicKey their_node_id_ref;
20588         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20589         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20590         LDKTxRemoveInput msg_conv;
20591         msg_conv.inner = untag_ptr(msg);
20592         msg_conv.is_owned = ptr_is_owned(msg);
20593         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20594         msg_conv.is_owned = false;
20595         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20596 }
20597
20598 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) {
20599         void* this_arg_ptr = untag_ptr(this_arg);
20600         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20601         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20602         LDKPublicKey their_node_id_ref;
20603         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20604         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20605         LDKTxRemoveOutput msg_conv;
20606         msg_conv.inner = untag_ptr(msg);
20607         msg_conv.is_owned = ptr_is_owned(msg);
20608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20609         msg_conv.is_owned = false;
20610         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20611 }
20612
20613 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) {
20614         void* this_arg_ptr = untag_ptr(this_arg);
20615         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20616         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20617         LDKPublicKey their_node_id_ref;
20618         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20619         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20620         LDKTxComplete msg_conv;
20621         msg_conv.inner = untag_ptr(msg);
20622         msg_conv.is_owned = ptr_is_owned(msg);
20623         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20624         msg_conv.is_owned = false;
20625         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20626 }
20627
20628 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) {
20629         void* this_arg_ptr = untag_ptr(this_arg);
20630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20631         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20632         LDKPublicKey their_node_id_ref;
20633         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20634         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20635         LDKTxSignatures msg_conv;
20636         msg_conv.inner = untag_ptr(msg);
20637         msg_conv.is_owned = ptr_is_owned(msg);
20638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20639         msg_conv.is_owned = false;
20640         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20641 }
20642
20643 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) {
20644         void* this_arg_ptr = untag_ptr(this_arg);
20645         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20646         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20647         LDKPublicKey their_node_id_ref;
20648         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20649         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20650         LDKTxInitRbf msg_conv;
20651         msg_conv.inner = untag_ptr(msg);
20652         msg_conv.is_owned = ptr_is_owned(msg);
20653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20654         msg_conv.is_owned = false;
20655         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20656 }
20657
20658 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) {
20659         void* this_arg_ptr = untag_ptr(this_arg);
20660         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20661         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20662         LDKPublicKey their_node_id_ref;
20663         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20664         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20665         LDKTxAckRbf msg_conv;
20666         msg_conv.inner = untag_ptr(msg);
20667         msg_conv.is_owned = ptr_is_owned(msg);
20668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20669         msg_conv.is_owned = false;
20670         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20671 }
20672
20673 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) {
20674         void* this_arg_ptr = untag_ptr(this_arg);
20675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20676         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20677         LDKPublicKey their_node_id_ref;
20678         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20679         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20680         LDKTxAbort msg_conv;
20681         msg_conv.inner = untag_ptr(msg);
20682         msg_conv.is_owned = ptr_is_owned(msg);
20683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20684         msg_conv.is_owned = false;
20685         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20686 }
20687
20688 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) {
20689         void* this_arg_ptr = untag_ptr(this_arg);
20690         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20691         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20692         LDKPublicKey their_node_id_ref;
20693         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20694         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20695         LDKUpdateAddHTLC msg_conv;
20696         msg_conv.inner = untag_ptr(msg);
20697         msg_conv.is_owned = ptr_is_owned(msg);
20698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20699         msg_conv.is_owned = false;
20700         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20701 }
20702
20703 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) {
20704         void* this_arg_ptr = untag_ptr(this_arg);
20705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20706         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20707         LDKPublicKey their_node_id_ref;
20708         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20709         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20710         LDKUpdateFulfillHTLC msg_conv;
20711         msg_conv.inner = untag_ptr(msg);
20712         msg_conv.is_owned = ptr_is_owned(msg);
20713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20714         msg_conv.is_owned = false;
20715         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20716 }
20717
20718 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) {
20719         void* this_arg_ptr = untag_ptr(this_arg);
20720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20721         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20722         LDKPublicKey their_node_id_ref;
20723         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20724         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20725         LDKUpdateFailHTLC msg_conv;
20726         msg_conv.inner = untag_ptr(msg);
20727         msg_conv.is_owned = ptr_is_owned(msg);
20728         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20729         msg_conv.is_owned = false;
20730         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20731 }
20732
20733 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) {
20734         void* this_arg_ptr = untag_ptr(this_arg);
20735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20736         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20737         LDKPublicKey their_node_id_ref;
20738         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20739         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20740         LDKUpdateFailMalformedHTLC msg_conv;
20741         msg_conv.inner = untag_ptr(msg);
20742         msg_conv.is_owned = ptr_is_owned(msg);
20743         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20744         msg_conv.is_owned = false;
20745         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20746 }
20747
20748 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) {
20749         void* this_arg_ptr = untag_ptr(this_arg);
20750         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20751         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20752         LDKPublicKey their_node_id_ref;
20753         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20754         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20755         LDKCommitmentSigned msg_conv;
20756         msg_conv.inner = untag_ptr(msg);
20757         msg_conv.is_owned = ptr_is_owned(msg);
20758         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20759         msg_conv.is_owned = false;
20760         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20761 }
20762
20763 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) {
20764         void* this_arg_ptr = untag_ptr(this_arg);
20765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20766         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20767         LDKPublicKey their_node_id_ref;
20768         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20769         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20770         LDKRevokeAndACK msg_conv;
20771         msg_conv.inner = untag_ptr(msg);
20772         msg_conv.is_owned = ptr_is_owned(msg);
20773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20774         msg_conv.is_owned = false;
20775         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20776 }
20777
20778 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) {
20779         void* this_arg_ptr = untag_ptr(this_arg);
20780         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20781         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20782         LDKPublicKey their_node_id_ref;
20783         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20784         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20785         LDKUpdateFee msg_conv;
20786         msg_conv.inner = untag_ptr(msg);
20787         msg_conv.is_owned = ptr_is_owned(msg);
20788         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20789         msg_conv.is_owned = false;
20790         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20791 }
20792
20793 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) {
20794         void* this_arg_ptr = untag_ptr(this_arg);
20795         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20796         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20797         LDKPublicKey their_node_id_ref;
20798         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20799         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20800         LDKAnnouncementSignatures msg_conv;
20801         msg_conv.inner = untag_ptr(msg);
20802         msg_conv.is_owned = ptr_is_owned(msg);
20803         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20804         msg_conv.is_owned = false;
20805         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20806 }
20807
20808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20809         void* this_arg_ptr = untag_ptr(this_arg);
20810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20811         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20812         LDKPublicKey their_node_id_ref;
20813         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20814         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20815         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
20816 }
20817
20818 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) {
20819         void* this_arg_ptr = untag_ptr(this_arg);
20820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20821         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20822         LDKPublicKey their_node_id_ref;
20823         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20824         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20825         LDKInit msg_conv;
20826         msg_conv.inner = untag_ptr(msg);
20827         msg_conv.is_owned = ptr_is_owned(msg);
20828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20829         msg_conv.is_owned = false;
20830         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20831         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
20832         return tag_ptr(ret_conv, true);
20833 }
20834
20835 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) {
20836         void* this_arg_ptr = untag_ptr(this_arg);
20837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20838         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20839         LDKPublicKey their_node_id_ref;
20840         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20841         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20842         LDKChannelReestablish msg_conv;
20843         msg_conv.inner = untag_ptr(msg);
20844         msg_conv.is_owned = ptr_is_owned(msg);
20845         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20846         msg_conv.is_owned = false;
20847         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20848 }
20849
20850 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) {
20851         void* this_arg_ptr = untag_ptr(this_arg);
20852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20853         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20854         LDKPublicKey their_node_id_ref;
20855         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20856         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20857         LDKChannelUpdate msg_conv;
20858         msg_conv.inner = untag_ptr(msg);
20859         msg_conv.is_owned = ptr_is_owned(msg);
20860         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20861         msg_conv.is_owned = false;
20862         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20863 }
20864
20865 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) {
20866         void* this_arg_ptr = untag_ptr(this_arg);
20867         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20868         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20869         LDKPublicKey their_node_id_ref;
20870         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20871         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20872         LDKErrorMessage msg_conv;
20873         msg_conv.inner = untag_ptr(msg);
20874         msg_conv.is_owned = ptr_is_owned(msg);
20875         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20876         msg_conv.is_owned = false;
20877         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20878 }
20879
20880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20881         void* this_arg_ptr = untag_ptr(this_arg);
20882         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20883         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20884         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20885         int64_t ret_ref = 0;
20886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20888         return ret_ref;
20889 }
20890
20891 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) {
20892         void* this_arg_ptr = untag_ptr(this_arg);
20893         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20894         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20895         LDKPublicKey their_node_id_ref;
20896         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20897         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20898         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20899         int64_t ret_ref = 0;
20900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20902         return ret_ref;
20903 }
20904
20905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
20906         void* this_arg_ptr = untag_ptr(this_arg);
20907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20908         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20909         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
20910         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
20911         int64_t ret_ref = tag_ptr(ret_copy, true);
20912         return ret_ref;
20913 }
20914
20915 typedef struct LDKOffersMessageHandler_JCalls {
20916         atomic_size_t refcnt;
20917         JavaVM *vm;
20918         jweak o;
20919         jmethodID handle_message_meth;
20920         jmethodID release_pending_messages_meth;
20921 } LDKOffersMessageHandler_JCalls;
20922 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
20923         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20924         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20925                 JNIEnv *env;
20926                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20927                 if (get_jenv_res == JNI_EDETACHED) {
20928                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20929                 } else {
20930                         DO_ASSERT(get_jenv_res == JNI_OK);
20931                 }
20932                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20933                 if (get_jenv_res == JNI_EDETACHED) {
20934                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20935                 }
20936                 FREE(j_calls);
20937         }
20938 }
20939 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
20940         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20941         JNIEnv *env;
20942         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20943         if (get_jenv_res == JNI_EDETACHED) {
20944                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20945         } else {
20946                 DO_ASSERT(get_jenv_res == JNI_OK);
20947         }
20948         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
20949         *message_copy = message;
20950         int64_t message_ref = tag_ptr(message_copy, true);
20951         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20952         CHECK(obj != NULL);
20953         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
20954         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20955                 (*env)->ExceptionDescribe(env);
20956                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
20957         }
20958         void* ret_ptr = untag_ptr(ret);
20959         CHECK_ACCESS(ret_ptr);
20960         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
20961         FREE(untag_ptr(ret));
20962         if (get_jenv_res == JNI_EDETACHED) {
20963                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20964         }
20965         return ret_conv;
20966 }
20967 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
20968         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20969         JNIEnv *env;
20970         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20971         if (get_jenv_res == JNI_EDETACHED) {
20972                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20973         } else {
20974                 DO_ASSERT(get_jenv_res == JNI_OK);
20975         }
20976         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20977         CHECK(obj != NULL);
20978         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
20979         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20980                 (*env)->ExceptionDescribe(env);
20981                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
20982         }
20983         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
20984         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20985         if (ret_constr.datalen > 0)
20986                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
20987         else
20988                 ret_constr.data = NULL;
20989         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20990         for (size_t x = 0; x < ret_constr.datalen; x++) {
20991                 int64_t ret_conv_49 = ret_vals[x];
20992                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
20993                 CHECK_ACCESS(ret_conv_49_ptr);
20994                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
20995                 FREE(untag_ptr(ret_conv_49));
20996                 ret_constr.data[x] = ret_conv_49_conv;
20997         }
20998         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20999         if (get_jenv_res == JNI_EDETACHED) {
21000                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21001         }
21002         return ret_constr;
21003 }
21004 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
21005         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
21006         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21007 }
21008 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
21009         jclass c = (*env)->GetObjectClass(env, o);
21010         CHECK(c != NULL);
21011         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
21012         atomic_init(&calls->refcnt, 1);
21013         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21014         calls->o = (*env)->NewWeakGlobalRef(env, o);
21015         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
21016         CHECK(calls->handle_message_meth != NULL);
21017         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
21018         CHECK(calls->release_pending_messages_meth != NULL);
21019
21020         LDKOffersMessageHandler ret = {
21021                 .this_arg = (void*) calls,
21022                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
21023                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
21024                 .free = LDKOffersMessageHandler_JCalls_free,
21025         };
21026         return ret;
21027 }
21028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
21029         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
21030         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
21031         return tag_ptr(res_ptr, true);
21032 }
21033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
21034         void* this_arg_ptr = untag_ptr(this_arg);
21035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21036         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
21037         void* message_ptr = untag_ptr(message);
21038         CHECK_ACCESS(message_ptr);
21039         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
21040         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
21041         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
21042         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
21043         int64_t ret_ref = tag_ptr(ret_copy, true);
21044         return ret_ref;
21045 }
21046
21047 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
21048         void* this_arg_ptr = untag_ptr(this_arg);
21049         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21050         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
21051         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
21052         int64_tArray ret_arr = NULL;
21053         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
21054         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
21055         for (size_t x = 0; x < ret_var.datalen; x++) {
21056                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
21057                 *ret_conv_49_conv = ret_var.data[x];
21058                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
21059         }
21060         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
21061         FREE(ret_var.data);
21062         return ret_arr;
21063 }
21064
21065 typedef struct LDKNodeIdLookUp_JCalls {
21066         atomic_size_t refcnt;
21067         JavaVM *vm;
21068         jweak o;
21069         jmethodID next_node_id_meth;
21070 } LDKNodeIdLookUp_JCalls;
21071 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
21072         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
21073         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21074                 JNIEnv *env;
21075                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21076                 if (get_jenv_res == JNI_EDETACHED) {
21077                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21078                 } else {
21079                         DO_ASSERT(get_jenv_res == JNI_OK);
21080                 }
21081                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21082                 if (get_jenv_res == JNI_EDETACHED) {
21083                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21084                 }
21085                 FREE(j_calls);
21086         }
21087 }
21088 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
21089         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
21090         JNIEnv *env;
21091         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21092         if (get_jenv_res == JNI_EDETACHED) {
21093                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21094         } else {
21095                 DO_ASSERT(get_jenv_res == JNI_OK);
21096         }
21097         int64_t short_channel_id_conv = short_channel_id;
21098         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21099         CHECK(obj != NULL);
21100         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->next_node_id_meth, short_channel_id_conv);
21101         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21102                 (*env)->ExceptionDescribe(env);
21103                 (*env)->FatalError(env, "A call to next_node_id in LDKNodeIdLookUp from rust threw an exception.");
21104         }
21105         LDKPublicKey ret_ref;
21106         CHECK((*env)->GetArrayLength(env, ret) == 33);
21107         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
21108         if (get_jenv_res == JNI_EDETACHED) {
21109                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21110         }
21111         return ret_ref;
21112 }
21113 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
21114         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
21115         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21116 }
21117 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (JNIEnv *env, jclass clz, jobject o) {
21118         jclass c = (*env)->GetObjectClass(env, o);
21119         CHECK(c != NULL);
21120         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
21121         atomic_init(&calls->refcnt, 1);
21122         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21123         calls->o = (*env)->NewWeakGlobalRef(env, o);
21124         calls->next_node_id_meth = (*env)->GetMethodID(env, c, "next_node_id", "(J)[B");
21125         CHECK(calls->next_node_id_meth != NULL);
21126
21127         LDKNodeIdLookUp ret = {
21128                 .this_arg = (void*) calls,
21129                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
21130                 .free = LDKNodeIdLookUp_JCalls_free,
21131         };
21132         return ret;
21133 }
21134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeIdLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
21135         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
21136         *res_ptr = LDKNodeIdLookUp_init(env, clz, o);
21137         return tag_ptr(res_ptr, true);
21138 }
21139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeIdLookUp_1next_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
21140         void* this_arg_ptr = untag_ptr(this_arg);
21141         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21142         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
21143         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21144         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form);
21145         return ret_arr;
21146 }
21147
21148 typedef struct LDKRoutingMessageHandler_JCalls {
21149         atomic_size_t refcnt;
21150         JavaVM *vm;
21151         jweak o;
21152         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
21153         jmethodID handle_node_announcement_meth;
21154         jmethodID handle_channel_announcement_meth;
21155         jmethodID handle_channel_update_meth;
21156         jmethodID get_next_channel_announcement_meth;
21157         jmethodID get_next_node_announcement_meth;
21158         jmethodID peer_connected_meth;
21159         jmethodID handle_reply_channel_range_meth;
21160         jmethodID handle_reply_short_channel_ids_end_meth;
21161         jmethodID handle_query_channel_range_meth;
21162         jmethodID handle_query_short_channel_ids_meth;
21163         jmethodID processing_queue_high_meth;
21164         jmethodID provided_node_features_meth;
21165         jmethodID provided_init_features_meth;
21166 } LDKRoutingMessageHandler_JCalls;
21167 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
21168         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21169         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21170                 JNIEnv *env;
21171                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21172                 if (get_jenv_res == JNI_EDETACHED) {
21173                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21174                 } else {
21175                         DO_ASSERT(get_jenv_res == JNI_OK);
21176                 }
21177                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21178                 if (get_jenv_res == JNI_EDETACHED) {
21179                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21180                 }
21181                 FREE(j_calls);
21182         }
21183 }
21184 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
21185         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21186         JNIEnv *env;
21187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21188         if (get_jenv_res == JNI_EDETACHED) {
21189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21190         } else {
21191                 DO_ASSERT(get_jenv_res == JNI_OK);
21192         }
21193         LDKNodeAnnouncement msg_var = *msg;
21194         int64_t msg_ref = 0;
21195         msg_var = NodeAnnouncement_clone(&msg_var);
21196         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21197         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21198         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21199         CHECK(obj != NULL);
21200         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
21201         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21202                 (*env)->ExceptionDescribe(env);
21203                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21204         }
21205         void* ret_ptr = untag_ptr(ret);
21206         CHECK_ACCESS(ret_ptr);
21207         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
21208         FREE(untag_ptr(ret));
21209         if (get_jenv_res == JNI_EDETACHED) {
21210                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21211         }
21212         return ret_conv;
21213 }
21214 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
21215         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21216         JNIEnv *env;
21217         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21218         if (get_jenv_res == JNI_EDETACHED) {
21219                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21220         } else {
21221                 DO_ASSERT(get_jenv_res == JNI_OK);
21222         }
21223         LDKChannelAnnouncement msg_var = *msg;
21224         int64_t msg_ref = 0;
21225         msg_var = ChannelAnnouncement_clone(&msg_var);
21226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21227         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21228         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21229         CHECK(obj != NULL);
21230         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
21231         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21232                 (*env)->ExceptionDescribe(env);
21233                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21234         }
21235         void* ret_ptr = untag_ptr(ret);
21236         CHECK_ACCESS(ret_ptr);
21237         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
21238         FREE(untag_ptr(ret));
21239         if (get_jenv_res == JNI_EDETACHED) {
21240                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21241         }
21242         return ret_conv;
21243 }
21244 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
21245         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21246         JNIEnv *env;
21247         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21248         if (get_jenv_res == JNI_EDETACHED) {
21249                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21250         } else {
21251                 DO_ASSERT(get_jenv_res == JNI_OK);
21252         }
21253         LDKChannelUpdate msg_var = *msg;
21254         int64_t msg_ref = 0;
21255         msg_var = ChannelUpdate_clone(&msg_var);
21256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21257         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21258         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21259         CHECK(obj != NULL);
21260         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
21261         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21262                 (*env)->ExceptionDescribe(env);
21263                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
21264         }
21265         void* ret_ptr = untag_ptr(ret);
21266         CHECK_ACCESS(ret_ptr);
21267         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
21268         FREE(untag_ptr(ret));
21269         if (get_jenv_res == JNI_EDETACHED) {
21270                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21271         }
21272         return ret_conv;
21273 }
21274 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
21275         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21276         JNIEnv *env;
21277         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21278         if (get_jenv_res == JNI_EDETACHED) {
21279                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21280         } else {
21281                 DO_ASSERT(get_jenv_res == JNI_OK);
21282         }
21283         int64_t starting_point_conv = starting_point;
21284         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21285         CHECK(obj != NULL);
21286         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
21287         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21288                 (*env)->ExceptionDescribe(env);
21289                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21290         }
21291         void* ret_ptr = untag_ptr(ret);
21292         CHECK_ACCESS(ret_ptr);
21293         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
21294         FREE(untag_ptr(ret));
21295         if (get_jenv_res == JNI_EDETACHED) {
21296                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21297         }
21298         return ret_conv;
21299 }
21300 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
21301         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21302         JNIEnv *env;
21303         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21304         if (get_jenv_res == JNI_EDETACHED) {
21305                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21306         } else {
21307                 DO_ASSERT(get_jenv_res == JNI_OK);
21308         }
21309         LDKNodeId starting_point_var = starting_point;
21310         int64_t starting_point_ref = 0;
21311         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
21312         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
21313         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21314         CHECK(obj != NULL);
21315         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
21316         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21317                 (*env)->ExceptionDescribe(env);
21318                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21319         }
21320         LDKNodeAnnouncement ret_conv;
21321         ret_conv.inner = untag_ptr(ret);
21322         ret_conv.is_owned = ptr_is_owned(ret);
21323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21324         if (get_jenv_res == JNI_EDETACHED) {
21325                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21326         }
21327         return ret_conv;
21328 }
21329 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
21330         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21331         JNIEnv *env;
21332         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21333         if (get_jenv_res == JNI_EDETACHED) {
21334                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21335         } else {
21336                 DO_ASSERT(get_jenv_res == JNI_OK);
21337         }
21338         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21339         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21340         LDKInit init_var = *init;
21341         int64_t init_ref = 0;
21342         init_var = Init_clone(&init_var);
21343         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
21344         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
21345         jboolean inbound_conv = inbound;
21346         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21347         CHECK(obj != NULL);
21348         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
21349         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21350                 (*env)->ExceptionDescribe(env);
21351                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
21352         }
21353         void* ret_ptr = untag_ptr(ret);
21354         CHECK_ACCESS(ret_ptr);
21355         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
21356         FREE(untag_ptr(ret));
21357         if (get_jenv_res == JNI_EDETACHED) {
21358                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21359         }
21360         return ret_conv;
21361 }
21362 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
21363         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21364         JNIEnv *env;
21365         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21366         if (get_jenv_res == JNI_EDETACHED) {
21367                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21368         } else {
21369                 DO_ASSERT(get_jenv_res == JNI_OK);
21370         }
21371         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21372         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21373         LDKReplyChannelRange msg_var = msg;
21374         int64_t msg_ref = 0;
21375         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21376         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21377         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21378         CHECK(obj != NULL);
21379         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
21380         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21381                 (*env)->ExceptionDescribe(env);
21382                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
21383         }
21384         void* ret_ptr = untag_ptr(ret);
21385         CHECK_ACCESS(ret_ptr);
21386         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21387         FREE(untag_ptr(ret));
21388         if (get_jenv_res == JNI_EDETACHED) {
21389                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21390         }
21391         return ret_conv;
21392 }
21393 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
21394         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21395         JNIEnv *env;
21396         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21397         if (get_jenv_res == JNI_EDETACHED) {
21398                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21399         } else {
21400                 DO_ASSERT(get_jenv_res == JNI_OK);
21401         }
21402         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21403         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21404         LDKReplyShortChannelIdsEnd msg_var = msg;
21405         int64_t msg_ref = 0;
21406         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21407         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21408         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21409         CHECK(obj != NULL);
21410         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
21411         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21412                 (*env)->ExceptionDescribe(env);
21413                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
21414         }
21415         void* ret_ptr = untag_ptr(ret);
21416         CHECK_ACCESS(ret_ptr);
21417         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21418         FREE(untag_ptr(ret));
21419         if (get_jenv_res == JNI_EDETACHED) {
21420                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21421         }
21422         return ret_conv;
21423 }
21424 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
21425         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21426         JNIEnv *env;
21427         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21428         if (get_jenv_res == JNI_EDETACHED) {
21429                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21430         } else {
21431                 DO_ASSERT(get_jenv_res == JNI_OK);
21432         }
21433         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21434         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21435         LDKQueryChannelRange msg_var = msg;
21436         int64_t msg_ref = 0;
21437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21438         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21439         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21440         CHECK(obj != NULL);
21441         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
21442         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21443                 (*env)->ExceptionDescribe(env);
21444                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
21445         }
21446         void* ret_ptr = untag_ptr(ret);
21447         CHECK_ACCESS(ret_ptr);
21448         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21449         FREE(untag_ptr(ret));
21450         if (get_jenv_res == JNI_EDETACHED) {
21451                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21452         }
21453         return ret_conv;
21454 }
21455 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
21456         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21457         JNIEnv *env;
21458         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21459         if (get_jenv_res == JNI_EDETACHED) {
21460                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21461         } else {
21462                 DO_ASSERT(get_jenv_res == JNI_OK);
21463         }
21464         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21465         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21466         LDKQueryShortChannelIds msg_var = msg;
21467         int64_t msg_ref = 0;
21468         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21469         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21470         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21471         CHECK(obj != NULL);
21472         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
21473         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21474                 (*env)->ExceptionDescribe(env);
21475                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
21476         }
21477         void* ret_ptr = untag_ptr(ret);
21478         CHECK_ACCESS(ret_ptr);
21479         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21480         FREE(untag_ptr(ret));
21481         if (get_jenv_res == JNI_EDETACHED) {
21482                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21483         }
21484         return ret_conv;
21485 }
21486 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
21487         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21488         JNIEnv *env;
21489         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21490         if (get_jenv_res == JNI_EDETACHED) {
21491                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21492         } else {
21493                 DO_ASSERT(get_jenv_res == JNI_OK);
21494         }
21495         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21496         CHECK(obj != NULL);
21497         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
21498         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21499                 (*env)->ExceptionDescribe(env);
21500                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
21501         }
21502         if (get_jenv_res == JNI_EDETACHED) {
21503                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21504         }
21505         return ret;
21506 }
21507 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
21508         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21509         JNIEnv *env;
21510         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21511         if (get_jenv_res == JNI_EDETACHED) {
21512                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21513         } else {
21514                 DO_ASSERT(get_jenv_res == JNI_OK);
21515         }
21516         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21517         CHECK(obj != NULL);
21518         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
21519         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21520                 (*env)->ExceptionDescribe(env);
21521                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
21522         }
21523         LDKNodeFeatures ret_conv;
21524         ret_conv.inner = untag_ptr(ret);
21525         ret_conv.is_owned = ptr_is_owned(ret);
21526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21527         if (get_jenv_res == JNI_EDETACHED) {
21528                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21529         }
21530         return ret_conv;
21531 }
21532 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21533         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21534         JNIEnv *env;
21535         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21536         if (get_jenv_res == JNI_EDETACHED) {
21537                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21538         } else {
21539                 DO_ASSERT(get_jenv_res == JNI_OK);
21540         }
21541         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21542         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21543         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21544         CHECK(obj != NULL);
21545         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
21546         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21547                 (*env)->ExceptionDescribe(env);
21548                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
21549         }
21550         LDKInitFeatures ret_conv;
21551         ret_conv.inner = untag_ptr(ret);
21552         ret_conv.is_owned = ptr_is_owned(ret);
21553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21554         if (get_jenv_res == JNI_EDETACHED) {
21555                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21556         }
21557         return ret_conv;
21558 }
21559 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
21560         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
21561         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21562         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
21563 }
21564 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
21565         jclass c = (*env)->GetObjectClass(env, o);
21566         CHECK(c != NULL);
21567         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
21568         atomic_init(&calls->refcnt, 1);
21569         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21570         calls->o = (*env)->NewWeakGlobalRef(env, o);
21571         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
21572         CHECK(calls->handle_node_announcement_meth != NULL);
21573         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
21574         CHECK(calls->handle_channel_announcement_meth != NULL);
21575         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
21576         CHECK(calls->handle_channel_update_meth != NULL);
21577         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
21578         CHECK(calls->get_next_channel_announcement_meth != NULL);
21579         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
21580         CHECK(calls->get_next_node_announcement_meth != NULL);
21581         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
21582         CHECK(calls->peer_connected_meth != NULL);
21583         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
21584         CHECK(calls->handle_reply_channel_range_meth != NULL);
21585         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
21586         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
21587         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
21588         CHECK(calls->handle_query_channel_range_meth != NULL);
21589         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
21590         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
21591         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
21592         CHECK(calls->processing_queue_high_meth != NULL);
21593         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
21594         CHECK(calls->provided_node_features_meth != NULL);
21595         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
21596         CHECK(calls->provided_init_features_meth != NULL);
21597
21598         LDKRoutingMessageHandler ret = {
21599                 .this_arg = (void*) calls,
21600                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
21601                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
21602                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
21603                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
21604                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
21605                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
21606                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
21607                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
21608                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
21609                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
21610                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
21611                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
21612                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
21613                 .free = LDKRoutingMessageHandler_JCalls_free,
21614                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
21615         };
21616         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
21617         return ret;
21618 }
21619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
21620         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21621         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
21622         return tag_ptr(res_ptr, true);
21623 }
21624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
21625         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
21626         return tag_ptr(&inp->MessageSendEventsProvider, false);
21627 }
21628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21629         void* this_arg_ptr = untag_ptr(this_arg);
21630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21631         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21632         LDKNodeAnnouncement msg_conv;
21633         msg_conv.inner = untag_ptr(msg);
21634         msg_conv.is_owned = ptr_is_owned(msg);
21635         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21636         msg_conv.is_owned = false;
21637         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21638         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
21639         return tag_ptr(ret_conv, true);
21640 }
21641
21642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21643         void* this_arg_ptr = untag_ptr(this_arg);
21644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21645         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21646         LDKChannelAnnouncement msg_conv;
21647         msg_conv.inner = untag_ptr(msg);
21648         msg_conv.is_owned = ptr_is_owned(msg);
21649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21650         msg_conv.is_owned = false;
21651         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21652         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
21653         return tag_ptr(ret_conv, true);
21654 }
21655
21656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21657         void* this_arg_ptr = untag_ptr(this_arg);
21658         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21659         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21660         LDKChannelUpdate msg_conv;
21661         msg_conv.inner = untag_ptr(msg);
21662         msg_conv.is_owned = ptr_is_owned(msg);
21663         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21664         msg_conv.is_owned = false;
21665         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21666         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
21667         return tag_ptr(ret_conv, true);
21668 }
21669
21670 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) {
21671         void* this_arg_ptr = untag_ptr(this_arg);
21672         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21673         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21674         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21675         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
21676         int64_t ret_ref = tag_ptr(ret_copy, true);
21677         return ret_ref;
21678 }
21679
21680 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) {
21681         void* this_arg_ptr = untag_ptr(this_arg);
21682         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21683         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21684         LDKNodeId starting_point_conv;
21685         starting_point_conv.inner = untag_ptr(starting_point);
21686         starting_point_conv.is_owned = ptr_is_owned(starting_point);
21687         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
21688         starting_point_conv = NodeId_clone(&starting_point_conv);
21689         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
21690         int64_t ret_ref = 0;
21691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21693         return ret_ref;
21694 }
21695
21696 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) {
21697         void* this_arg_ptr = untag_ptr(this_arg);
21698         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21699         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21700         LDKPublicKey their_node_id_ref;
21701         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21702         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21703         LDKInit init_conv;
21704         init_conv.inner = untag_ptr(init);
21705         init_conv.is_owned = ptr_is_owned(init);
21706         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
21707         init_conv.is_owned = false;
21708         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21709         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
21710         return tag_ptr(ret_conv, true);
21711 }
21712
21713 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) {
21714         void* this_arg_ptr = untag_ptr(this_arg);
21715         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21716         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21717         LDKPublicKey their_node_id_ref;
21718         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21719         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21720         LDKReplyChannelRange msg_conv;
21721         msg_conv.inner = untag_ptr(msg);
21722         msg_conv.is_owned = ptr_is_owned(msg);
21723         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21724         msg_conv = ReplyChannelRange_clone(&msg_conv);
21725         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21726         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21727         return tag_ptr(ret_conv, true);
21728 }
21729
21730 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) {
21731         void* this_arg_ptr = untag_ptr(this_arg);
21732         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21733         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21734         LDKPublicKey their_node_id_ref;
21735         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21736         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21737         LDKReplyShortChannelIdsEnd msg_conv;
21738         msg_conv.inner = untag_ptr(msg);
21739         msg_conv.is_owned = ptr_is_owned(msg);
21740         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21741         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
21742         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21743         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21744         return tag_ptr(ret_conv, true);
21745 }
21746
21747 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) {
21748         void* this_arg_ptr = untag_ptr(this_arg);
21749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21750         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21751         LDKPublicKey their_node_id_ref;
21752         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21753         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21754         LDKQueryChannelRange msg_conv;
21755         msg_conv.inner = untag_ptr(msg);
21756         msg_conv.is_owned = ptr_is_owned(msg);
21757         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21758         msg_conv = QueryChannelRange_clone(&msg_conv);
21759         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21760         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21761         return tag_ptr(ret_conv, true);
21762 }
21763
21764 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) {
21765         void* this_arg_ptr = untag_ptr(this_arg);
21766         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21767         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21768         LDKPublicKey their_node_id_ref;
21769         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21770         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21771         LDKQueryShortChannelIds msg_conv;
21772         msg_conv.inner = untag_ptr(msg);
21773         msg_conv.is_owned = ptr_is_owned(msg);
21774         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21775         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21776         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21777         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21778         return tag_ptr(ret_conv, true);
21779 }
21780
21781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
21782         void* this_arg_ptr = untag_ptr(this_arg);
21783         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21784         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21785         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
21786         return ret_conv;
21787 }
21788
21789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
21790         void* this_arg_ptr = untag_ptr(this_arg);
21791         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21792         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21793         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
21794         int64_t ret_ref = 0;
21795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21797         return ret_ref;
21798 }
21799
21800 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) {
21801         void* this_arg_ptr = untag_ptr(this_arg);
21802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21803         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21804         LDKPublicKey their_node_id_ref;
21805         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21806         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21807         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
21808         int64_t ret_ref = 0;
21809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21811         return ret_ref;
21812 }
21813
21814 typedef struct LDKOnionMessageHandler_JCalls {
21815         atomic_size_t refcnt;
21816         JavaVM *vm;
21817         jweak o;
21818         jmethodID get_and_clear_connections_needed_meth;
21819         jmethodID handle_onion_message_meth;
21820         jmethodID next_onion_message_for_peer_meth;
21821         jmethodID peer_connected_meth;
21822         jmethodID peer_disconnected_meth;
21823         jmethodID timer_tick_occurred_meth;
21824         jmethodID provided_node_features_meth;
21825         jmethodID provided_init_features_meth;
21826 } LDKOnionMessageHandler_JCalls;
21827 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
21828         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21829         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21830                 JNIEnv *env;
21831                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21832                 if (get_jenv_res == JNI_EDETACHED) {
21833                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21834                 } else {
21835                         DO_ASSERT(get_jenv_res == JNI_OK);
21836                 }
21837                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21838                 if (get_jenv_res == JNI_EDETACHED) {
21839                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21840                 }
21841                 FREE(j_calls);
21842         }
21843 }
21844 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
21845         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21846         JNIEnv *env;
21847         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21848         if (get_jenv_res == JNI_EDETACHED) {
21849                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21850         } else {
21851                 DO_ASSERT(get_jenv_res == JNI_OK);
21852         }
21853         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21854         CHECK(obj != NULL);
21855         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_connections_needed_meth);
21856         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21857                 (*env)->ExceptionDescribe(env);
21858                 (*env)->FatalError(env, "A call to get_and_clear_connections_needed in LDKOnionMessageHandler from rust threw an exception.");
21859         }
21860         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
21861         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
21862         if (ret_constr.datalen > 0)
21863                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
21864         else
21865                 ret_constr.data = NULL;
21866         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
21867         for (size_t o = 0; o < ret_constr.datalen; o++) {
21868                 int64_t ret_conv_40 = ret_vals[o];
21869                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
21870                 CHECK_ACCESS(ret_conv_40_ptr);
21871                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
21872                 FREE(untag_ptr(ret_conv_40));
21873                 ret_constr.data[o] = ret_conv_40_conv;
21874         }
21875         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
21876         if (get_jenv_res == JNI_EDETACHED) {
21877                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21878         }
21879         return ret_constr;
21880 }
21881 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
21882         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21883         JNIEnv *env;
21884         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21885         if (get_jenv_res == JNI_EDETACHED) {
21886                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21887         } else {
21888                 DO_ASSERT(get_jenv_res == JNI_OK);
21889         }
21890         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
21891         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
21892         LDKOnionMessage msg_var = *msg;
21893         int64_t msg_ref = 0;
21894         msg_var = OnionMessage_clone(&msg_var);
21895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21896         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21897         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21898         CHECK(obj != NULL);
21899         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
21900         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21901                 (*env)->ExceptionDescribe(env);
21902                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
21903         }
21904         if (get_jenv_res == JNI_EDETACHED) {
21905                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21906         }
21907 }
21908 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
21909         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21910         JNIEnv *env;
21911         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21912         if (get_jenv_res == JNI_EDETACHED) {
21913                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21914         } else {
21915                 DO_ASSERT(get_jenv_res == JNI_OK);
21916         }
21917         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
21918         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
21919         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21920         CHECK(obj != NULL);
21921         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
21922         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21923                 (*env)->ExceptionDescribe(env);
21924                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
21925         }
21926         LDKOnionMessage ret_conv;
21927         ret_conv.inner = untag_ptr(ret);
21928         ret_conv.is_owned = ptr_is_owned(ret);
21929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21930         if (get_jenv_res == JNI_EDETACHED) {
21931                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21932         }
21933         return ret_conv;
21934 }
21935 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
21936         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21937         JNIEnv *env;
21938         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21939         if (get_jenv_res == JNI_EDETACHED) {
21940                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21941         } else {
21942                 DO_ASSERT(get_jenv_res == JNI_OK);
21943         }
21944         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21945         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21946         LDKInit init_var = *init;
21947         int64_t init_ref = 0;
21948         init_var = Init_clone(&init_var);
21949         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
21950         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
21951         jboolean inbound_conv = inbound;
21952         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21953         CHECK(obj != NULL);
21954         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
21955         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21956                 (*env)->ExceptionDescribe(env);
21957                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
21958         }
21959         void* ret_ptr = untag_ptr(ret);
21960         CHECK_ACCESS(ret_ptr);
21961         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
21962         FREE(untag_ptr(ret));
21963         if (get_jenv_res == JNI_EDETACHED) {
21964                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21965         }
21966         return ret_conv;
21967 }
21968 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21969         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21970         JNIEnv *env;
21971         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21972         if (get_jenv_res == JNI_EDETACHED) {
21973                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21974         } else {
21975                 DO_ASSERT(get_jenv_res == JNI_OK);
21976         }
21977         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21978         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21979         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21980         CHECK(obj != NULL);
21981         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
21982         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21983                 (*env)->ExceptionDescribe(env);
21984                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
21985         }
21986         if (get_jenv_res == JNI_EDETACHED) {
21987                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21988         }
21989 }
21990 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
21991         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21992         JNIEnv *env;
21993         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21994         if (get_jenv_res == JNI_EDETACHED) {
21995                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21996         } else {
21997                 DO_ASSERT(get_jenv_res == JNI_OK);
21998         }
21999         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22000         CHECK(obj != NULL);
22001         (*env)->CallVoidMethod(env, obj, j_calls->timer_tick_occurred_meth);
22002         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22003                 (*env)->ExceptionDescribe(env);
22004                 (*env)->FatalError(env, "A call to timer_tick_occurred in LDKOnionMessageHandler from rust threw an exception.");
22005         }
22006         if (get_jenv_res == JNI_EDETACHED) {
22007                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22008         }
22009 }
22010 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
22011         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
22012         JNIEnv *env;
22013         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22014         if (get_jenv_res == JNI_EDETACHED) {
22015                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22016         } else {
22017                 DO_ASSERT(get_jenv_res == JNI_OK);
22018         }
22019         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22020         CHECK(obj != NULL);
22021         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
22022         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22023                 (*env)->ExceptionDescribe(env);
22024                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
22025         }
22026         LDKNodeFeatures ret_conv;
22027         ret_conv.inner = untag_ptr(ret);
22028         ret_conv.is_owned = ptr_is_owned(ret);
22029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22030         if (get_jenv_res == JNI_EDETACHED) {
22031                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22032         }
22033         return ret_conv;
22034 }
22035 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
22036         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
22037         JNIEnv *env;
22038         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22039         if (get_jenv_res == JNI_EDETACHED) {
22040                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22041         } else {
22042                 DO_ASSERT(get_jenv_res == JNI_OK);
22043         }
22044         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
22045         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
22046         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22047         CHECK(obj != NULL);
22048         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
22049         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22050                 (*env)->ExceptionDescribe(env);
22051                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
22052         }
22053         LDKInitFeatures ret_conv;
22054         ret_conv.inner = untag_ptr(ret);
22055         ret_conv.is_owned = ptr_is_owned(ret);
22056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22057         if (get_jenv_res == JNI_EDETACHED) {
22058                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22059         }
22060         return ret_conv;
22061 }
22062 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
22063         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
22064         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22065 }
22066 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
22067         jclass c = (*env)->GetObjectClass(env, o);
22068         CHECK(c != NULL);
22069         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
22070         atomic_init(&calls->refcnt, 1);
22071         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22072         calls->o = (*env)->NewWeakGlobalRef(env, o);
22073         calls->get_and_clear_connections_needed_meth = (*env)->GetMethodID(env, c, "get_and_clear_connections_needed", "()[J");
22074         CHECK(calls->get_and_clear_connections_needed_meth != NULL);
22075         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
22076         CHECK(calls->handle_onion_message_meth != NULL);
22077         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
22078         CHECK(calls->next_onion_message_for_peer_meth != NULL);
22079         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
22080         CHECK(calls->peer_connected_meth != NULL);
22081         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
22082         CHECK(calls->peer_disconnected_meth != NULL);
22083         calls->timer_tick_occurred_meth = (*env)->GetMethodID(env, c, "timer_tick_occurred", "()V");
22084         CHECK(calls->timer_tick_occurred_meth != NULL);
22085         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
22086         CHECK(calls->provided_node_features_meth != NULL);
22087         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
22088         CHECK(calls->provided_init_features_meth != NULL);
22089
22090         LDKOnionMessageHandler ret = {
22091                 .this_arg = (void*) calls,
22092                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
22093                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
22094                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
22095                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
22096                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
22097                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
22098                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
22099                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
22100                 .free = LDKOnionMessageHandler_JCalls_free,
22101         };
22102         return ret;
22103 }
22104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
22105         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
22106         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
22107         return tag_ptr(res_ptr, true);
22108 }
22109 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1get_1and_1clear_1connections_1needed(JNIEnv *env, jclass clz, int64_t this_arg) {
22110         void* this_arg_ptr = untag_ptr(this_arg);
22111         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22112         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22113         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
22114         int64_tArray ret_arr = NULL;
22115         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22116         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22117         for (size_t o = 0; o < ret_var.datalen; o++) {
22118                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
22119                 *ret_conv_40_conv = ret_var.data[o];
22120                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
22121         }
22122         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22123         FREE(ret_var.data);
22124         return ret_arr;
22125 }
22126
22127 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) {
22128         void* this_arg_ptr = untag_ptr(this_arg);
22129         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22130         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22131         LDKPublicKey peer_node_id_ref;
22132         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
22133         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
22134         LDKOnionMessage msg_conv;
22135         msg_conv.inner = untag_ptr(msg);
22136         msg_conv.is_owned = ptr_is_owned(msg);
22137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22138         msg_conv.is_owned = false;
22139         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
22140 }
22141
22142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
22143         void* this_arg_ptr = untag_ptr(this_arg);
22144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22145         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22146         LDKPublicKey peer_node_id_ref;
22147         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
22148         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
22149         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
22150         int64_t ret_ref = 0;
22151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22153         return ret_ref;
22154 }
22155
22156 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) {
22157         void* this_arg_ptr = untag_ptr(this_arg);
22158         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22159         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22160         LDKPublicKey their_node_id_ref;
22161         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22162         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22163         LDKInit init_conv;
22164         init_conv.inner = untag_ptr(init);
22165         init_conv.is_owned = ptr_is_owned(init);
22166         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
22167         init_conv.is_owned = false;
22168         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
22169         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
22170         return tag_ptr(ret_conv, true);
22171 }
22172
22173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
22174         void* this_arg_ptr = untag_ptr(this_arg);
22175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22176         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22177         LDKPublicKey their_node_id_ref;
22178         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22179         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22180         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
22181 }
22182
22183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
22184         void* this_arg_ptr = untag_ptr(this_arg);
22185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22186         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22187         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
22188 }
22189
22190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
22191         void* this_arg_ptr = untag_ptr(this_arg);
22192         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22193         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22194         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
22195         int64_t ret_ref = 0;
22196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22198         return ret_ref;
22199 }
22200
22201 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) {
22202         void* this_arg_ptr = untag_ptr(this_arg);
22203         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22204         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
22205         LDKPublicKey their_node_id_ref;
22206         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22207         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22208         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
22209         int64_t ret_ref = 0;
22210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22212         return ret_ref;
22213 }
22214
22215 typedef struct LDKCustomMessageReader_JCalls {
22216         atomic_size_t refcnt;
22217         JavaVM *vm;
22218         jweak o;
22219         jmethodID read_meth;
22220 } LDKCustomMessageReader_JCalls;
22221 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
22222         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
22223         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22224                 JNIEnv *env;
22225                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22226                 if (get_jenv_res == JNI_EDETACHED) {
22227                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22228                 } else {
22229                         DO_ASSERT(get_jenv_res == JNI_OK);
22230                 }
22231                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22232                 if (get_jenv_res == JNI_EDETACHED) {
22233                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22234                 }
22235                 FREE(j_calls);
22236         }
22237 }
22238 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
22239         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
22240         JNIEnv *env;
22241         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22242         if (get_jenv_res == JNI_EDETACHED) {
22243                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22244         } else {
22245                 DO_ASSERT(get_jenv_res == JNI_OK);
22246         }
22247         int16_t message_type_conv = message_type;
22248         LDKu8slice buffer_var = buffer;
22249         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
22250         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
22251         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22252         CHECK(obj != NULL);
22253         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
22254         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22255                 (*env)->ExceptionDescribe(env);
22256                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
22257         }
22258         void* ret_ptr = untag_ptr(ret);
22259         CHECK_ACCESS(ret_ptr);
22260         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
22261         FREE(untag_ptr(ret));
22262         if (get_jenv_res == JNI_EDETACHED) {
22263                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22264         }
22265         return ret_conv;
22266 }
22267 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
22268         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
22269         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22270 }
22271 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
22272         jclass c = (*env)->GetObjectClass(env, o);
22273         CHECK(c != NULL);
22274         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
22275         atomic_init(&calls->refcnt, 1);
22276         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22277         calls->o = (*env)->NewWeakGlobalRef(env, o);
22278         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
22279         CHECK(calls->read_meth != NULL);
22280
22281         LDKCustomMessageReader ret = {
22282                 .this_arg = (void*) calls,
22283                 .read = read_LDKCustomMessageReader_jcall,
22284                 .free = LDKCustomMessageReader_JCalls_free,
22285         };
22286         return ret;
22287 }
22288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
22289         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
22290         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
22291         return tag_ptr(res_ptr, true);
22292 }
22293 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) {
22294         void* this_arg_ptr = untag_ptr(this_arg);
22295         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22296         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
22297         LDKu8slice buffer_ref;
22298         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
22299         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
22300         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22301         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
22302         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
22303         return tag_ptr(ret_conv, true);
22304 }
22305
22306 typedef struct LDKCustomMessageHandler_JCalls {
22307         atomic_size_t refcnt;
22308         JavaVM *vm;
22309         jweak o;
22310         LDKCustomMessageReader_JCalls* CustomMessageReader;
22311         jmethodID handle_custom_message_meth;
22312         jmethodID get_and_clear_pending_msg_meth;
22313         jmethodID provided_node_features_meth;
22314         jmethodID provided_init_features_meth;
22315 } LDKCustomMessageHandler_JCalls;
22316 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
22317         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22318         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22319                 JNIEnv *env;
22320                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22321                 if (get_jenv_res == JNI_EDETACHED) {
22322                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22323                 } else {
22324                         DO_ASSERT(get_jenv_res == JNI_OK);
22325                 }
22326                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22327                 if (get_jenv_res == JNI_EDETACHED) {
22328                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22329                 }
22330                 FREE(j_calls);
22331         }
22332 }
22333 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
22334         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22335         JNIEnv *env;
22336         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22337         if (get_jenv_res == JNI_EDETACHED) {
22338                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22339         } else {
22340                 DO_ASSERT(get_jenv_res == JNI_OK);
22341         }
22342         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
22343         *msg_ret = msg;
22344         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
22345         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
22346         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22347         CHECK(obj != NULL);
22348         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
22349         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22350                 (*env)->ExceptionDescribe(env);
22351                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
22352         }
22353         void* ret_ptr = untag_ptr(ret);
22354         CHECK_ACCESS(ret_ptr);
22355         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
22356         FREE(untag_ptr(ret));
22357         if (get_jenv_res == JNI_EDETACHED) {
22358                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22359         }
22360         return ret_conv;
22361 }
22362 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
22363         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22364         JNIEnv *env;
22365         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22366         if (get_jenv_res == JNI_EDETACHED) {
22367                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22368         } else {
22369                 DO_ASSERT(get_jenv_res == JNI_OK);
22370         }
22371         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22372         CHECK(obj != NULL);
22373         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
22374         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22375                 (*env)->ExceptionDescribe(env);
22376                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
22377         }
22378         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
22379         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
22380         if (ret_constr.datalen > 0)
22381                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22382         else
22383                 ret_constr.data = NULL;
22384         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
22385         for (size_t z = 0; z < ret_constr.datalen; z++) {
22386                 int64_t ret_conv_25 = ret_vals[z];
22387                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
22388                 CHECK_ACCESS(ret_conv_25_ptr);
22389                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
22390                 FREE(untag_ptr(ret_conv_25));
22391                 ret_constr.data[z] = ret_conv_25_conv;
22392         }
22393         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
22394         if (get_jenv_res == JNI_EDETACHED) {
22395                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22396         }
22397         return ret_constr;
22398 }
22399 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
22400         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22401         JNIEnv *env;
22402         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22403         if (get_jenv_res == JNI_EDETACHED) {
22404                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22405         } else {
22406                 DO_ASSERT(get_jenv_res == JNI_OK);
22407         }
22408         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22409         CHECK(obj != NULL);
22410         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
22411         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22412                 (*env)->ExceptionDescribe(env);
22413                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
22414         }
22415         LDKNodeFeatures ret_conv;
22416         ret_conv.inner = untag_ptr(ret);
22417         ret_conv.is_owned = ptr_is_owned(ret);
22418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22419         if (get_jenv_res == JNI_EDETACHED) {
22420                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22421         }
22422         return ret_conv;
22423 }
22424 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
22425         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22426         JNIEnv *env;
22427         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22428         if (get_jenv_res == JNI_EDETACHED) {
22429                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22430         } else {
22431                 DO_ASSERT(get_jenv_res == JNI_OK);
22432         }
22433         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
22434         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
22435         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22436         CHECK(obj != NULL);
22437         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
22438         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22439                 (*env)->ExceptionDescribe(env);
22440                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
22441         }
22442         LDKInitFeatures ret_conv;
22443         ret_conv.inner = untag_ptr(ret);
22444         ret_conv.is_owned = ptr_is_owned(ret);
22445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22446         if (get_jenv_res == JNI_EDETACHED) {
22447                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22448         }
22449         return ret_conv;
22450 }
22451 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
22452         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
22453         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22454         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
22455 }
22456 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
22457         jclass c = (*env)->GetObjectClass(env, o);
22458         CHECK(c != NULL);
22459         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
22460         atomic_init(&calls->refcnt, 1);
22461         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22462         calls->o = (*env)->NewWeakGlobalRef(env, o);
22463         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
22464         CHECK(calls->handle_custom_message_meth != NULL);
22465         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
22466         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
22467         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
22468         CHECK(calls->provided_node_features_meth != NULL);
22469         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
22470         CHECK(calls->provided_init_features_meth != NULL);
22471
22472         LDKCustomMessageHandler ret = {
22473                 .this_arg = (void*) calls,
22474                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
22475                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
22476                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
22477                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
22478                 .free = LDKCustomMessageHandler_JCalls_free,
22479                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
22480         };
22481         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
22482         return ret;
22483 }
22484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
22485         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
22486         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
22487         return tag_ptr(res_ptr, true);
22488 }
22489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
22490         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
22491         return tag_ptr(&inp->CustomMessageReader, false);
22492 }
22493 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) {
22494         void* this_arg_ptr = untag_ptr(this_arg);
22495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22496         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22497         void* msg_ptr = untag_ptr(msg);
22498         CHECK_ACCESS(msg_ptr);
22499         LDKType msg_conv = *(LDKType*)(msg_ptr);
22500         if (msg_conv.free == LDKType_JCalls_free) {
22501                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22502                 LDKType_JCalls_cloned(&msg_conv);
22503         }
22504         LDKPublicKey sender_node_id_ref;
22505         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
22506         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
22507         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22508         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
22509         return tag_ptr(ret_conv, true);
22510 }
22511
22512 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
22513         void* this_arg_ptr = untag_ptr(this_arg);
22514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22515         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22516         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
22517         int64_tArray ret_arr = NULL;
22518         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22519         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22520         for (size_t z = 0; z < ret_var.datalen; z++) {
22521                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22522                 *ret_conv_25_conv = ret_var.data[z];
22523                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
22524         }
22525         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22526         FREE(ret_var.data);
22527         return ret_arr;
22528 }
22529
22530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
22531         void* this_arg_ptr = untag_ptr(this_arg);
22532         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22533         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22534         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
22535         int64_t ret_ref = 0;
22536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22538         return ret_ref;
22539 }
22540
22541 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) {
22542         void* this_arg_ptr = untag_ptr(this_arg);
22543         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22544         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22545         LDKPublicKey their_node_id_ref;
22546         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22547         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22548         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
22549         int64_t ret_ref = 0;
22550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22552         return ret_ref;
22553 }
22554
22555 typedef struct LDKCustomOnionMessageHandler_JCalls {
22556         atomic_size_t refcnt;
22557         JavaVM *vm;
22558         jweak o;
22559         jmethodID handle_custom_message_meth;
22560         jmethodID read_custom_message_meth;
22561         jmethodID release_pending_custom_messages_meth;
22562 } LDKCustomOnionMessageHandler_JCalls;
22563 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
22564         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22565         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22566                 JNIEnv *env;
22567                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22568                 if (get_jenv_res == JNI_EDETACHED) {
22569                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22570                 } else {
22571                         DO_ASSERT(get_jenv_res == JNI_OK);
22572                 }
22573                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22574                 if (get_jenv_res == JNI_EDETACHED) {
22575                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22576                 }
22577                 FREE(j_calls);
22578         }
22579 }
22580 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
22581         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22582         JNIEnv *env;
22583         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22584         if (get_jenv_res == JNI_EDETACHED) {
22585                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22586         } else {
22587                 DO_ASSERT(get_jenv_res == JNI_OK);
22588         }
22589         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
22590         *msg_ret = msg;
22591         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22592         CHECK(obj != NULL);
22593         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
22594         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22595                 (*env)->ExceptionDescribe(env);
22596                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
22597         }
22598         void* ret_ptr = untag_ptr(ret);
22599         CHECK_ACCESS(ret_ptr);
22600         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
22601         FREE(untag_ptr(ret));
22602         if (get_jenv_res == JNI_EDETACHED) {
22603                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22604         }
22605         return ret_conv;
22606 }
22607 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
22608         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22609         JNIEnv *env;
22610         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22611         if (get_jenv_res == JNI_EDETACHED) {
22612                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22613         } else {
22614                 DO_ASSERT(get_jenv_res == JNI_OK);
22615         }
22616         int64_t message_type_conv = message_type;
22617         LDKu8slice buffer_var = buffer;
22618         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
22619         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
22620         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22621         CHECK(obj != NULL);
22622         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
22623         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22624                 (*env)->ExceptionDescribe(env);
22625                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
22626         }
22627         void* ret_ptr = untag_ptr(ret);
22628         CHECK_ACCESS(ret_ptr);
22629         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
22630         FREE(untag_ptr(ret));
22631         if (get_jenv_res == JNI_EDETACHED) {
22632                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22633         }
22634         return ret_conv;
22635 }
22636 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
22637         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22638         JNIEnv *env;
22639         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22640         if (get_jenv_res == JNI_EDETACHED) {
22641                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22642         } else {
22643                 DO_ASSERT(get_jenv_res == JNI_OK);
22644         }
22645         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22646         CHECK(obj != NULL);
22647         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
22648         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22649                 (*env)->ExceptionDescribe(env);
22650                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
22651         }
22652         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
22653         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
22654         if (ret_constr.datalen > 0)
22655                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
22656         else
22657                 ret_constr.data = NULL;
22658         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
22659         for (size_t e = 0; e < ret_constr.datalen; e++) {
22660                 int64_t ret_conv_56 = ret_vals[e];
22661                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
22662                 CHECK_ACCESS(ret_conv_56_ptr);
22663                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
22664                 FREE(untag_ptr(ret_conv_56));
22665                 ret_constr.data[e] = ret_conv_56_conv;
22666         }
22667         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
22668         if (get_jenv_res == JNI_EDETACHED) {
22669                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22670         }
22671         return ret_constr;
22672 }
22673 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
22674         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
22675         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22676 }
22677 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
22678         jclass c = (*env)->GetObjectClass(env, o);
22679         CHECK(c != NULL);
22680         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
22681         atomic_init(&calls->refcnt, 1);
22682         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22683         calls->o = (*env)->NewWeakGlobalRef(env, o);
22684         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
22685         CHECK(calls->handle_custom_message_meth != NULL);
22686         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
22687         CHECK(calls->read_custom_message_meth != NULL);
22688         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
22689         CHECK(calls->release_pending_custom_messages_meth != NULL);
22690
22691         LDKCustomOnionMessageHandler ret = {
22692                 .this_arg = (void*) calls,
22693                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
22694                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
22695                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
22696                 .free = LDKCustomOnionMessageHandler_JCalls_free,
22697         };
22698         return ret;
22699 }
22700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
22701         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
22702         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
22703         return tag_ptr(res_ptr, true);
22704 }
22705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
22706         void* this_arg_ptr = untag_ptr(this_arg);
22707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22708         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22709         void* msg_ptr = untag_ptr(msg);
22710         CHECK_ACCESS(msg_ptr);
22711         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
22712         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
22713                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22714                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
22715         }
22716         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22717         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
22718         int64_t ret_ref = tag_ptr(ret_copy, true);
22719         return ret_ref;
22720 }
22721
22722 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) {
22723         void* this_arg_ptr = untag_ptr(this_arg);
22724         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22725         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22726         LDKu8slice buffer_ref;
22727         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
22728         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
22729         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22730         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
22731         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
22732         return tag_ptr(ret_conv, true);
22733 }
22734
22735 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
22736         void* this_arg_ptr = untag_ptr(this_arg);
22737         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22738         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22739         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
22740         int64_tArray ret_arr = NULL;
22741         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22742         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22743         for (size_t e = 0; e < ret_var.datalen; e++) {
22744                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22745                 *ret_conv_56_conv = ret_var.data[e];
22746                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
22747         }
22748         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22749         FREE(ret_var.data);
22750         return ret_arr;
22751 }
22752
22753 typedef struct LDKSocketDescriptor_JCalls {
22754         atomic_size_t refcnt;
22755         JavaVM *vm;
22756         jweak o;
22757         jmethodID send_data_meth;
22758         jmethodID disconnect_socket_meth;
22759         jmethodID eq_meth;
22760         jmethodID hash_meth;
22761 } LDKSocketDescriptor_JCalls;
22762 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
22763         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22764         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22765                 JNIEnv *env;
22766                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22767                 if (get_jenv_res == JNI_EDETACHED) {
22768                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22769                 } else {
22770                         DO_ASSERT(get_jenv_res == JNI_OK);
22771                 }
22772                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22773                 if (get_jenv_res == JNI_EDETACHED) {
22774                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22775                 }
22776                 FREE(j_calls);
22777         }
22778 }
22779 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
22780         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22781         JNIEnv *env;
22782         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22783         if (get_jenv_res == JNI_EDETACHED) {
22784                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22785         } else {
22786                 DO_ASSERT(get_jenv_res == JNI_OK);
22787         }
22788         LDKu8slice data_var = data;
22789         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
22790         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
22791         jboolean resume_read_conv = resume_read;
22792         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22793         CHECK(obj != NULL);
22794         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
22795         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22796                 (*env)->ExceptionDescribe(env);
22797                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
22798         }
22799         if (get_jenv_res == JNI_EDETACHED) {
22800                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22801         }
22802         return ret;
22803 }
22804 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
22805         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22806         JNIEnv *env;
22807         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22808         if (get_jenv_res == JNI_EDETACHED) {
22809                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22810         } else {
22811                 DO_ASSERT(get_jenv_res == JNI_OK);
22812         }
22813         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22814         CHECK(obj != NULL);
22815         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
22816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22817                 (*env)->ExceptionDescribe(env);
22818                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
22819         }
22820         if (get_jenv_res == JNI_EDETACHED) {
22821                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22822         }
22823 }
22824 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
22825         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22826         JNIEnv *env;
22827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22828         if (get_jenv_res == JNI_EDETACHED) {
22829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22830         } else {
22831                 DO_ASSERT(get_jenv_res == JNI_OK);
22832         }
22833         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22834         *other_arg_clone = SocketDescriptor_clone(other_arg);
22835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22836         CHECK(obj != NULL);
22837         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
22838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22839                 (*env)->ExceptionDescribe(env);
22840                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
22841         }
22842         if (get_jenv_res == JNI_EDETACHED) {
22843                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22844         }
22845         return ret;
22846 }
22847 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
22848         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22849         JNIEnv *env;
22850         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22851         if (get_jenv_res == JNI_EDETACHED) {
22852                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22853         } else {
22854                 DO_ASSERT(get_jenv_res == JNI_OK);
22855         }
22856         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22857         CHECK(obj != NULL);
22858         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
22859         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22860                 (*env)->ExceptionDescribe(env);
22861                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
22862         }
22863         if (get_jenv_res == JNI_EDETACHED) {
22864                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22865         }
22866         return ret;
22867 }
22868 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
22869         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
22870         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22871 }
22872 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
22873         jclass c = (*env)->GetObjectClass(env, o);
22874         CHECK(c != NULL);
22875         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
22876         atomic_init(&calls->refcnt, 1);
22877         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22878         calls->o = (*env)->NewWeakGlobalRef(env, o);
22879         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
22880         CHECK(calls->send_data_meth != NULL);
22881         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
22882         CHECK(calls->disconnect_socket_meth != NULL);
22883         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
22884         CHECK(calls->eq_meth != NULL);
22885         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
22886         CHECK(calls->hash_meth != NULL);
22887
22888         LDKSocketDescriptor ret = {
22889                 .this_arg = (void*) calls,
22890                 .send_data = send_data_LDKSocketDescriptor_jcall,
22891                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
22892                 .eq = eq_LDKSocketDescriptor_jcall,
22893                 .hash = hash_LDKSocketDescriptor_jcall,
22894                 .cloned = LDKSocketDescriptor_JCalls_cloned,
22895                 .free = LDKSocketDescriptor_JCalls_free,
22896         };
22897         return ret;
22898 }
22899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
22900         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22901         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
22902         return tag_ptr(res_ptr, true);
22903 }
22904 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) {
22905         void* this_arg_ptr = untag_ptr(this_arg);
22906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22907         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22908         LDKu8slice data_ref;
22909         data_ref.datalen = (*env)->GetArrayLength(env, data);
22910         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
22911         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
22912         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
22913         return ret_conv;
22914 }
22915
22916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
22917         void* this_arg_ptr = untag_ptr(this_arg);
22918         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22919         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22920         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
22921 }
22922
22923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
22924         void* this_arg_ptr = untag_ptr(this_arg);
22925         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22926         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22927         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
22928         return ret_conv;
22929 }
22930
22931 typedef struct LDKSignBolt12InvoiceFn_JCalls {
22932         atomic_size_t refcnt;
22933         JavaVM *vm;
22934         jweak o;
22935         jmethodID sign_invoice_meth;
22936 } LDKSignBolt12InvoiceFn_JCalls;
22937 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
22938         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
22939         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22940                 JNIEnv *env;
22941                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22942                 if (get_jenv_res == JNI_EDETACHED) {
22943                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22944                 } else {
22945                         DO_ASSERT(get_jenv_res == JNI_OK);
22946                 }
22947                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22948                 if (get_jenv_res == JNI_EDETACHED) {
22949                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22950                 }
22951                 FREE(j_calls);
22952         }
22953 }
22954 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
22955         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
22956         JNIEnv *env;
22957         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22958         if (get_jenv_res == JNI_EDETACHED) {
22959                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22960         } else {
22961                 DO_ASSERT(get_jenv_res == JNI_OK);
22962         }
22963         LDKUnsignedBolt12Invoice message_var = *message;
22964         int64_t message_ref = 0;
22965         message_var = UnsignedBolt12Invoice_clone(&message_var);
22966         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
22967         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
22968         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22969         CHECK(obj != NULL);
22970         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, message_ref);
22971         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22972                 (*env)->ExceptionDescribe(env);
22973                 (*env)->FatalError(env, "A call to sign_invoice in LDKSignBolt12InvoiceFn from rust threw an exception.");
22974         }
22975         void* ret_ptr = untag_ptr(ret);
22976         CHECK_ACCESS(ret_ptr);
22977         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
22978         FREE(untag_ptr(ret));
22979         if (get_jenv_res == JNI_EDETACHED) {
22980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22981         }
22982         return ret_conv;
22983 }
22984 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
22985         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
22986         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22987 }
22988 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (JNIEnv *env, jclass clz, jobject o) {
22989         jclass c = (*env)->GetObjectClass(env, o);
22990         CHECK(c != NULL);
22991         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
22992         atomic_init(&calls->refcnt, 1);
22993         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22994         calls->o = (*env)->NewWeakGlobalRef(env, o);
22995         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "(J)J");
22996         CHECK(calls->sign_invoice_meth != NULL);
22997
22998         LDKSignBolt12InvoiceFn ret = {
22999                 .this_arg = (void*) calls,
23000                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
23001                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
23002         };
23003         return ret;
23004 }
23005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignBolt12InvoiceFn_1new(JNIEnv *env, jclass clz, jobject o) {
23006         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
23007         *res_ptr = LDKSignBolt12InvoiceFn_init(env, clz, o);
23008         return tag_ptr(res_ptr, true);
23009 }
23010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignBolt12InvoiceFn_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
23011         void* this_arg_ptr = untag_ptr(this_arg);
23012         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23013         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
23014         LDKUnsignedBolt12Invoice message_conv;
23015         message_conv.inner = untag_ptr(message);
23016         message_conv.is_owned = ptr_is_owned(message);
23017         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
23018         message_conv.is_owned = false;
23019         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23020         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
23021         return tag_ptr(ret_conv, true);
23022 }
23023
23024 typedef struct LDKSignInvoiceRequestFn_JCalls {
23025         atomic_size_t refcnt;
23026         JavaVM *vm;
23027         jweak o;
23028         jmethodID sign_invoice_request_meth;
23029 } LDKSignInvoiceRequestFn_JCalls;
23030 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
23031         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
23032         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23033                 JNIEnv *env;
23034                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23035                 if (get_jenv_res == JNI_EDETACHED) {
23036                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23037                 } else {
23038                         DO_ASSERT(get_jenv_res == JNI_OK);
23039                 }
23040                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23041                 if (get_jenv_res == JNI_EDETACHED) {
23042                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23043                 }
23044                 FREE(j_calls);
23045         }
23046 }
23047 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
23048         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
23049         JNIEnv *env;
23050         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23051         if (get_jenv_res == JNI_EDETACHED) {
23052                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23053         } else {
23054                 DO_ASSERT(get_jenv_res == JNI_OK);
23055         }
23056         LDKUnsignedInvoiceRequest message_var = *message;
23057         int64_t message_ref = 0;
23058         message_var = UnsignedInvoiceRequest_clone(&message_var);
23059         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
23060         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
23061         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23062         CHECK(obj != NULL);
23063         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_request_meth, message_ref);
23064         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23065                 (*env)->ExceptionDescribe(env);
23066                 (*env)->FatalError(env, "A call to sign_invoice_request in LDKSignInvoiceRequestFn from rust threw an exception.");
23067         }
23068         void* ret_ptr = untag_ptr(ret);
23069         CHECK_ACCESS(ret_ptr);
23070         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
23071         FREE(untag_ptr(ret));
23072         if (get_jenv_res == JNI_EDETACHED) {
23073                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23074         }
23075         return ret_conv;
23076 }
23077 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
23078         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
23079         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23080 }
23081 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (JNIEnv *env, jclass clz, jobject o) {
23082         jclass c = (*env)->GetObjectClass(env, o);
23083         CHECK(c != NULL);
23084         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
23085         atomic_init(&calls->refcnt, 1);
23086         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23087         calls->o = (*env)->NewWeakGlobalRef(env, o);
23088         calls->sign_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_invoice_request", "(J)J");
23089         CHECK(calls->sign_invoice_request_meth != NULL);
23090
23091         LDKSignInvoiceRequestFn ret = {
23092                 .this_arg = (void*) calls,
23093                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
23094                 .free = LDKSignInvoiceRequestFn_JCalls_free,
23095         };
23096         return ret;
23097 }
23098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignInvoiceRequestFn_1new(JNIEnv *env, jclass clz, jobject o) {
23099         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
23100         *res_ptr = LDKSignInvoiceRequestFn_init(env, clz, o);
23101         return tag_ptr(res_ptr, true);
23102 }
23103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignInvoiceRequestFn_1sign_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
23104         void* this_arg_ptr = untag_ptr(this_arg);
23105         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23106         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
23107         LDKUnsignedInvoiceRequest message_conv;
23108         message_conv.inner = untag_ptr(message);
23109         message_conv.is_owned = ptr_is_owned(message);
23110         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
23111         message_conv.is_owned = false;
23112         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23113         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
23114         return tag_ptr(ret_conv, true);
23115 }
23116
23117 static jclass LDKSignError_Signing_class = NULL;
23118 static jmethodID LDKSignError_Signing_meth = NULL;
23119 static jclass LDKSignError_Verification_class = NULL;
23120 static jmethodID LDKSignError_Verification_meth = NULL;
23121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignError_init (JNIEnv *env, jclass clz) {
23122         LDKSignError_Signing_class =
23123                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignError$Signing"));
23124         CHECK(LDKSignError_Signing_class != NULL);
23125         LDKSignError_Signing_meth = (*env)->GetMethodID(env, LDKSignError_Signing_class, "<init>", "()V");
23126         CHECK(LDKSignError_Signing_meth != NULL);
23127         LDKSignError_Verification_class =
23128                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignError$Verification"));
23129         CHECK(LDKSignError_Verification_class != NULL);
23130         LDKSignError_Verification_meth = (*env)->GetMethodID(env, LDKSignError_Verification_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
23131         CHECK(LDKSignError_Verification_meth != NULL);
23132 }
23133 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23134         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
23135         switch(obj->tag) {
23136                 case LDKSignError_Signing: {
23137                         return (*env)->NewObject(env, LDKSignError_Signing_class, LDKSignError_Signing_meth);
23138                 }
23139                 case LDKSignError_Verification: {
23140                         jclass verification_conv = LDKSecp256k1Error_to_java(env, obj->verification);
23141                         return (*env)->NewObject(env, LDKSignError_Verification_class, LDKSignError_Verification_meth, verification_conv);
23142                 }
23143                 default: abort();
23144         }
23145 }
23146 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
23147 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
23148 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
23149 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
23150 static jclass LDKEffectiveCapacity_Total_class = NULL;
23151 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
23152 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
23153 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
23154 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
23155 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
23156 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
23157 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
23158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
23159         LDKEffectiveCapacity_ExactLiquidity_class =
23160                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
23161         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
23162         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
23163         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
23164         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
23165                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
23166         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
23167         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
23168         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
23169         LDKEffectiveCapacity_Total_class =
23170                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
23171         CHECK(LDKEffectiveCapacity_Total_class != NULL);
23172         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
23173         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
23174         LDKEffectiveCapacity_Infinite_class =
23175                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
23176         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
23177         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
23178         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
23179         LDKEffectiveCapacity_HintMaxHTLC_class =
23180                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
23181         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
23182         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
23183         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
23184         LDKEffectiveCapacity_Unknown_class =
23185                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
23186         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
23187         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
23188         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
23189 }
23190 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23191         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
23192         switch(obj->tag) {
23193                 case LDKEffectiveCapacity_ExactLiquidity: {
23194                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
23195                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
23196                 }
23197                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
23198                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
23199                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
23200                 }
23201                 case LDKEffectiveCapacity_Total: {
23202                         int64_t capacity_msat_conv = obj->total.capacity_msat;
23203                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
23204                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
23205                 }
23206                 case LDKEffectiveCapacity_Infinite: {
23207                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
23208                 }
23209                 case LDKEffectiveCapacity_HintMaxHTLC: {
23210                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
23211                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
23212                 }
23213                 case LDKEffectiveCapacity_Unknown: {
23214                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
23215                 }
23216                 default: abort();
23217         }
23218 }
23219 static jclass LDKPayee_Blinded_class = NULL;
23220 static jmethodID LDKPayee_Blinded_meth = NULL;
23221 static jclass LDKPayee_Clear_class = NULL;
23222 static jmethodID LDKPayee_Clear_meth = NULL;
23223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
23224         LDKPayee_Blinded_class =
23225                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
23226         CHECK(LDKPayee_Blinded_class != NULL);
23227         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
23228         CHECK(LDKPayee_Blinded_meth != NULL);
23229         LDKPayee_Clear_class =
23230                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
23231         CHECK(LDKPayee_Clear_class != NULL);
23232         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
23233         CHECK(LDKPayee_Clear_meth != NULL);
23234 }
23235 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23236         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
23237         switch(obj->tag) {
23238                 case LDKPayee_Blinded: {
23239                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
23240                         int64_tArray route_hints_arr = NULL;
23241                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
23242                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
23243                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
23244                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23245                                 *route_hints_conv_37_conv = route_hints_var.data[l];
23246                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
23247                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
23248                         }
23249                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
23250                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
23251                         int64_t features_ref = 0;
23252                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
23253                         features_ref = tag_ptr(features_var.inner, false);
23254                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
23255                 }
23256                 case LDKPayee_Clear: {
23257                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
23258                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
23259                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
23260                         int64_tArray route_hints_arr = NULL;
23261                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
23262                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
23263                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
23264                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
23265                                 int64_t route_hints_conv_11_ref = 0;
23266                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
23267                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
23268                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
23269                         }
23270                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
23271                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
23272                         int64_t features_ref = 0;
23273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
23274                         features_ref = tag_ptr(features_var.inner, false);
23275                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
23276                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
23277                 }
23278                 default: abort();
23279         }
23280 }
23281 typedef struct LDKScore_JCalls {
23282         atomic_size_t refcnt;
23283         JavaVM *vm;
23284         jweak o;
23285         LDKScoreLookUp_JCalls* ScoreLookUp;
23286         LDKScoreUpdate_JCalls* ScoreUpdate;
23287         jmethodID write_meth;
23288 } LDKScore_JCalls;
23289 static void LDKScore_JCalls_free(void* this_arg) {
23290         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
23291         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23292                 JNIEnv *env;
23293                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23294                 if (get_jenv_res == JNI_EDETACHED) {
23295                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23296                 } else {
23297                         DO_ASSERT(get_jenv_res == JNI_OK);
23298                 }
23299                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23300                 if (get_jenv_res == JNI_EDETACHED) {
23301                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23302                 }
23303                 FREE(j_calls);
23304         }
23305 }
23306 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
23307         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
23308         JNIEnv *env;
23309         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23310         if (get_jenv_res == JNI_EDETACHED) {
23311                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23312         } else {
23313                 DO_ASSERT(get_jenv_res == JNI_OK);
23314         }
23315         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23316         CHECK(obj != NULL);
23317         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
23318         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23319                 (*env)->ExceptionDescribe(env);
23320                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
23321         }
23322         LDKCVec_u8Z ret_ref;
23323         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
23324         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
23325         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
23326         if (get_jenv_res == JNI_EDETACHED) {
23327                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23328         }
23329         return ret_ref;
23330 }
23331 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
23332         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
23333         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23334         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
23335         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
23336 }
23337 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
23338         jclass c = (*env)->GetObjectClass(env, o);
23339         CHECK(c != NULL);
23340         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
23341         atomic_init(&calls->refcnt, 1);
23342         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23343         calls->o = (*env)->NewWeakGlobalRef(env, o);
23344         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
23345         CHECK(calls->write_meth != NULL);
23346
23347         LDKScore ret = {
23348                 .this_arg = (void*) calls,
23349                 .write = write_LDKScore_jcall,
23350                 .free = LDKScore_JCalls_free,
23351                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
23352                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
23353         };
23354         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
23355         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
23356         return ret;
23357 }
23358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
23359         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
23360         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
23361         return tag_ptr(res_ptr, true);
23362 }
23363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
23364         LDKScore *inp = (LDKScore *)untag_ptr(arg);
23365         return tag_ptr(&inp->ScoreLookUp, false);
23366 }
23367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
23368         LDKScore *inp = (LDKScore *)untag_ptr(arg);
23369         return tag_ptr(&inp->ScoreUpdate, false);
23370 }
23371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
23372         void* this_arg_ptr = untag_ptr(this_arg);
23373         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23374         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
23375         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
23376         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23377         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23378         CVec_u8Z_free(ret_var);
23379         return ret_arr;
23380 }
23381
23382 static jclass LDKIntroductionNode_NodeId_class = NULL;
23383 static jmethodID LDKIntroductionNode_NodeId_meth = NULL;
23384 static jclass LDKIntroductionNode_DirectedShortChannelId_class = NULL;
23385 static jmethodID LDKIntroductionNode_DirectedShortChannelId_meth = NULL;
23386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKIntroductionNode_init (JNIEnv *env, jclass clz) {
23387         LDKIntroductionNode_NodeId_class =
23388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKIntroductionNode$NodeId"));
23389         CHECK(LDKIntroductionNode_NodeId_class != NULL);
23390         LDKIntroductionNode_NodeId_meth = (*env)->GetMethodID(env, LDKIntroductionNode_NodeId_class, "<init>", "([B)V");
23391         CHECK(LDKIntroductionNode_NodeId_meth != NULL);
23392         LDKIntroductionNode_DirectedShortChannelId_class =
23393                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKIntroductionNode$DirectedShortChannelId"));
23394         CHECK(LDKIntroductionNode_DirectedShortChannelId_class != NULL);
23395         LDKIntroductionNode_DirectedShortChannelId_meth = (*env)->GetMethodID(env, LDKIntroductionNode_DirectedShortChannelId_class, "<init>", "(Lorg/ldk/enums/Direction;J)V");
23396         CHECK(LDKIntroductionNode_DirectedShortChannelId_meth != NULL);
23397 }
23398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKIntroductionNode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23399         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
23400         switch(obj->tag) {
23401                 case LDKIntroductionNode_NodeId: {
23402                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
23403                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_id.compressed_form);
23404                         return (*env)->NewObject(env, LDKIntroductionNode_NodeId_class, LDKIntroductionNode_NodeId_meth, node_id_arr);
23405                 }
23406                 case LDKIntroductionNode_DirectedShortChannelId: {
23407                         jclass _0_conv = LDKDirection_to_java(env, obj->directed_short_channel_id._0);
23408                         int64_t _1_conv = obj->directed_short_channel_id._1;
23409                         return (*env)->NewObject(env, LDKIntroductionNode_DirectedShortChannelId_class, LDKIntroductionNode_DirectedShortChannelId_meth, _0_conv, _1_conv);
23410                 }
23411                 default: abort();
23412         }
23413 }
23414 typedef struct LDKCoinSelectionSource_JCalls {
23415         atomic_size_t refcnt;
23416         JavaVM *vm;
23417         jweak o;
23418         jmethodID select_confirmed_utxos_meth;
23419         jmethodID sign_psbt_meth;
23420 } LDKCoinSelectionSource_JCalls;
23421 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
23422         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23423         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23424                 JNIEnv *env;
23425                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23426                 if (get_jenv_res == JNI_EDETACHED) {
23427                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23428                 } else {
23429                         DO_ASSERT(get_jenv_res == JNI_OK);
23430                 }
23431                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23432                 if (get_jenv_res == JNI_EDETACHED) {
23433                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23434                 }
23435                 FREE(j_calls);
23436         }
23437 }
23438 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) {
23439         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23440         JNIEnv *env;
23441         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23442         if (get_jenv_res == JNI_EDETACHED) {
23443                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23444         } else {
23445                 DO_ASSERT(get_jenv_res == JNI_OK);
23446         }
23447         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
23448         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
23449         LDKCVec_InputZ must_spend_var = must_spend;
23450         int64_tArray must_spend_arr = NULL;
23451         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
23452         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
23453         for (size_t h = 0; h < must_spend_var.datalen; h++) {
23454                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
23455                 int64_t must_spend_conv_7_ref = 0;
23456                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
23457                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
23458                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
23459         }
23460         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
23461         FREE(must_spend_var.data);
23462         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
23463         int64_tArray must_pay_to_arr = NULL;
23464         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
23465         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
23466         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
23467                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23468                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
23469                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
23470         }
23471         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
23472         FREE(must_pay_to_var.data);
23473         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
23474         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23475         CHECK(obj != NULL);
23476         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);
23477         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23478                 (*env)->ExceptionDescribe(env);
23479                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
23480         }
23481         void* ret_ptr = untag_ptr(ret);
23482         CHECK_ACCESS(ret_ptr);
23483         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
23484         FREE(untag_ptr(ret));
23485         if (get_jenv_res == JNI_EDETACHED) {
23486                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23487         }
23488         return ret_conv;
23489 }
23490 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
23491         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23492         JNIEnv *env;
23493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23494         if (get_jenv_res == JNI_EDETACHED) {
23495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23496         } else {
23497                 DO_ASSERT(get_jenv_res == JNI_OK);
23498         }
23499         LDKCVec_u8Z psbt_var = psbt;
23500         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
23501         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
23502         CVec_u8Z_free(psbt_var);
23503         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23504         CHECK(obj != NULL);
23505         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
23506         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23507                 (*env)->ExceptionDescribe(env);
23508                 (*env)->FatalError(env, "A call to sign_psbt in LDKCoinSelectionSource from rust threw an exception.");
23509         }
23510         void* ret_ptr = untag_ptr(ret);
23511         CHECK_ACCESS(ret_ptr);
23512         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
23513         FREE(untag_ptr(ret));
23514         if (get_jenv_res == JNI_EDETACHED) {
23515                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23516         }
23517         return ret_conv;
23518 }
23519 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
23520         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
23521         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23522 }
23523 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
23524         jclass c = (*env)->GetObjectClass(env, o);
23525         CHECK(c != NULL);
23526         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
23527         atomic_init(&calls->refcnt, 1);
23528         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23529         calls->o = (*env)->NewWeakGlobalRef(env, o);
23530         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
23531         CHECK(calls->select_confirmed_utxos_meth != NULL);
23532         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
23533         CHECK(calls->sign_psbt_meth != NULL);
23534
23535         LDKCoinSelectionSource ret = {
23536                 .this_arg = (void*) calls,
23537                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
23538                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
23539                 .free = LDKCoinSelectionSource_JCalls_free,
23540         };
23541         return ret;
23542 }
23543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
23544         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
23545         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
23546         return tag_ptr(res_ptr, true);
23547 }
23548 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) {
23549         void* this_arg_ptr = untag_ptr(this_arg);
23550         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23551         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
23552         LDKThirtyTwoBytes claim_id_ref;
23553         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
23554         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
23555         LDKCVec_InputZ must_spend_constr;
23556         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
23557         if (must_spend_constr.datalen > 0)
23558                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23559         else
23560                 must_spend_constr.data = NULL;
23561         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
23562         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
23563                 int64_t must_spend_conv_7 = must_spend_vals[h];
23564                 LDKInput must_spend_conv_7_conv;
23565                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
23566                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
23567                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
23568                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
23569                 must_spend_constr.data[h] = must_spend_conv_7_conv;
23570         }
23571         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
23572         LDKCVec_TxOutZ must_pay_to_constr;
23573         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
23574         if (must_pay_to_constr.datalen > 0)
23575                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23576         else
23577                 must_pay_to_constr.data = NULL;
23578         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
23579         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
23580                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
23581                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
23582                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
23583                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
23584                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
23585                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
23586         }
23587         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
23588         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23589         *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);
23590         return tag_ptr(ret_conv, true);
23591 }
23592
23593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
23594         void* this_arg_ptr = untag_ptr(this_arg);
23595         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23596         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
23597         LDKCVec_u8Z psbt_ref;
23598         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
23599         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
23600         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
23601         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23602         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
23603         return tag_ptr(ret_conv, true);
23604 }
23605
23606 typedef struct LDKWalletSource_JCalls {
23607         atomic_size_t refcnt;
23608         JavaVM *vm;
23609         jweak o;
23610         jmethodID list_confirmed_utxos_meth;
23611         jmethodID get_change_script_meth;
23612         jmethodID sign_psbt_meth;
23613 } LDKWalletSource_JCalls;
23614 static void LDKWalletSource_JCalls_free(void* this_arg) {
23615         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23616         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23617                 JNIEnv *env;
23618                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23619                 if (get_jenv_res == JNI_EDETACHED) {
23620                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23621                 } else {
23622                         DO_ASSERT(get_jenv_res == JNI_OK);
23623                 }
23624                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23625                 if (get_jenv_res == JNI_EDETACHED) {
23626                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23627                 }
23628                 FREE(j_calls);
23629         }
23630 }
23631 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
23632         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23633         JNIEnv *env;
23634         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23635         if (get_jenv_res == JNI_EDETACHED) {
23636                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23637         } else {
23638                 DO_ASSERT(get_jenv_res == JNI_OK);
23639         }
23640         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23641         CHECK(obj != NULL);
23642         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
23643         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23644                 (*env)->ExceptionDescribe(env);
23645                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
23646         }
23647         void* ret_ptr = untag_ptr(ret);
23648         CHECK_ACCESS(ret_ptr);
23649         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
23650         FREE(untag_ptr(ret));
23651         if (get_jenv_res == JNI_EDETACHED) {
23652                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23653         }
23654         return ret_conv;
23655 }
23656 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
23657         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23658         JNIEnv *env;
23659         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23660         if (get_jenv_res == JNI_EDETACHED) {
23661                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23662         } else {
23663                 DO_ASSERT(get_jenv_res == JNI_OK);
23664         }
23665         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23666         CHECK(obj != NULL);
23667         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
23668         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23669                 (*env)->ExceptionDescribe(env);
23670                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
23671         }
23672         void* ret_ptr = untag_ptr(ret);
23673         CHECK_ACCESS(ret_ptr);
23674         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
23675         FREE(untag_ptr(ret));
23676         if (get_jenv_res == JNI_EDETACHED) {
23677                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23678         }
23679         return ret_conv;
23680 }
23681 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
23682         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23683         JNIEnv *env;
23684         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23685         if (get_jenv_res == JNI_EDETACHED) {
23686                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23687         } else {
23688                 DO_ASSERT(get_jenv_res == JNI_OK);
23689         }
23690         LDKCVec_u8Z psbt_var = psbt;
23691         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
23692         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
23693         CVec_u8Z_free(psbt_var);
23694         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23695         CHECK(obj != NULL);
23696         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
23697         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23698                 (*env)->ExceptionDescribe(env);
23699                 (*env)->FatalError(env, "A call to sign_psbt in LDKWalletSource from rust threw an exception.");
23700         }
23701         void* ret_ptr = untag_ptr(ret);
23702         CHECK_ACCESS(ret_ptr);
23703         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
23704         FREE(untag_ptr(ret));
23705         if (get_jenv_res == JNI_EDETACHED) {
23706                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23707         }
23708         return ret_conv;
23709 }
23710 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
23711         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
23712         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23713 }
23714 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
23715         jclass c = (*env)->GetObjectClass(env, o);
23716         CHECK(c != NULL);
23717         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
23718         atomic_init(&calls->refcnt, 1);
23719         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23720         calls->o = (*env)->NewWeakGlobalRef(env, o);
23721         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
23722         CHECK(calls->list_confirmed_utxos_meth != NULL);
23723         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
23724         CHECK(calls->get_change_script_meth != NULL);
23725         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
23726         CHECK(calls->sign_psbt_meth != NULL);
23727
23728         LDKWalletSource ret = {
23729                 .this_arg = (void*) calls,
23730                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
23731                 .get_change_script = get_change_script_LDKWalletSource_jcall,
23732                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
23733                 .free = LDKWalletSource_JCalls_free,
23734         };
23735         return ret;
23736 }
23737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
23738         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
23739         *res_ptr = LDKWalletSource_init(env, clz, o);
23740         return tag_ptr(res_ptr, true);
23741 }
23742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
23743         void* this_arg_ptr = untag_ptr(this_arg);
23744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23745         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23746         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23747         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
23748         return tag_ptr(ret_conv, true);
23749 }
23750
23751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
23752         void* this_arg_ptr = untag_ptr(this_arg);
23753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23754         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23755         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23756         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
23757         return tag_ptr(ret_conv, true);
23758 }
23759
23760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
23761         void* this_arg_ptr = untag_ptr(this_arg);
23762         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23763         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23764         LDKCVec_u8Z psbt_ref;
23765         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
23766         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
23767         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
23768         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23769         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
23770         return tag_ptr(ret_conv, true);
23771 }
23772
23773 static jclass LDKGossipSync_P2P_class = NULL;
23774 static jmethodID LDKGossipSync_P2P_meth = NULL;
23775 static jclass LDKGossipSync_Rapid_class = NULL;
23776 static jmethodID LDKGossipSync_Rapid_meth = NULL;
23777 static jclass LDKGossipSync_None_class = NULL;
23778 static jmethodID LDKGossipSync_None_meth = NULL;
23779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
23780         LDKGossipSync_P2P_class =
23781                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
23782         CHECK(LDKGossipSync_P2P_class != NULL);
23783         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
23784         CHECK(LDKGossipSync_P2P_meth != NULL);
23785         LDKGossipSync_Rapid_class =
23786                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
23787         CHECK(LDKGossipSync_Rapid_class != NULL);
23788         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
23789         CHECK(LDKGossipSync_Rapid_meth != NULL);
23790         LDKGossipSync_None_class =
23791                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
23792         CHECK(LDKGossipSync_None_class != NULL);
23793         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
23794         CHECK(LDKGossipSync_None_meth != NULL);
23795 }
23796 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23797         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
23798         switch(obj->tag) {
23799                 case LDKGossipSync_P2P: {
23800                         LDKP2PGossipSync p2p_var = obj->p2p;
23801                         int64_t p2p_ref = 0;
23802                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
23803                         p2p_ref = tag_ptr(p2p_var.inner, false);
23804                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
23805                 }
23806                 case LDKGossipSync_Rapid: {
23807                         LDKRapidGossipSync rapid_var = obj->rapid;
23808                         int64_t rapid_ref = 0;
23809                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
23810                         rapid_ref = tag_ptr(rapid_var.inner, false);
23811                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
23812                 }
23813                 case LDKGossipSync_None: {
23814                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
23815                 }
23816                 default: abort();
23817         }
23818 }
23819 static jclass LDKFallback_SegWitProgram_class = NULL;
23820 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
23821 static jclass LDKFallback_PubKeyHash_class = NULL;
23822 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
23823 static jclass LDKFallback_ScriptHash_class = NULL;
23824 static jmethodID LDKFallback_ScriptHash_meth = NULL;
23825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
23826         LDKFallback_SegWitProgram_class =
23827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
23828         CHECK(LDKFallback_SegWitProgram_class != NULL);
23829         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
23830         CHECK(LDKFallback_SegWitProgram_meth != NULL);
23831         LDKFallback_PubKeyHash_class =
23832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
23833         CHECK(LDKFallback_PubKeyHash_class != NULL);
23834         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
23835         CHECK(LDKFallback_PubKeyHash_meth != NULL);
23836         LDKFallback_ScriptHash_class =
23837                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
23838         CHECK(LDKFallback_ScriptHash_class != NULL);
23839         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
23840         CHECK(LDKFallback_ScriptHash_meth != NULL);
23841 }
23842 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23843         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
23844         switch(obj->tag) {
23845                 case LDKFallback_SegWitProgram: {
23846                         uint8_t version_val = obj->seg_wit_program.version._0;
23847                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
23848                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
23849                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
23850                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
23851                 }
23852                 case LDKFallback_PubKeyHash: {
23853                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
23854                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
23855                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
23856                 }
23857                 case LDKFallback_ScriptHash: {
23858                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
23859                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
23860                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
23861                 }
23862                 default: abort();
23863         }
23864 }
23865 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
23866         LDKStr ret_str = _ldk_get_compiled_version();
23867         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23868         Str_free(ret_str);
23869         return ret_conv;
23870 }
23871
23872 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
23873         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
23874         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23875         Str_free(ret_str);
23876         return ret_conv;
23877 }
23878
23879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
23880         LDKU128 val_ref;
23881         CHECK((*env)->GetArrayLength(env, val) == 16);
23882         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
23883         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
23884         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
23885         return ret_arr;
23886 }
23887
23888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
23889         LDKSixteenBytes le_bytes_ref;
23890         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
23891         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
23892         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
23893         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
23894         return ret_arr;
23895 }
23896
23897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1new(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
23898         
23899         LDKCVec_u8Z program_ref;
23900         program_ref.datalen = (*env)->GetArrayLength(env, program);
23901         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
23902         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
23903         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23904         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
23905         return tag_ptr(ret_ref, true);
23906 }
23907
23908 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1version(JNIEnv *env, jclass clz, int64_t prog) {
23909         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
23910         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
23911         return ret_val;
23912 }
23913
23914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1program(JNIEnv *env, jclass clz, int64_t prog) {
23915         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
23916         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
23917         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23918         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23919         return ret_arr;
23920 }
23921
23922 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
23923         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23924         *ret_ref = WitnessProgram_clone(arg);
23925         return tag_ptr(ret_ref, true);
23926 }
23927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23928         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
23929         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
23930         return ret_conv;
23931 }
23932
23933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23934         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
23935         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23936         *ret_ref = WitnessProgram_clone(orig_conv);
23937         return tag_ptr(ret_ref, true);
23938 }
23939
23940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1free(JNIEnv *env, jclass clz, int64_t o) {
23941         if (!ptr_is_owned(o)) return;
23942         void* o_ptr = untag_ptr(o);
23943         CHECK_ACCESS(o_ptr);
23944         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
23945         FREE(untag_ptr(o));
23946         WitnessProgram_free(o_conv);
23947 }
23948
23949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
23950         LDKThirtyTwoBytes big_endian_bytes_ref;
23951         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
23952         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
23953         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23954         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
23955         return tag_ptr(ret_ref, true);
23956 }
23957
23958 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
23959         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23960         *ret_ref = BigEndianScalar_clone(arg);
23961         return tag_ptr(ret_ref, true);
23962 }
23963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23964         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
23965         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
23966         return ret_conv;
23967 }
23968
23969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23970         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
23971         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23972         *ret_ref = BigEndianScalar_clone(orig_conv);
23973         return tag_ptr(ret_ref, true);
23974 }
23975
23976 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
23977         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
23978         *ret_copy = Bech32Error_clone(arg);
23979         int64_t ret_ref = tag_ptr(ret_copy, true);
23980         return ret_ref;
23981 }
23982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23983         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
23984         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
23985         return ret_conv;
23986 }
23987
23988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23989         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
23990         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
23991         *ret_copy = Bech32Error_clone(orig_conv);
23992         int64_t ret_ref = tag_ptr(ret_copy, true);
23993         return ret_ref;
23994 }
23995
23996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
23997         if (!ptr_is_owned(o)) return;
23998         void* o_ptr = untag_ptr(o);
23999         CHECK_ACCESS(o_ptr);
24000         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
24001         FREE(untag_ptr(o));
24002         Bech32Error_free(o_conv);
24003 }
24004
24005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
24006         LDKTransaction _res_ref;
24007         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
24008         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
24009         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
24010         _res_ref.data_is_owned = true;
24011         Transaction_free(_res_ref);
24012 }
24013
24014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
24015         LDKWitness _res_ref;
24016         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
24017         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
24018         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
24019         _res_ref.data_is_owned = true;
24020         Witness_free(_res_ref);
24021 }
24022
24023 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) {
24024         LDKWitness witness_ref;
24025         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
24026         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
24027         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
24028         witness_ref.data_is_owned = true;
24029         LDKCVec_u8Z script_sig_ref;
24030         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
24031         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
24032         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
24033         LDKThirtyTwoBytes previous_txid_ref;
24034         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
24035         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
24036         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
24037         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
24038         return tag_ptr(ret_ref, true);
24039 }
24040
24041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t txin) {
24042         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
24043         LDKWitness ret_var = TxIn_get_witness(txin_conv);
24044         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24045         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24046         Witness_free(ret_var);
24047         return ret_arr;
24048 }
24049
24050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t txin) {
24051         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
24052         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
24053         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24054         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24055         return ret_arr;
24056 }
24057
24058 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t txin) {
24059         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
24060         int32_t ret_conv = TxIn_get_sequence(txin_conv);
24061         return ret_conv;
24062 }
24063
24064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t txin) {
24065         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
24066         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24067         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(txin_conv).data);
24068         return ret_arr;
24069 }
24070
24071 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t txin) {
24072         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
24073         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
24074         return ret_conv;
24075 }
24076
24077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
24078         if (!ptr_is_owned(_res)) return;
24079         void* _res_ptr = untag_ptr(_res);
24080         CHECK_ACCESS(_res_ptr);
24081         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
24082         FREE(untag_ptr(_res));
24083         TxIn_free(_res_conv);
24084 }
24085
24086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
24087         LDKCVec_u8Z script_pubkey_ref;
24088         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
24089         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
24090         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
24091         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24092         *ret_ref = TxOut_new(script_pubkey_ref, value);
24093         return tag_ptr(ret_ref, true);
24094 }
24095
24096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t txout) {
24097         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
24098         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
24099         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24100         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24101         return ret_arr;
24102 }
24103
24104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t txout) {
24105         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
24106         int64_t ret_conv = TxOut_get_value(txout_conv);
24107         return ret_conv;
24108 }
24109
24110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
24111         if (!ptr_is_owned(_res)) return;
24112         void* _res_ptr = untag_ptr(_res);
24113         CHECK_ACCESS(_res_ptr);
24114         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
24115         FREE(untag_ptr(_res));
24116         TxOut_free(_res_conv);
24117 }
24118
24119 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
24120         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24121         *ret_ref = TxOut_clone(arg);
24122         return tag_ptr(ret_ref, true);
24123 }
24124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24125         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
24126         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
24127         return ret_conv;
24128 }
24129
24130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24131         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
24132         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24133         *ret_ref = TxOut_clone(orig_conv);
24134         return tag_ptr(ret_ref, true);
24135 }
24136
24137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
24138         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
24139         Str_free(dummy);
24140 }
24141
24142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
24143         LDKCVec_u8Z _res_ref;
24144         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
24145         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
24146         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
24147         CVec_u8Z_free(_res_ref);
24148 }
24149
24150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24151         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
24152         o_conv.inner = untag_ptr(o);
24153         o_conv.is_owned = ptr_is_owned(o);
24154         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24155         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
24156         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24157         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
24158         return tag_ptr(ret_conv, true);
24159 }
24160
24161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24162         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24163         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24164         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
24165         return tag_ptr(ret_conv, true);
24166 }
24167
24168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24169         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
24170         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
24171         return ret_conv;
24172 }
24173
24174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24175         if (!ptr_is_owned(_res)) return;
24176         void* _res_ptr = untag_ptr(_res);
24177         CHECK_ACCESS(_res_ptr);
24178         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
24179         FREE(untag_ptr(_res));
24180         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
24181 }
24182
24183 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
24184         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24185         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
24186         return tag_ptr(ret_conv, true);
24187 }
24188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24189         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
24190         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
24191         return ret_conv;
24192 }
24193
24194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24195         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
24196         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24197         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
24198         return tag_ptr(ret_conv, true);
24199 }
24200
24201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24202         LDKRefund o_conv;
24203         o_conv.inner = untag_ptr(o);
24204         o_conv.is_owned = ptr_is_owned(o);
24205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24206         o_conv = Refund_clone(&o_conv);
24207         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
24208         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
24209         return tag_ptr(ret_conv, true);
24210 }
24211
24212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24213         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24214         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
24215         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
24216         return tag_ptr(ret_conv, true);
24217 }
24218
24219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24220         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
24221         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
24222         return ret_conv;
24223 }
24224
24225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24226         if (!ptr_is_owned(_res)) return;
24227         void* _res_ptr = untag_ptr(_res);
24228         CHECK_ACCESS(_res_ptr);
24229         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
24230         FREE(untag_ptr(_res));
24231         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
24232 }
24233
24234 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
24235         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
24236         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
24237         return tag_ptr(ret_conv, true);
24238 }
24239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24240         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
24241         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
24242         return ret_conv;
24243 }
24244
24245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24246         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
24247         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
24248         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
24249         return tag_ptr(ret_conv, true);
24250 }
24251
24252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
24253         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24254         *ret_copy = COption_u64Z_some(o);
24255         int64_t ret_ref = tag_ptr(ret_copy, true);
24256         return ret_ref;
24257 }
24258
24259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
24260         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24261         *ret_copy = COption_u64Z_none();
24262         int64_t ret_ref = tag_ptr(ret_copy, true);
24263         return ret_ref;
24264 }
24265
24266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
24267         if (!ptr_is_owned(_res)) return;
24268         void* _res_ptr = untag_ptr(_res);
24269         CHECK_ACCESS(_res_ptr);
24270         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
24271         FREE(untag_ptr(_res));
24272         COption_u64Z_free(_res_conv);
24273 }
24274
24275 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
24276         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24277         *ret_copy = COption_u64Z_clone(arg);
24278         int64_t ret_ref = tag_ptr(ret_copy, true);
24279         return ret_ref;
24280 }
24281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24282         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
24283         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
24284         return ret_conv;
24285 }
24286
24287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24288         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
24289         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24290         *ret_copy = COption_u64Z_clone(orig_conv);
24291         int64_t ret_ref = tag_ptr(ret_copy, true);
24292         return ret_ref;
24293 }
24294
24295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24296         LDKCVec_BlindedPathZ _res_constr;
24297         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24298         if (_res_constr.datalen > 0)
24299                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
24300         else
24301                 _res_constr.data = NULL;
24302         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24303         for (size_t n = 0; n < _res_constr.datalen; n++) {
24304                 int64_t _res_conv_13 = _res_vals[n];
24305                 LDKBlindedPath _res_conv_13_conv;
24306                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
24307                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
24308                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
24309                 _res_constr.data[n] = _res_conv_13_conv;
24310         }
24311         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24312         CVec_BlindedPathZ_free(_res_constr);
24313 }
24314
24315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24316         LDKRefund o_conv;
24317         o_conv.inner = untag_ptr(o);
24318         o_conv.is_owned = ptr_is_owned(o);
24319         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24320         o_conv = Refund_clone(&o_conv);
24321         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24322         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
24323         return tag_ptr(ret_conv, true);
24324 }
24325
24326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24327         LDKBolt12ParseError 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 = Bolt12ParseError_clone(&e_conv);
24332         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24333         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
24334         return tag_ptr(ret_conv, true);
24335 }
24336
24337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24338         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
24339         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
24340         return ret_conv;
24341 }
24342
24343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_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_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
24348         FREE(untag_ptr(_res));
24349         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
24350 }
24351
24352 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
24353         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24354         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
24355         return tag_ptr(ret_conv, true);
24356 }
24357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24358         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
24359         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
24360         return ret_conv;
24361 }
24362
24363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24364         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
24365         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24366         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
24367         return tag_ptr(ret_conv, true);
24368 }
24369
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24371         void* o_ptr = untag_ptr(o);
24372         CHECK_ACCESS(o_ptr);
24373         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
24374         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
24375         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24376         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
24377         return tag_ptr(ret_conv, true);
24378 }
24379
24380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24381         void* e_ptr = untag_ptr(e);
24382         CHECK_ACCESS(e_ptr);
24383         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24384         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24385         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24386         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
24387         return tag_ptr(ret_conv, true);
24388 }
24389
24390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24391         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
24392         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
24393         return ret_conv;
24394 }
24395
24396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24397         if (!ptr_is_owned(_res)) return;
24398         void* _res_ptr = untag_ptr(_res);
24399         CHECK_ACCESS(_res_ptr);
24400         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
24401         FREE(untag_ptr(_res));
24402         CResult_RetryDecodeErrorZ_free(_res_conv);
24403 }
24404
24405 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
24406         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24407         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
24408         return tag_ptr(ret_conv, true);
24409 }
24410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24411         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
24412         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
24413         return ret_conv;
24414 }
24415
24416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24417         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
24418         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24419         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
24420         return tag_ptr(ret_conv, true);
24421 }
24422
24423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
24424         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24425         *ret_conv = CResult_NoneAPIErrorZ_ok();
24426         return tag_ptr(ret_conv, true);
24427 }
24428
24429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24430         void* e_ptr = untag_ptr(e);
24431         CHECK_ACCESS(e_ptr);
24432         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24433         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24434         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24435         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
24436         return tag_ptr(ret_conv, true);
24437 }
24438
24439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24440         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
24441         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
24442         return ret_conv;
24443 }
24444
24445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24446         if (!ptr_is_owned(_res)) return;
24447         void* _res_ptr = untag_ptr(_res);
24448         CHECK_ACCESS(_res_ptr);
24449         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
24450         FREE(untag_ptr(_res));
24451         CResult_NoneAPIErrorZ_free(_res_conv);
24452 }
24453
24454 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
24455         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24456         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
24457         return tag_ptr(ret_conv, true);
24458 }
24459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24460         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
24461         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
24462         return ret_conv;
24463 }
24464
24465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24466         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
24467         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24468         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
24469         return tag_ptr(ret_conv, true);
24470 }
24471
24472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24473         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
24474         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24475         if (_res_constr.datalen > 0)
24476                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24477         else
24478                 _res_constr.data = NULL;
24479         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24480         for (size_t w = 0; w < _res_constr.datalen; w++) {
24481                 int64_t _res_conv_22 = _res_vals[w];
24482                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24483                 CHECK_ACCESS(_res_conv_22_ptr);
24484                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
24485                 FREE(untag_ptr(_res_conv_22));
24486                 _res_constr.data[w] = _res_conv_22_conv;
24487         }
24488         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24489         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
24490 }
24491
24492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24493         LDKCVec_APIErrorZ _res_constr;
24494         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24495         if (_res_constr.datalen > 0)
24496                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
24497         else
24498                 _res_constr.data = NULL;
24499         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24500         for (size_t k = 0; k < _res_constr.datalen; k++) {
24501                 int64_t _res_conv_10 = _res_vals[k];
24502                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
24503                 CHECK_ACCESS(_res_conv_10_ptr);
24504                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
24505                 FREE(untag_ptr(_res_conv_10));
24506                 _res_constr.data[k] = _res_conv_10_conv;
24507         }
24508         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24509         CVec_APIErrorZ_free(_res_constr);
24510 }
24511
24512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24513         LDKThirtyTwoBytes o_ref;
24514         CHECK((*env)->GetArrayLength(env, o) == 32);
24515         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24516         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24517         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
24518         int64_t ret_ref = tag_ptr(ret_copy, true);
24519         return ret_ref;
24520 }
24521
24522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
24523         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24524         *ret_copy = COption_ThirtyTwoBytesZ_none();
24525         int64_t ret_ref = tag_ptr(ret_copy, true);
24526         return ret_ref;
24527 }
24528
24529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24530         if (!ptr_is_owned(_res)) return;
24531         void* _res_ptr = untag_ptr(_res);
24532         CHECK_ACCESS(_res_ptr);
24533         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
24534         FREE(untag_ptr(_res));
24535         COption_ThirtyTwoBytesZ_free(_res_conv);
24536 }
24537
24538 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
24539         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24540         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
24541         int64_t ret_ref = tag_ptr(ret_copy, true);
24542         return ret_ref;
24543 }
24544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24545         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
24546         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
24547         return ret_conv;
24548 }
24549
24550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24551         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
24552         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24553         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
24554         int64_t ret_ref = tag_ptr(ret_copy, true);
24555         return ret_ref;
24556 }
24557
24558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24559         LDKCVec_u8Z o_ref;
24560         o_ref.datalen = (*env)->GetArrayLength(env, o);
24561         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24562         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
24563         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24564         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
24565         int64_t ret_ref = tag_ptr(ret_copy, true);
24566         return ret_ref;
24567 }
24568
24569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
24570         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24571         *ret_copy = COption_CVec_u8ZZ_none();
24572         int64_t ret_ref = tag_ptr(ret_copy, true);
24573         return ret_ref;
24574 }
24575
24576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24577         if (!ptr_is_owned(_res)) return;
24578         void* _res_ptr = untag_ptr(_res);
24579         CHECK_ACCESS(_res_ptr);
24580         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
24581         FREE(untag_ptr(_res));
24582         COption_CVec_u8ZZ_free(_res_conv);
24583 }
24584
24585 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
24586         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24587         *ret_copy = COption_CVec_u8ZZ_clone(arg);
24588         int64_t ret_ref = tag_ptr(ret_copy, true);
24589         return ret_ref;
24590 }
24591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24592         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
24593         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
24594         return ret_conv;
24595 }
24596
24597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24598         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
24599         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24600         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
24601         int64_t ret_ref = tag_ptr(ret_copy, true);
24602         return ret_ref;
24603 }
24604
24605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24606         LDKRecipientOnionFields o_conv;
24607         o_conv.inner = untag_ptr(o);
24608         o_conv.is_owned = ptr_is_owned(o);
24609         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24610         o_conv = RecipientOnionFields_clone(&o_conv);
24611         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24612         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
24613         return tag_ptr(ret_conv, true);
24614 }
24615
24616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24617         void* e_ptr = untag_ptr(e);
24618         CHECK_ACCESS(e_ptr);
24619         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24620         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24621         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24622         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
24623         return tag_ptr(ret_conv, true);
24624 }
24625
24626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24627         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
24628         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
24629         return ret_conv;
24630 }
24631
24632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24633         if (!ptr_is_owned(_res)) return;
24634         void* _res_ptr = untag_ptr(_res);
24635         CHECK_ACCESS(_res_ptr);
24636         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
24637         FREE(untag_ptr(_res));
24638         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
24639 }
24640
24641 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
24642         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24643         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
24644         return tag_ptr(ret_conv, true);
24645 }
24646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24647         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
24648         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
24649         return ret_conv;
24650 }
24651
24652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24653         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
24654         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24655         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
24656         return tag_ptr(ret_conv, true);
24657 }
24658
24659 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
24660         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24661         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
24662         return tag_ptr(ret_conv, true);
24663 }
24664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24665         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
24666         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
24667         return ret_conv;
24668 }
24669
24670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24671         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
24672         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24673         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
24674         return tag_ptr(ret_conv, true);
24675 }
24676
24677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
24678         LDKCVec_u8Z b_ref;
24679         b_ref.datalen = (*env)->GetArrayLength(env, b);
24680         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
24681         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
24682         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24683         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
24684         return tag_ptr(ret_conv, true);
24685 }
24686
24687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24688         if (!ptr_is_owned(_res)) return;
24689         void* _res_ptr = untag_ptr(_res);
24690         CHECK_ACCESS(_res_ptr);
24691         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
24692         FREE(untag_ptr(_res));
24693         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
24694 }
24695
24696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24697         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
24698         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24699         if (_res_constr.datalen > 0)
24700                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
24701         else
24702                 _res_constr.data = NULL;
24703         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24704         for (size_t x = 0; x < _res_constr.datalen; x++) {
24705                 int64_t _res_conv_23 = _res_vals[x];
24706                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
24707                 CHECK_ACCESS(_res_conv_23_ptr);
24708                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
24709                 FREE(untag_ptr(_res_conv_23));
24710                 _res_constr.data[x] = _res_conv_23_conv;
24711         }
24712         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24713         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
24714 }
24715
24716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24717         LDKRecipientOnionFields o_conv;
24718         o_conv.inner = untag_ptr(o);
24719         o_conv.is_owned = ptr_is_owned(o);
24720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24721         o_conv = RecipientOnionFields_clone(&o_conv);
24722         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24723         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
24724         return tag_ptr(ret_conv, true);
24725 }
24726
24727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
24728         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24729         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
24730         return tag_ptr(ret_conv, true);
24731 }
24732
24733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24734         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
24735         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
24736         return ret_conv;
24737 }
24738
24739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24740         if (!ptr_is_owned(_res)) return;
24741         void* _res_ptr = untag_ptr(_res);
24742         CHECK_ACCESS(_res_ptr);
24743         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
24744         FREE(untag_ptr(_res));
24745         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
24746 }
24747
24748 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
24749         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24750         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
24751         return tag_ptr(ret_conv, true);
24752 }
24753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24754         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
24755         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
24756         return ret_conv;
24757 }
24758
24759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24760         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
24761         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24762         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
24763         return tag_ptr(ret_conv, true);
24764 }
24765
24766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24767         LDKUnsignedBolt12Invoice o_conv;
24768         o_conv.inner = untag_ptr(o);
24769         o_conv.is_owned = ptr_is_owned(o);
24770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24771         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
24772         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24773         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
24774         return tag_ptr(ret_conv, true);
24775 }
24776
24777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24778         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24779         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24780         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
24781         return tag_ptr(ret_conv, true);
24782 }
24783
24784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24785         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
24786         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
24787         return ret_conv;
24788 }
24789
24790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24791         if (!ptr_is_owned(_res)) return;
24792         void* _res_ptr = untag_ptr(_res);
24793         CHECK_ACCESS(_res_ptr);
24794         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
24795         FREE(untag_ptr(_res));
24796         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
24797 }
24798
24799 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
24800         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24801         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
24802         return tag_ptr(ret_conv, true);
24803 }
24804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24805         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
24806         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
24807         return ret_conv;
24808 }
24809
24810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24811         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
24812         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24813         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
24814         return tag_ptr(ret_conv, true);
24815 }
24816
24817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24818         LDKBolt12Invoice o_conv;
24819         o_conv.inner = untag_ptr(o);
24820         o_conv.is_owned = ptr_is_owned(o);
24821         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24822         o_conv = Bolt12Invoice_clone(&o_conv);
24823         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24824         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
24825         return tag_ptr(ret_conv, true);
24826 }
24827
24828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24829         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24830         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24831         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
24832         return tag_ptr(ret_conv, true);
24833 }
24834
24835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24836         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
24837         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
24838         return ret_conv;
24839 }
24840
24841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24842         if (!ptr_is_owned(_res)) return;
24843         void* _res_ptr = untag_ptr(_res);
24844         CHECK_ACCESS(_res_ptr);
24845         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
24846         FREE(untag_ptr(_res));
24847         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
24848 }
24849
24850 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
24851         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24852         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
24853         return tag_ptr(ret_conv, true);
24854 }
24855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24856         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
24857         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
24858         return ret_conv;
24859 }
24860
24861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24862         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
24863         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24864         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
24865         return tag_ptr(ret_conv, true);
24866 }
24867
24868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24869         LDKSchnorrSignature o_ref;
24870         CHECK((*env)->GetArrayLength(env, o) == 64);
24871         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
24872         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24873         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
24874         return tag_ptr(ret_conv, true);
24875 }
24876
24877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
24878         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24879         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
24880         return tag_ptr(ret_conv, true);
24881 }
24882
24883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24884         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
24885         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
24886         return ret_conv;
24887 }
24888
24889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24890         if (!ptr_is_owned(_res)) return;
24891         void* _res_ptr = untag_ptr(_res);
24892         CHECK_ACCESS(_res_ptr);
24893         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
24894         FREE(untag_ptr(_res));
24895         CResult_SchnorrSignatureNoneZ_free(_res_conv);
24896 }
24897
24898 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
24899         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24900         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
24901         return tag_ptr(ret_conv, true);
24902 }
24903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24904         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
24905         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
24906         return ret_conv;
24907 }
24908
24909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24910         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
24911         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24912         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
24913         return tag_ptr(ret_conv, true);
24914 }
24915
24916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24917         LDKCVec_ThirtyTwoBytesZ _res_constr;
24918         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24919         if (_res_constr.datalen > 0)
24920                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24921         else
24922                 _res_constr.data = NULL;
24923         for (size_t i = 0; i < _res_constr.datalen; i++) {
24924                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24925                 LDKThirtyTwoBytes _res_conv_8_ref;
24926                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
24927                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
24928                 _res_constr.data[i] = _res_conv_8_ref;
24929         }
24930         CVec_ThirtyTwoBytesZ_free(_res_constr);
24931 }
24932
24933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
24934         LDKCVec_ThirtyTwoBytesZ o_constr;
24935         o_constr.datalen = (*env)->GetArrayLength(env, o);
24936         if (o_constr.datalen > 0)
24937                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24938         else
24939                 o_constr.data = NULL;
24940         for (size_t i = 0; i < o_constr.datalen; i++) {
24941                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
24942                 LDKThirtyTwoBytes o_conv_8_ref;
24943                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
24944                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
24945                 o_constr.data[i] = o_conv_8_ref;
24946         }
24947         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24948         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
24949         int64_t ret_ref = tag_ptr(ret_copy, true);
24950         return ret_ref;
24951 }
24952
24953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
24954         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24955         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
24956         int64_t ret_ref = tag_ptr(ret_copy, true);
24957         return ret_ref;
24958 }
24959
24960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24961         if (!ptr_is_owned(_res)) return;
24962         void* _res_ptr = untag_ptr(_res);
24963         CHECK_ACCESS(_res_ptr);
24964         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
24965         FREE(untag_ptr(_res));
24966         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
24967 }
24968
24969 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
24970         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24971         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
24972         int64_t ret_ref = tag_ptr(ret_copy, true);
24973         return ret_ref;
24974 }
24975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24976         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
24977         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
24978         return ret_conv;
24979 }
24980
24981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24982         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
24983         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24984         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
24985         int64_t ret_ref = tag_ptr(ret_copy, true);
24986         return ret_ref;
24987 }
24988
24989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24990         void* o_ptr = untag_ptr(o);
24991         CHECK_ACCESS(o_ptr);
24992         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
24993         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
24994         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24995         *ret_copy = COption_AmountZ_some(o_conv);
24996         int64_t ret_ref = tag_ptr(ret_copy, true);
24997         return ret_ref;
24998 }
24999
25000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1none(JNIEnv *env, jclass clz) {
25001         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
25002         *ret_copy = COption_AmountZ_none();
25003         int64_t ret_ref = tag_ptr(ret_copy, true);
25004         return ret_ref;
25005 }
25006
25007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25008         if (!ptr_is_owned(_res)) return;
25009         void* _res_ptr = untag_ptr(_res);
25010         CHECK_ACCESS(_res_ptr);
25011         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
25012         FREE(untag_ptr(_res));
25013         COption_AmountZ_free(_res_conv);
25014 }
25015
25016 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
25017         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
25018         *ret_copy = COption_AmountZ_clone(arg);
25019         int64_t ret_ref = tag_ptr(ret_copy, true);
25020         return ret_ref;
25021 }
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25023         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
25024         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
25025         return ret_conv;
25026 }
25027
25028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25029         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
25030         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
25031         *ret_copy = COption_AmountZ_clone(orig_conv);
25032         int64_t ret_ref = tag_ptr(ret_copy, true);
25033         return ret_ref;
25034 }
25035
25036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25037         void* o_ptr = untag_ptr(o);
25038         CHECK_ACCESS(o_ptr);
25039         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
25040         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
25041         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
25042         *ret_copy = COption_QuantityZ_some(o_conv);
25043         int64_t ret_ref = tag_ptr(ret_copy, true);
25044         return ret_ref;
25045 }
25046
25047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1none(JNIEnv *env, jclass clz) {
25048         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
25049         *ret_copy = COption_QuantityZ_none();
25050         int64_t ret_ref = tag_ptr(ret_copy, true);
25051         return ret_ref;
25052 }
25053
25054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25055         if (!ptr_is_owned(_res)) return;
25056         void* _res_ptr = untag_ptr(_res);
25057         CHECK_ACCESS(_res_ptr);
25058         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
25059         FREE(untag_ptr(_res));
25060         COption_QuantityZ_free(_res_conv);
25061 }
25062
25063 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
25064         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
25065         *ret_copy = COption_QuantityZ_clone(arg);
25066         int64_t ret_ref = tag_ptr(ret_copy, true);
25067         return ret_ref;
25068 }
25069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25070         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
25071         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
25072         return ret_conv;
25073 }
25074
25075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25076         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
25077         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
25078         *ret_copy = COption_QuantityZ_clone(orig_conv);
25079         int64_t ret_ref = tag_ptr(ret_copy, true);
25080         return ret_ref;
25081 }
25082
25083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25084         LDKThirtyTwoBytes o_ref;
25085         CHECK((*env)->GetArrayLength(env, o) == 32);
25086         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25087         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
25088         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
25089         return tag_ptr(ret_conv, true);
25090 }
25091
25092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
25093         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
25094         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
25095         return tag_ptr(ret_conv, true);
25096 }
25097
25098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25099         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
25100         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
25101         return ret_conv;
25102 }
25103
25104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25105         if (!ptr_is_owned(_res)) return;
25106         void* _res_ptr = untag_ptr(_res);
25107         CHECK_ACCESS(_res_ptr);
25108         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
25109         FREE(untag_ptr(_res));
25110         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
25111 }
25112
25113 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
25114         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
25115         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
25116         return tag_ptr(ret_conv, true);
25117 }
25118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25119         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
25120         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
25121         return ret_conv;
25122 }
25123
25124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25125         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
25126         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
25127         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
25128         return tag_ptr(ret_conv, true);
25129 }
25130
25131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25132         LDKBlindedPayInfo o_conv;
25133         o_conv.inner = untag_ptr(o);
25134         o_conv.is_owned = ptr_is_owned(o);
25135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25136         o_conv = BlindedPayInfo_clone(&o_conv);
25137         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
25138         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
25139         return tag_ptr(ret_conv, true);
25140 }
25141
25142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25143         void* e_ptr = untag_ptr(e);
25144         CHECK_ACCESS(e_ptr);
25145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25147         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
25148         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
25149         return tag_ptr(ret_conv, true);
25150 }
25151
25152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25153         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
25154         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
25155         return ret_conv;
25156 }
25157
25158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25159         if (!ptr_is_owned(_res)) return;
25160         void* _res_ptr = untag_ptr(_res);
25161         CHECK_ACCESS(_res_ptr);
25162         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
25163         FREE(untag_ptr(_res));
25164         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
25165 }
25166
25167 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
25168         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
25169         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
25170         return tag_ptr(ret_conv, true);
25171 }
25172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25173         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
25174         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
25175         return ret_conv;
25176 }
25177
25178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25179         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
25180         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
25181         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
25182         return tag_ptr(ret_conv, true);
25183 }
25184
25185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25186         LDKDelayedPaymentOutputDescriptor o_conv;
25187         o_conv.inner = untag_ptr(o);
25188         o_conv.is_owned = ptr_is_owned(o);
25189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25190         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
25191         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25192         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
25193         return tag_ptr(ret_conv, true);
25194 }
25195
25196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25197         void* e_ptr = untag_ptr(e);
25198         CHECK_ACCESS(e_ptr);
25199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25201         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25202         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
25203         return tag_ptr(ret_conv, true);
25204 }
25205
25206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25207         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
25208         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
25209         return ret_conv;
25210 }
25211
25212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25213         if (!ptr_is_owned(_res)) return;
25214         void* _res_ptr = untag_ptr(_res);
25215         CHECK_ACCESS(_res_ptr);
25216         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
25217         FREE(untag_ptr(_res));
25218         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
25219 }
25220
25221 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25222         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25223         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
25224         return tag_ptr(ret_conv, true);
25225 }
25226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25227         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25228         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25229         return ret_conv;
25230 }
25231
25232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25233         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25234         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25235         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
25236         return tag_ptr(ret_conv, true);
25237 }
25238
25239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25240         LDKStaticPaymentOutputDescriptor o_conv;
25241         o_conv.inner = untag_ptr(o);
25242         o_conv.is_owned = ptr_is_owned(o);
25243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25244         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
25245         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25246         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
25247         return tag_ptr(ret_conv, true);
25248 }
25249
25250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25251         void* e_ptr = untag_ptr(e);
25252         CHECK_ACCESS(e_ptr);
25253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25255         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25256         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
25257         return tag_ptr(ret_conv, true);
25258 }
25259
25260 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25261         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
25262         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
25263         return ret_conv;
25264 }
25265
25266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25267         if (!ptr_is_owned(_res)) return;
25268         void* _res_ptr = untag_ptr(_res);
25269         CHECK_ACCESS(_res_ptr);
25270         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
25271         FREE(untag_ptr(_res));
25272         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
25273 }
25274
25275 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25276         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25277         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
25278         return tag_ptr(ret_conv, true);
25279 }
25280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25281         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25282         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25283         return ret_conv;
25284 }
25285
25286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25287         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25288         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25289         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
25290         return tag_ptr(ret_conv, true);
25291 }
25292
25293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25294         void* o_ptr = untag_ptr(o);
25295         CHECK_ACCESS(o_ptr);
25296         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
25297         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
25298         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25299         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
25300         return tag_ptr(ret_conv, true);
25301 }
25302
25303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25304         void* e_ptr = untag_ptr(e);
25305         CHECK_ACCESS(e_ptr);
25306         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25307         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25308         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25309         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
25310         return tag_ptr(ret_conv, true);
25311 }
25312
25313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25314         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
25315         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
25316         return ret_conv;
25317 }
25318
25319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25320         if (!ptr_is_owned(_res)) return;
25321         void* _res_ptr = untag_ptr(_res);
25322         CHECK_ACCESS(_res_ptr);
25323         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
25324         FREE(untag_ptr(_res));
25325         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
25326 }
25327
25328 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25329         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25330         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
25331         return tag_ptr(ret_conv, true);
25332 }
25333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25334         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25335         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25336         return ret_conv;
25337 }
25338
25339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25340         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25341         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25342         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
25343         return tag_ptr(ret_conv, true);
25344 }
25345
25346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25347         LDKCVec_SpendableOutputDescriptorZ _res_constr;
25348         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25349         if (_res_constr.datalen > 0)
25350                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25351         else
25352                 _res_constr.data = NULL;
25353         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25354         for (size_t b = 0; b < _res_constr.datalen; b++) {
25355                 int64_t _res_conv_27 = _res_vals[b];
25356                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
25357                 CHECK_ACCESS(_res_conv_27_ptr);
25358                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
25359                 FREE(untag_ptr(_res_conv_27));
25360                 _res_constr.data[b] = _res_conv_27_conv;
25361         }
25362         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25363         CVec_SpendableOutputDescriptorZ_free(_res_constr);
25364 }
25365
25366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25367         LDKCVec_TxOutZ _res_constr;
25368         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25369         if (_res_constr.datalen > 0)
25370                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25371         else
25372                 _res_constr.data = NULL;
25373         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25374         for (size_t h = 0; h < _res_constr.datalen; h++) {
25375                 int64_t _res_conv_7 = _res_vals[h];
25376                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
25377                 CHECK_ACCESS(_res_conv_7_ptr);
25378                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
25379                 FREE(untag_ptr(_res_conv_7));
25380                 _res_constr.data[h] = _res_conv_7_conv;
25381         }
25382         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25383         CVec_TxOutZ_free(_res_constr);
25384 }
25385
25386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
25387         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25388         *ret_copy = COption_u32Z_some(o);
25389         int64_t ret_ref = tag_ptr(ret_copy, true);
25390         return ret_ref;
25391 }
25392
25393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
25394         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25395         *ret_copy = COption_u32Z_none();
25396         int64_t ret_ref = tag_ptr(ret_copy, true);
25397         return ret_ref;
25398 }
25399
25400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25401         if (!ptr_is_owned(_res)) return;
25402         void* _res_ptr = untag_ptr(_res);
25403         CHECK_ACCESS(_res_ptr);
25404         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
25405         FREE(untag_ptr(_res));
25406         COption_u32Z_free(_res_conv);
25407 }
25408
25409 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
25410         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25411         *ret_copy = COption_u32Z_clone(arg);
25412         int64_t ret_ref = tag_ptr(ret_copy, true);
25413         return ret_ref;
25414 }
25415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25416         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
25417         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
25418         return ret_conv;
25419 }
25420
25421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25422         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
25423         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25424         *ret_copy = COption_u32Z_clone(orig_conv);
25425         int64_t ret_ref = tag_ptr(ret_copy, true);
25426         return ret_ref;
25427 }
25428
25429 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
25430         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25431         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
25432         return tag_ptr(ret_conv, true);
25433 }
25434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25435         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
25436         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
25437         return ret_conv;
25438 }
25439
25440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25441         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
25442         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25443         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
25444         return tag_ptr(ret_conv, true);
25445 }
25446
25447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25448         LDKCVec_u8Z a_ref;
25449         a_ref.datalen = (*env)->GetArrayLength(env, a);
25450         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
25451         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
25452         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25453         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
25454         return tag_ptr(ret_conv, true);
25455 }
25456
25457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25458         if (!ptr_is_owned(_res)) return;
25459         void* _res_ptr = untag_ptr(_res);
25460         CHECK_ACCESS(_res_ptr);
25461         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
25462         FREE(untag_ptr(_res));
25463         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
25464 }
25465
25466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25467         void* o_ptr = untag_ptr(o);
25468         CHECK_ACCESS(o_ptr);
25469         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
25470         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
25471         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25472         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
25473         return tag_ptr(ret_conv, true);
25474 }
25475
25476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1err(JNIEnv *env, jclass clz) {
25477         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25478         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
25479         return tag_ptr(ret_conv, true);
25480 }
25481
25482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25483         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
25484         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
25485         return ret_conv;
25486 }
25487
25488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25489         if (!ptr_is_owned(_res)) return;
25490         void* _res_ptr = untag_ptr(_res);
25491         CHECK_ACCESS(_res_ptr);
25492         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
25493         FREE(untag_ptr(_res));
25494         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
25495 }
25496
25497 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
25498         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25499         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
25500         return tag_ptr(ret_conv, true);
25501 }
25502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25503         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
25504         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
25505         return ret_conv;
25506 }
25507
25508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25509         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
25510         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25511         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
25512         return tag_ptr(ret_conv, true);
25513 }
25514
25515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25516         LDKChannelDerivationParameters o_conv;
25517         o_conv.inner = untag_ptr(o);
25518         o_conv.is_owned = ptr_is_owned(o);
25519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25520         o_conv = ChannelDerivationParameters_clone(&o_conv);
25521         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25522         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
25523         return tag_ptr(ret_conv, true);
25524 }
25525
25526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25527         void* e_ptr = untag_ptr(e);
25528         CHECK_ACCESS(e_ptr);
25529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25531         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25532         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
25533         return tag_ptr(ret_conv, true);
25534 }
25535
25536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25537         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
25538         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
25539         return ret_conv;
25540 }
25541
25542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25543         if (!ptr_is_owned(_res)) return;
25544         void* _res_ptr = untag_ptr(_res);
25545         CHECK_ACCESS(_res_ptr);
25546         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
25547         FREE(untag_ptr(_res));
25548         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
25549 }
25550
25551 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
25552         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25553         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
25554         return tag_ptr(ret_conv, true);
25555 }
25556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25557         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
25558         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
25559         return ret_conv;
25560 }
25561
25562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25563         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
25564         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25565         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
25566         return tag_ptr(ret_conv, true);
25567 }
25568
25569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25570         LDKHTLCDescriptor o_conv;
25571         o_conv.inner = untag_ptr(o);
25572         o_conv.is_owned = ptr_is_owned(o);
25573         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25574         o_conv = HTLCDescriptor_clone(&o_conv);
25575         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25576         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
25577         return tag_ptr(ret_conv, true);
25578 }
25579
25580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25581         void* e_ptr = untag_ptr(e);
25582         CHECK_ACCESS(e_ptr);
25583         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25584         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25585         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25586         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
25587         return tag_ptr(ret_conv, true);
25588 }
25589
25590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25591         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
25592         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
25593         return ret_conv;
25594 }
25595
25596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25597         if (!ptr_is_owned(_res)) return;
25598         void* _res_ptr = untag_ptr(_res);
25599         CHECK_ACCESS(_res_ptr);
25600         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
25601         FREE(untag_ptr(_res));
25602         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
25603 }
25604
25605 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25606         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25607         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
25608         return tag_ptr(ret_conv, true);
25609 }
25610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25611         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
25612         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25613         return ret_conv;
25614 }
25615
25616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25617         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
25618         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25619         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
25620         return tag_ptr(ret_conv, true);
25621 }
25622
25623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
25624         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25625         *ret_conv = CResult_NoneNoneZ_ok();
25626         return tag_ptr(ret_conv, true);
25627 }
25628
25629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
25630         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25631         *ret_conv = CResult_NoneNoneZ_err();
25632         return tag_ptr(ret_conv, true);
25633 }
25634
25635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25636         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
25637         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
25638         return ret_conv;
25639 }
25640
25641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25642         if (!ptr_is_owned(_res)) return;
25643         void* _res_ptr = untag_ptr(_res);
25644         CHECK_ACCESS(_res_ptr);
25645         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
25646         FREE(untag_ptr(_res));
25647         CResult_NoneNoneZ_free(_res_conv);
25648 }
25649
25650 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
25651         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25652         *ret_conv = CResult_NoneNoneZ_clone(arg);
25653         return tag_ptr(ret_conv, true);
25654 }
25655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25656         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
25657         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
25658         return ret_conv;
25659 }
25660
25661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25662         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
25663         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25664         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
25665         return tag_ptr(ret_conv, true);
25666 }
25667
25668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25669         LDKPublicKey o_ref;
25670         CHECK((*env)->GetArrayLength(env, o) == 33);
25671         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
25672         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25673         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
25674         return tag_ptr(ret_conv, true);
25675 }
25676
25677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
25678         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25679         *ret_conv = CResult_PublicKeyNoneZ_err();
25680         return tag_ptr(ret_conv, true);
25681 }
25682
25683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25684         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
25685         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
25686         return ret_conv;
25687 }
25688
25689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25690         if (!ptr_is_owned(_res)) return;
25691         void* _res_ptr = untag_ptr(_res);
25692         CHECK_ACCESS(_res_ptr);
25693         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
25694         FREE(untag_ptr(_res));
25695         CResult_PublicKeyNoneZ_free(_res_conv);
25696 }
25697
25698 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
25699         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25700         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
25701         return tag_ptr(ret_conv, true);
25702 }
25703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25704         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
25705         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
25706         return ret_conv;
25707 }
25708
25709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25710         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
25711         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25712         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
25713         return tag_ptr(ret_conv, true);
25714 }
25715
25716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25717         void* o_ptr = untag_ptr(o);
25718         CHECK_ACCESS(o_ptr);
25719         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
25720         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
25721         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25722         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
25723         int64_t ret_ref = tag_ptr(ret_copy, true);
25724         return ret_ref;
25725 }
25726
25727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
25728         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25729         *ret_copy = COption_BigEndianScalarZ_none();
25730         int64_t ret_ref = tag_ptr(ret_copy, true);
25731         return ret_ref;
25732 }
25733
25734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25735         if (!ptr_is_owned(_res)) return;
25736         void* _res_ptr = untag_ptr(_res);
25737         CHECK_ACCESS(_res_ptr);
25738         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
25739         FREE(untag_ptr(_res));
25740         COption_BigEndianScalarZ_free(_res_conv);
25741 }
25742
25743 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
25744         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25745         *ret_copy = COption_BigEndianScalarZ_clone(arg);
25746         int64_t ret_ref = tag_ptr(ret_copy, true);
25747         return ret_ref;
25748 }
25749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25750         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
25751         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
25752         return ret_conv;
25753 }
25754
25755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25756         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
25757         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25758         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
25759         int64_t ret_ref = tag_ptr(ret_copy, true);
25760         return ret_ref;
25761 }
25762
25763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25764         LDKCVec_U5Z _res_constr;
25765         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25766         if (_res_constr.datalen > 0)
25767                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
25768         else
25769                 _res_constr.data = NULL;
25770         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
25771         for (size_t h = 0; h < _res_constr.datalen; h++) {
25772                 int8_t _res_conv_7 = _res_vals[h];
25773                 
25774                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
25775         }
25776         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
25777         CVec_U5Z_free(_res_constr);
25778 }
25779
25780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25781         LDKRecoverableSignature o_ref;
25782         CHECK((*env)->GetArrayLength(env, o) == 68);
25783         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
25784         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25785         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
25786         return tag_ptr(ret_conv, true);
25787 }
25788
25789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
25790         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25791         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
25792         return tag_ptr(ret_conv, true);
25793 }
25794
25795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25796         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
25797         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
25798         return ret_conv;
25799 }
25800
25801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25802         if (!ptr_is_owned(_res)) return;
25803         void* _res_ptr = untag_ptr(_res);
25804         CHECK_ACCESS(_res_ptr);
25805         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
25806         FREE(untag_ptr(_res));
25807         CResult_RecoverableSignatureNoneZ_free(_res_conv);
25808 }
25809
25810 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
25811         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25812         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
25813         return tag_ptr(ret_conv, true);
25814 }
25815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25816         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
25817         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
25818         return ret_conv;
25819 }
25820
25821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25822         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
25823         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25824         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
25825         return tag_ptr(ret_conv, true);
25826 }
25827
25828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25829         LDKECDSASignature o_ref;
25830         CHECK((*env)->GetArrayLength(env, o) == 64);
25831         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
25832         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25833         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
25834         return tag_ptr(ret_conv, true);
25835 }
25836
25837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
25838         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25839         *ret_conv = CResult_ECDSASignatureNoneZ_err();
25840         return tag_ptr(ret_conv, true);
25841 }
25842
25843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25844         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
25845         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
25846         return ret_conv;
25847 }
25848
25849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25850         if (!ptr_is_owned(_res)) return;
25851         void* _res_ptr = untag_ptr(_res);
25852         CHECK_ACCESS(_res_ptr);
25853         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
25854         FREE(untag_ptr(_res));
25855         CResult_ECDSASignatureNoneZ_free(_res_conv);
25856 }
25857
25858 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
25859         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25860         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
25861         return tag_ptr(ret_conv, true);
25862 }
25863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25864         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
25865         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
25866         return ret_conv;
25867 }
25868
25869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25870         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
25871         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25872         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
25873         return tag_ptr(ret_conv, true);
25874 }
25875
25876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25877         LDKTransaction o_ref;
25878         o_ref.datalen = (*env)->GetArrayLength(env, o);
25879         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
25880         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25881         o_ref.data_is_owned = true;
25882         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25883         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
25884         return tag_ptr(ret_conv, true);
25885 }
25886
25887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
25888         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25889         *ret_conv = CResult_TransactionNoneZ_err();
25890         return tag_ptr(ret_conv, true);
25891 }
25892
25893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25894         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
25895         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
25896         return ret_conv;
25897 }
25898
25899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25900         if (!ptr_is_owned(_res)) return;
25901         void* _res_ptr = untag_ptr(_res);
25902         CHECK_ACCESS(_res_ptr);
25903         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
25904         FREE(untag_ptr(_res));
25905         CResult_TransactionNoneZ_free(_res_conv);
25906 }
25907
25908 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
25909         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25910         *ret_conv = CResult_TransactionNoneZ_clone(arg);
25911         return tag_ptr(ret_conv, true);
25912 }
25913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25914         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
25915         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
25916         return ret_conv;
25917 }
25918
25919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25920         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
25921         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25922         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
25923         return tag_ptr(ret_conv, true);
25924 }
25925
25926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25927         void* o_ptr = untag_ptr(o);
25928         CHECK_ACCESS(o_ptr);
25929         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
25930         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
25931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25932                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
25933         }
25934         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25935         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
25936         return tag_ptr(ret_conv, true);
25937 }
25938
25939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25940         void* e_ptr = untag_ptr(e);
25941         CHECK_ACCESS(e_ptr);
25942         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25943         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25944         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25945         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
25946         return tag_ptr(ret_conv, true);
25947 }
25948
25949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25950         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
25951         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
25952         return ret_conv;
25953 }
25954
25955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25956         if (!ptr_is_owned(_res)) return;
25957         void* _res_ptr = untag_ptr(_res);
25958         CHECK_ACCESS(_res_ptr);
25959         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
25960         FREE(untag_ptr(_res));
25961         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
25962 }
25963
25964 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
25965         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25966         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
25967         return tag_ptr(ret_conv, true);
25968 }
25969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25970         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
25971         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
25972         return ret_conv;
25973 }
25974
25975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25976         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
25977         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25978         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
25979         return tag_ptr(ret_conv, true);
25980 }
25981
25982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25983         LDKCVec_u8Z o_ref;
25984         o_ref.datalen = (*env)->GetArrayLength(env, o);
25985         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
25986         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25987         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25988         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
25989         return tag_ptr(ret_conv, true);
25990 }
25991
25992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
25993         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25994         *ret_conv = CResult_CVec_u8ZNoneZ_err();
25995         return tag_ptr(ret_conv, true);
25996 }
25997
25998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25999         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
26000         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
26001         return ret_conv;
26002 }
26003
26004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26005         if (!ptr_is_owned(_res)) return;
26006         void* _res_ptr = untag_ptr(_res);
26007         CHECK_ACCESS(_res_ptr);
26008         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
26009         FREE(untag_ptr(_res));
26010         CResult_CVec_u8ZNoneZ_free(_res_conv);
26011 }
26012
26013 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
26014         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
26015         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
26016         return tag_ptr(ret_conv, true);
26017 }
26018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26019         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
26020         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
26021         return ret_conv;
26022 }
26023
26024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26025         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
26026         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
26027         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
26028         return tag_ptr(ret_conv, true);
26029 }
26030
26031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26032         LDKShutdownScript o_conv;
26033         o_conv.inner = untag_ptr(o);
26034         o_conv.is_owned = ptr_is_owned(o);
26035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26036         o_conv = ShutdownScript_clone(&o_conv);
26037         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
26038         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
26039         return tag_ptr(ret_conv, true);
26040 }
26041
26042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
26043         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
26044         *ret_conv = CResult_ShutdownScriptNoneZ_err();
26045         return tag_ptr(ret_conv, true);
26046 }
26047
26048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26049         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
26050         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
26051         return ret_conv;
26052 }
26053
26054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26055         if (!ptr_is_owned(_res)) return;
26056         void* _res_ptr = untag_ptr(_res);
26057         CHECK_ACCESS(_res_ptr);
26058         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
26059         FREE(untag_ptr(_res));
26060         CResult_ShutdownScriptNoneZ_free(_res_conv);
26061 }
26062
26063 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
26064         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
26065         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
26066         return tag_ptr(ret_conv, true);
26067 }
26068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26069         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
26070         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
26071         return ret_conv;
26072 }
26073
26074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26075         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
26076         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
26077         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
26078         return tag_ptr(ret_conv, true);
26079 }
26080
26081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
26082         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26083         *ret_copy = COption_u16Z_some(o);
26084         int64_t ret_ref = tag_ptr(ret_copy, true);
26085         return ret_ref;
26086 }
26087
26088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
26089         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26090         *ret_copy = COption_u16Z_none();
26091         int64_t ret_ref = tag_ptr(ret_copy, true);
26092         return ret_ref;
26093 }
26094
26095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
26096         if (!ptr_is_owned(_res)) return;
26097         void* _res_ptr = untag_ptr(_res);
26098         CHECK_ACCESS(_res_ptr);
26099         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
26100         FREE(untag_ptr(_res));
26101         COption_u16Z_free(_res_conv);
26102 }
26103
26104 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
26105         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26106         *ret_copy = COption_u16Z_clone(arg);
26107         int64_t ret_ref = tag_ptr(ret_copy, true);
26108         return ret_ref;
26109 }
26110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26111         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
26112         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
26113         return ret_conv;
26114 }
26115
26116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26117         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
26118         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26119         *ret_copy = COption_u16Z_clone(orig_conv);
26120         int64_t ret_ref = tag_ptr(ret_copy, true);
26121         return ret_ref;
26122 }
26123
26124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
26125         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
26126         *ret_copy = COption_boolZ_some(o);
26127         int64_t ret_ref = tag_ptr(ret_copy, true);
26128         return ret_ref;
26129 }
26130
26131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
26132         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
26133         *ret_copy = COption_boolZ_none();
26134         int64_t ret_ref = tag_ptr(ret_copy, true);
26135         return ret_ref;
26136 }
26137
26138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26139         if (!ptr_is_owned(_res)) return;
26140         void* _res_ptr = untag_ptr(_res);
26141         CHECK_ACCESS(_res_ptr);
26142         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
26143         FREE(untag_ptr(_res));
26144         COption_boolZ_free(_res_conv);
26145 }
26146
26147 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
26148         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
26149         *ret_copy = COption_boolZ_clone(arg);
26150         int64_t ret_ref = tag_ptr(ret_copy, true);
26151         return ret_ref;
26152 }
26153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26154         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
26155         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
26156         return ret_conv;
26157 }
26158
26159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26160         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
26161         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
26162         *ret_copy = COption_boolZ_clone(orig_conv);
26163         int64_t ret_ref = tag_ptr(ret_copy, true);
26164         return ret_ref;
26165 }
26166
26167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
26168         LDKWitness o_ref;
26169         o_ref.datalen = (*env)->GetArrayLength(env, o);
26170         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
26171         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
26172         o_ref.data_is_owned = true;
26173         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
26174         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
26175         return tag_ptr(ret_conv, true);
26176 }
26177
26178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1err(JNIEnv *env, jclass clz) {
26179         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
26180         *ret_conv = CResult_WitnessNoneZ_err();
26181         return tag_ptr(ret_conv, true);
26182 }
26183
26184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26185         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
26186         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
26187         return ret_conv;
26188 }
26189
26190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26191         if (!ptr_is_owned(_res)) return;
26192         void* _res_ptr = untag_ptr(_res);
26193         CHECK_ACCESS(_res_ptr);
26194         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
26195         FREE(untag_ptr(_res));
26196         CResult_WitnessNoneZ_free(_res_conv);
26197 }
26198
26199 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
26200         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
26201         *ret_conv = CResult_WitnessNoneZ_clone(arg);
26202         return tag_ptr(ret_conv, true);
26203 }
26204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26205         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
26206         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
26207         return ret_conv;
26208 }
26209
26210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26211         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
26212         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
26213         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
26214         return tag_ptr(ret_conv, true);
26215 }
26216
26217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26218         LDKCVec_ECDSASignatureZ _res_constr;
26219         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26220         if (_res_constr.datalen > 0)
26221                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
26222         else
26223                 _res_constr.data = NULL;
26224         for (size_t i = 0; i < _res_constr.datalen; i++) {
26225                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
26226                 LDKECDSASignature _res_conv_8_ref;
26227                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
26228                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
26229                 _res_constr.data[i] = _res_conv_8_ref;
26230         }
26231         CVec_ECDSASignatureZ_free(_res_constr);
26232 }
26233
26234 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
26235         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
26236         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
26237         return tag_ptr(ret_conv, true);
26238 }
26239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26240         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
26241         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
26242         return ret_conv;
26243 }
26244
26245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26246         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
26247         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
26248         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
26249         return tag_ptr(ret_conv, true);
26250 }
26251
26252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
26253         LDKECDSASignature a_ref;
26254         CHECK((*env)->GetArrayLength(env, a) == 64);
26255         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
26256         LDKCVec_ECDSASignatureZ b_constr;
26257         b_constr.datalen = (*env)->GetArrayLength(env, b);
26258         if (b_constr.datalen > 0)
26259                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
26260         else
26261                 b_constr.data = NULL;
26262         for (size_t i = 0; i < b_constr.datalen; i++) {
26263                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
26264                 LDKECDSASignature b_conv_8_ref;
26265                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
26266                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
26267                 b_constr.data[i] = b_conv_8_ref;
26268         }
26269         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
26270         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
26271         return tag_ptr(ret_conv, true);
26272 }
26273
26274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26275         if (!ptr_is_owned(_res)) return;
26276         void* _res_ptr = untag_ptr(_res);
26277         CHECK_ACCESS(_res_ptr);
26278         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
26279         FREE(untag_ptr(_res));
26280         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
26281 }
26282
26283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26284         void* o_ptr = untag_ptr(o);
26285         CHECK_ACCESS(o_ptr);
26286         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
26287         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
26288         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26289         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
26290         return tag_ptr(ret_conv, true);
26291 }
26292
26293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
26294         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26295         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
26296         return tag_ptr(ret_conv, true);
26297 }
26298
26299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26300         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
26301         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
26302         return ret_conv;
26303 }
26304
26305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26306         if (!ptr_is_owned(_res)) return;
26307         void* _res_ptr = untag_ptr(_res);
26308         CHECK_ACCESS(_res_ptr);
26309         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
26310         FREE(untag_ptr(_res));
26311         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
26312 }
26313
26314 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
26315         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26316         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
26317         return tag_ptr(ret_conv, true);
26318 }
26319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26320         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
26321         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
26322         return ret_conv;
26323 }
26324
26325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26326         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
26327         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26328         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
26329         return tag_ptr(ret_conv, true);
26330 }
26331
26332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26333         LDKInMemorySigner o_conv;
26334         o_conv.inner = untag_ptr(o);
26335         o_conv.is_owned = ptr_is_owned(o);
26336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26337         o_conv = InMemorySigner_clone(&o_conv);
26338         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26339         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
26340         return tag_ptr(ret_conv, true);
26341 }
26342
26343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26344         void* e_ptr = untag_ptr(e);
26345         CHECK_ACCESS(e_ptr);
26346         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26347         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26348         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26349         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
26350         return tag_ptr(ret_conv, true);
26351 }
26352
26353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26354         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
26355         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
26356         return ret_conv;
26357 }
26358
26359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26360         if (!ptr_is_owned(_res)) return;
26361         void* _res_ptr = untag_ptr(_res);
26362         CHECK_ACCESS(_res_ptr);
26363         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
26364         FREE(untag_ptr(_res));
26365         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
26366 }
26367
26368 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
26369         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26370         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
26371         return tag_ptr(ret_conv, true);
26372 }
26373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26374         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
26375         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
26376         return ret_conv;
26377 }
26378
26379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26380         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
26381         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26382         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
26383         return tag_ptr(ret_conv, true);
26384 }
26385
26386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26387         void* o_ptr = untag_ptr(o);
26388         CHECK_ACCESS(o_ptr);
26389         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
26390         if (o_conv.free == LDKWriteableScore_JCalls_free) {
26391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26392                 LDKWriteableScore_JCalls_cloned(&o_conv);
26393         }
26394         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
26395         *ret_copy = COption_WriteableScoreZ_some(o_conv);
26396         int64_t ret_ref = tag_ptr(ret_copy, true);
26397         return ret_ref;
26398 }
26399
26400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
26401         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
26402         *ret_copy = COption_WriteableScoreZ_none();
26403         int64_t ret_ref = tag_ptr(ret_copy, true);
26404         return ret_ref;
26405 }
26406
26407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26408         if (!ptr_is_owned(_res)) return;
26409         void* _res_ptr = untag_ptr(_res);
26410         CHECK_ACCESS(_res_ptr);
26411         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
26412         FREE(untag_ptr(_res));
26413         COption_WriteableScoreZ_free(_res_conv);
26414 }
26415
26416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
26417         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26418         *ret_conv = CResult_NoneIOErrorZ_ok();
26419         return tag_ptr(ret_conv, true);
26420 }
26421
26422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
26423         LDKIOError e_conv = LDKIOError_from_java(env, e);
26424         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26425         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
26426         return tag_ptr(ret_conv, true);
26427 }
26428
26429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26430         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
26431         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
26432         return ret_conv;
26433 }
26434
26435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26436         if (!ptr_is_owned(_res)) return;
26437         void* _res_ptr = untag_ptr(_res);
26438         CHECK_ACCESS(_res_ptr);
26439         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
26440         FREE(untag_ptr(_res));
26441         CResult_NoneIOErrorZ_free(_res_conv);
26442 }
26443
26444 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
26445         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26446         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
26447         return tag_ptr(ret_conv, true);
26448 }
26449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26450         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
26451         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
26452         return ret_conv;
26453 }
26454
26455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26456         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
26457         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26458         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
26459         return tag_ptr(ret_conv, true);
26460 }
26461
26462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26463         LDKCVec_ChannelDetailsZ _res_constr;
26464         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26465         if (_res_constr.datalen > 0)
26466                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26467         else
26468                 _res_constr.data = NULL;
26469         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26470         for (size_t q = 0; q < _res_constr.datalen; q++) {
26471                 int64_t _res_conv_16 = _res_vals[q];
26472                 LDKChannelDetails _res_conv_16_conv;
26473                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26474                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26476                 _res_constr.data[q] = _res_conv_16_conv;
26477         }
26478         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26479         CVec_ChannelDetailsZ_free(_res_constr);
26480 }
26481
26482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26483         LDKRoute o_conv;
26484         o_conv.inner = untag_ptr(o);
26485         o_conv.is_owned = ptr_is_owned(o);
26486         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26487         o_conv = Route_clone(&o_conv);
26488         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26489         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
26490         return tag_ptr(ret_conv, true);
26491 }
26492
26493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26494         LDKLightningError e_conv;
26495         e_conv.inner = untag_ptr(e);
26496         e_conv.is_owned = ptr_is_owned(e);
26497         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26498         e_conv = LightningError_clone(&e_conv);
26499         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26500         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
26501         return tag_ptr(ret_conv, true);
26502 }
26503
26504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26505         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
26506         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
26507         return ret_conv;
26508 }
26509
26510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26511         if (!ptr_is_owned(_res)) return;
26512         void* _res_ptr = untag_ptr(_res);
26513         CHECK_ACCESS(_res_ptr);
26514         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
26515         FREE(untag_ptr(_res));
26516         CResult_RouteLightningErrorZ_free(_res_conv);
26517 }
26518
26519 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
26520         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26521         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
26522         return tag_ptr(ret_conv, true);
26523 }
26524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26525         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
26526         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
26527         return ret_conv;
26528 }
26529
26530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26531         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
26532         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26533         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
26534         return tag_ptr(ret_conv, true);
26535 }
26536
26537 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
26538         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26539         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
26540         return tag_ptr(ret_conv, true);
26541 }
26542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26543         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
26544         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
26545         return ret_conv;
26546 }
26547
26548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26549         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
26550         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26551         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
26552         return tag_ptr(ret_conv, true);
26553 }
26554
26555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26556         LDKBlindedPayInfo a_conv;
26557         a_conv.inner = untag_ptr(a);
26558         a_conv.is_owned = ptr_is_owned(a);
26559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26560         a_conv = BlindedPayInfo_clone(&a_conv);
26561         LDKBlindedPath b_conv;
26562         b_conv.inner = untag_ptr(b);
26563         b_conv.is_owned = ptr_is_owned(b);
26564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26565         b_conv = BlindedPath_clone(&b_conv);
26566         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26567         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
26568         return tag_ptr(ret_conv, true);
26569 }
26570
26571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_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         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
26576         FREE(untag_ptr(_res));
26577         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
26578 }
26579
26580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26581         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
26582         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26583         if (_res_constr.datalen > 0)
26584                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
26585         else
26586                 _res_constr.data = NULL;
26587         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26588         for (size_t l = 0; l < _res_constr.datalen; l++) {
26589                 int64_t _res_conv_37 = _res_vals[l];
26590                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
26591                 CHECK_ACCESS(_res_conv_37_ptr);
26592                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
26593                 FREE(untag_ptr(_res_conv_37));
26594                 _res_constr.data[l] = _res_conv_37_conv;
26595         }
26596         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26597         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
26598 }
26599
26600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26601         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
26602         o_constr.datalen = (*env)->GetArrayLength(env, o);
26603         if (o_constr.datalen > 0)
26604                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
26605         else
26606                 o_constr.data = NULL;
26607         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26608         for (size_t l = 0; l < o_constr.datalen; l++) {
26609                 int64_t o_conv_37 = o_vals[l];
26610                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
26611                 CHECK_ACCESS(o_conv_37_ptr);
26612                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
26613                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
26614                 o_constr.data[l] = o_conv_37_conv;
26615         }
26616         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26617         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26618         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
26619         return tag_ptr(ret_conv, true);
26620 }
26621
26622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1err(JNIEnv *env, jclass clz) {
26623         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26624         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
26625         return tag_ptr(ret_conv, true);
26626 }
26627
26628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26629         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
26630         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
26631         return ret_conv;
26632 }
26633
26634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26635         if (!ptr_is_owned(_res)) return;
26636         void* _res_ptr = untag_ptr(_res);
26637         CHECK_ACCESS(_res_ptr);
26638         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
26639         FREE(untag_ptr(_res));
26640         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
26641 }
26642
26643 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
26644         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26645         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
26646         return tag_ptr(ret_conv, true);
26647 }
26648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26649         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
26650         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
26651         return ret_conv;
26652 }
26653
26654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26655         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
26656         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26657         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
26658         return tag_ptr(ret_conv, true);
26659 }
26660
26661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26662         LDKCVec_PublicKeyZ _res_constr;
26663         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26664         if (_res_constr.datalen > 0)
26665                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
26666         else
26667                 _res_constr.data = NULL;
26668         for (size_t i = 0; i < _res_constr.datalen; i++) {
26669                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
26670                 LDKPublicKey _res_conv_8_ref;
26671                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
26672                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
26673                 _res_constr.data[i] = _res_conv_8_ref;
26674         }
26675         CVec_PublicKeyZ_free(_res_constr);
26676 }
26677
26678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26679         LDKOnionMessagePath o_conv;
26680         o_conv.inner = untag_ptr(o);
26681         o_conv.is_owned = ptr_is_owned(o);
26682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26683         o_conv = OnionMessagePath_clone(&o_conv);
26684         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26685         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
26686         return tag_ptr(ret_conv, true);
26687 }
26688
26689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
26690         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26691         *ret_conv = CResult_OnionMessagePathNoneZ_err();
26692         return tag_ptr(ret_conv, true);
26693 }
26694
26695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26696         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
26697         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
26698         return ret_conv;
26699 }
26700
26701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26702         if (!ptr_is_owned(_res)) return;
26703         void* _res_ptr = untag_ptr(_res);
26704         CHECK_ACCESS(_res_ptr);
26705         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
26706         FREE(untag_ptr(_res));
26707         CResult_OnionMessagePathNoneZ_free(_res_conv);
26708 }
26709
26710 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
26711         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26712         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
26713         return tag_ptr(ret_conv, true);
26714 }
26715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26716         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
26717         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
26718         return ret_conv;
26719 }
26720
26721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26722         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
26723         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26724         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
26725         return tag_ptr(ret_conv, true);
26726 }
26727
26728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26729         LDKCVec_BlindedPathZ o_constr;
26730         o_constr.datalen = (*env)->GetArrayLength(env, o);
26731         if (o_constr.datalen > 0)
26732                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
26733         else
26734                 o_constr.data = NULL;
26735         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26736         for (size_t n = 0; n < o_constr.datalen; n++) {
26737                 int64_t o_conv_13 = o_vals[n];
26738                 LDKBlindedPath o_conv_13_conv;
26739                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
26740                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
26741                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
26742                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
26743                 o_constr.data[n] = o_conv_13_conv;
26744         }
26745         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26746         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26747         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
26748         return tag_ptr(ret_conv, true);
26749 }
26750
26751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
26752         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26753         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
26754         return tag_ptr(ret_conv, true);
26755 }
26756
26757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26758         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
26759         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
26760         return ret_conv;
26761 }
26762
26763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26764         if (!ptr_is_owned(_res)) return;
26765         void* _res_ptr = untag_ptr(_res);
26766         CHECK_ACCESS(_res_ptr);
26767         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
26768         FREE(untag_ptr(_res));
26769         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
26770 }
26771
26772 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
26773         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26774         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
26775         return tag_ptr(ret_conv, true);
26776 }
26777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26778         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
26779         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
26780         return ret_conv;
26781 }
26782
26783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26784         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
26785         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26786         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
26787         return tag_ptr(ret_conv, true);
26788 }
26789
26790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26791         LDKInFlightHtlcs o_conv;
26792         o_conv.inner = untag_ptr(o);
26793         o_conv.is_owned = ptr_is_owned(o);
26794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26795         o_conv = InFlightHtlcs_clone(&o_conv);
26796         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26797         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
26798         return tag_ptr(ret_conv, true);
26799 }
26800
26801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26802         void* e_ptr = untag_ptr(e);
26803         CHECK_ACCESS(e_ptr);
26804         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26805         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26806         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26807         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
26808         return tag_ptr(ret_conv, true);
26809 }
26810
26811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26812         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
26813         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
26814         return ret_conv;
26815 }
26816
26817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26818         if (!ptr_is_owned(_res)) return;
26819         void* _res_ptr = untag_ptr(_res);
26820         CHECK_ACCESS(_res_ptr);
26821         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
26822         FREE(untag_ptr(_res));
26823         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
26824 }
26825
26826 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
26827         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26828         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
26829         return tag_ptr(ret_conv, true);
26830 }
26831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26832         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
26833         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
26834         return ret_conv;
26835 }
26836
26837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26838         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
26839         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26840         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
26841         return tag_ptr(ret_conv, true);
26842 }
26843
26844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26845         LDKRouteHop o_conv;
26846         o_conv.inner = untag_ptr(o);
26847         o_conv.is_owned = ptr_is_owned(o);
26848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26849         o_conv = RouteHop_clone(&o_conv);
26850         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26851         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
26852         return tag_ptr(ret_conv, true);
26853 }
26854
26855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26856         void* e_ptr = untag_ptr(e);
26857         CHECK_ACCESS(e_ptr);
26858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26860         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26861         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
26862         return tag_ptr(ret_conv, true);
26863 }
26864
26865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26866         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
26867         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
26868         return ret_conv;
26869 }
26870
26871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26872         if (!ptr_is_owned(_res)) return;
26873         void* _res_ptr = untag_ptr(_res);
26874         CHECK_ACCESS(_res_ptr);
26875         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
26876         FREE(untag_ptr(_res));
26877         CResult_RouteHopDecodeErrorZ_free(_res_conv);
26878 }
26879
26880 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
26881         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26882         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
26883         return tag_ptr(ret_conv, true);
26884 }
26885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26886         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
26887         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
26888         return ret_conv;
26889 }
26890
26891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26892         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
26893         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26894         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
26895         return tag_ptr(ret_conv, true);
26896 }
26897
26898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26899         LDKCVec_BlindedHopZ _res_constr;
26900         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26901         if (_res_constr.datalen > 0)
26902                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
26903         else
26904                 _res_constr.data = NULL;
26905         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26906         for (size_t m = 0; m < _res_constr.datalen; m++) {
26907                 int64_t _res_conv_12 = _res_vals[m];
26908                 LDKBlindedHop _res_conv_12_conv;
26909                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
26910                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
26911                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
26912                 _res_constr.data[m] = _res_conv_12_conv;
26913         }
26914         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26915         CVec_BlindedHopZ_free(_res_constr);
26916 }
26917
26918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26919         LDKBlindedTail o_conv;
26920         o_conv.inner = untag_ptr(o);
26921         o_conv.is_owned = ptr_is_owned(o);
26922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26923         o_conv = BlindedTail_clone(&o_conv);
26924         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26925         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
26926         return tag_ptr(ret_conv, true);
26927 }
26928
26929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26930         void* e_ptr = untag_ptr(e);
26931         CHECK_ACCESS(e_ptr);
26932         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26933         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26934         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26935         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
26936         return tag_ptr(ret_conv, true);
26937 }
26938
26939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26940         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
26941         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
26942         return ret_conv;
26943 }
26944
26945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26946         if (!ptr_is_owned(_res)) return;
26947         void* _res_ptr = untag_ptr(_res);
26948         CHECK_ACCESS(_res_ptr);
26949         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
26950         FREE(untag_ptr(_res));
26951         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
26952 }
26953
26954 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
26955         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26956         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
26957         return tag_ptr(ret_conv, true);
26958 }
26959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26960         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
26961         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
26962         return ret_conv;
26963 }
26964
26965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26966         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
26967         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26968         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
26969         return tag_ptr(ret_conv, true);
26970 }
26971
26972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26973         LDKCVec_RouteHopZ _res_constr;
26974         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26975         if (_res_constr.datalen > 0)
26976                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26977         else
26978                 _res_constr.data = NULL;
26979         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26980         for (size_t k = 0; k < _res_constr.datalen; k++) {
26981                 int64_t _res_conv_10 = _res_vals[k];
26982                 LDKRouteHop _res_conv_10_conv;
26983                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
26984                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
26985                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
26986                 _res_constr.data[k] = _res_conv_10_conv;
26987         }
26988         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26989         CVec_RouteHopZ_free(_res_constr);
26990 }
26991
26992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26993         LDKCVec_PathZ _res_constr;
26994         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26995         if (_res_constr.datalen > 0)
26996                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
26997         else
26998                 _res_constr.data = NULL;
26999         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27000         for (size_t g = 0; g < _res_constr.datalen; g++) {
27001                 int64_t _res_conv_6 = _res_vals[g];
27002                 LDKPath _res_conv_6_conv;
27003                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
27004                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
27005                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
27006                 _res_constr.data[g] = _res_conv_6_conv;
27007         }
27008         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27009         CVec_PathZ_free(_res_constr);
27010 }
27011
27012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27013         LDKRoute o_conv;
27014         o_conv.inner = untag_ptr(o);
27015         o_conv.is_owned = ptr_is_owned(o);
27016         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27017         o_conv = Route_clone(&o_conv);
27018         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
27019         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
27020         return tag_ptr(ret_conv, true);
27021 }
27022
27023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27024         void* e_ptr = untag_ptr(e);
27025         CHECK_ACCESS(e_ptr);
27026         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27027         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27028         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
27029         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
27030         return tag_ptr(ret_conv, true);
27031 }
27032
27033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27034         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
27035         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
27036         return ret_conv;
27037 }
27038
27039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27040         if (!ptr_is_owned(_res)) return;
27041         void* _res_ptr = untag_ptr(_res);
27042         CHECK_ACCESS(_res_ptr);
27043         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
27044         FREE(untag_ptr(_res));
27045         CResult_RouteDecodeErrorZ_free(_res_conv);
27046 }
27047
27048 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
27049         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
27050         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
27051         return tag_ptr(ret_conv, true);
27052 }
27053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27054         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
27055         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
27056         return ret_conv;
27057 }
27058
27059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27060         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
27061         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
27062         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
27063         return tag_ptr(ret_conv, true);
27064 }
27065
27066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27067         LDKRouteParameters o_conv;
27068         o_conv.inner = untag_ptr(o);
27069         o_conv.is_owned = ptr_is_owned(o);
27070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27071         o_conv = RouteParameters_clone(&o_conv);
27072         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
27073         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
27074         return tag_ptr(ret_conv, true);
27075 }
27076
27077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27078         void* e_ptr = untag_ptr(e);
27079         CHECK_ACCESS(e_ptr);
27080         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27081         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27082         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
27083         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
27084         return tag_ptr(ret_conv, true);
27085 }
27086
27087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27088         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
27089         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
27090         return ret_conv;
27091 }
27092
27093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27094         if (!ptr_is_owned(_res)) return;
27095         void* _res_ptr = untag_ptr(_res);
27096         CHECK_ACCESS(_res_ptr);
27097         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
27098         FREE(untag_ptr(_res));
27099         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
27100 }
27101
27102 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
27103         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
27104         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
27105         return tag_ptr(ret_conv, true);
27106 }
27107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27108         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
27109         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
27110         return ret_conv;
27111 }
27112
27113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27114         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
27115         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
27116         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
27117         return tag_ptr(ret_conv, true);
27118 }
27119
27120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27121         LDKCVec_u64Z _res_constr;
27122         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27123         if (_res_constr.datalen > 0)
27124                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
27125         else
27126                 _res_constr.data = NULL;
27127         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27128         for (size_t g = 0; g < _res_constr.datalen; g++) {
27129                 int64_t _res_conv_6 = _res_vals[g];
27130                 _res_constr.data[g] = _res_conv_6;
27131         }
27132         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27133         CVec_u64Z_free(_res_constr);
27134 }
27135
27136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27137         LDKPaymentParameters o_conv;
27138         o_conv.inner = untag_ptr(o);
27139         o_conv.is_owned = ptr_is_owned(o);
27140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27141         o_conv = PaymentParameters_clone(&o_conv);
27142         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
27143         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
27144         return tag_ptr(ret_conv, true);
27145 }
27146
27147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27148         void* e_ptr = untag_ptr(e);
27149         CHECK_ACCESS(e_ptr);
27150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27152         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
27153         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
27154         return tag_ptr(ret_conv, true);
27155 }
27156
27157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27158         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
27159         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
27160         return ret_conv;
27161 }
27162
27163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27164         if (!ptr_is_owned(_res)) return;
27165         void* _res_ptr = untag_ptr(_res);
27166         CHECK_ACCESS(_res_ptr);
27167         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
27168         FREE(untag_ptr(_res));
27169         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
27170 }
27171
27172 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
27173         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
27174         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
27175         return tag_ptr(ret_conv, true);
27176 }
27177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27178         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
27179         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
27180         return ret_conv;
27181 }
27182
27183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27184         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
27185         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
27186         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
27187         return tag_ptr(ret_conv, true);
27188 }
27189
27190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27191         LDKCVec_RouteHintZ _res_constr;
27192         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27193         if (_res_constr.datalen > 0)
27194                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27195         else
27196                 _res_constr.data = NULL;
27197         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27198         for (size_t l = 0; l < _res_constr.datalen; l++) {
27199                 int64_t _res_conv_11 = _res_vals[l];
27200                 LDKRouteHint _res_conv_11_conv;
27201                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
27202                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
27203                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
27204                 _res_constr.data[l] = _res_conv_11_conv;
27205         }
27206         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27207         CVec_RouteHintZ_free(_res_constr);
27208 }
27209
27210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27211         LDKCVec_RouteHintHopZ _res_constr;
27212         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27213         if (_res_constr.datalen > 0)
27214                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
27215         else
27216                 _res_constr.data = NULL;
27217         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27218         for (size_t o = 0; o < _res_constr.datalen; o++) {
27219                 int64_t _res_conv_14 = _res_vals[o];
27220                 LDKRouteHintHop _res_conv_14_conv;
27221                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27222                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27223                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27224                 _res_constr.data[o] = _res_conv_14_conv;
27225         }
27226         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27227         CVec_RouteHintHopZ_free(_res_constr);
27228 }
27229
27230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27231         LDKRouteHint o_conv;
27232         o_conv.inner = untag_ptr(o);
27233         o_conv.is_owned = ptr_is_owned(o);
27234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27235         o_conv = RouteHint_clone(&o_conv);
27236         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27237         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
27238         return tag_ptr(ret_conv, true);
27239 }
27240
27241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27242         void* e_ptr = untag_ptr(e);
27243         CHECK_ACCESS(e_ptr);
27244         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27245         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27246         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27247         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
27248         return tag_ptr(ret_conv, true);
27249 }
27250
27251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27252         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
27253         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
27254         return ret_conv;
27255 }
27256
27257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27258         if (!ptr_is_owned(_res)) return;
27259         void* _res_ptr = untag_ptr(_res);
27260         CHECK_ACCESS(_res_ptr);
27261         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
27262         FREE(untag_ptr(_res));
27263         CResult_RouteHintDecodeErrorZ_free(_res_conv);
27264 }
27265
27266 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
27267         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27268         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
27269         return tag_ptr(ret_conv, true);
27270 }
27271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27272         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
27273         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
27274         return ret_conv;
27275 }
27276
27277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27278         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
27279         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27280         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
27281         return tag_ptr(ret_conv, true);
27282 }
27283
27284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27285         LDKRouteHintHop o_conv;
27286         o_conv.inner = untag_ptr(o);
27287         o_conv.is_owned = ptr_is_owned(o);
27288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27289         o_conv = RouteHintHop_clone(&o_conv);
27290         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27291         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
27292         return tag_ptr(ret_conv, true);
27293 }
27294
27295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27296         void* e_ptr = untag_ptr(e);
27297         CHECK_ACCESS(e_ptr);
27298         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27299         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27300         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27301         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
27302         return tag_ptr(ret_conv, true);
27303 }
27304
27305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27306         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
27307         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
27308         return ret_conv;
27309 }
27310
27311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27312         if (!ptr_is_owned(_res)) return;
27313         void* _res_ptr = untag_ptr(_res);
27314         CHECK_ACCESS(_res_ptr);
27315         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
27316         FREE(untag_ptr(_res));
27317         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
27318 }
27319
27320 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
27321         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27322         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
27323         return tag_ptr(ret_conv, true);
27324 }
27325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27326         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
27327         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
27328         return ret_conv;
27329 }
27330
27331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27332         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
27333         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27334         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
27335         return tag_ptr(ret_conv, true);
27336 }
27337
27338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27339         LDKFixedPenaltyScorer o_conv;
27340         o_conv.inner = untag_ptr(o);
27341         o_conv.is_owned = ptr_is_owned(o);
27342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27343         o_conv = FixedPenaltyScorer_clone(&o_conv);
27344         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27345         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
27346         return tag_ptr(ret_conv, true);
27347 }
27348
27349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27350         void* e_ptr = untag_ptr(e);
27351         CHECK_ACCESS(e_ptr);
27352         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27353         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27354         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27355         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
27356         return tag_ptr(ret_conv, true);
27357 }
27358
27359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27360         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
27361         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
27362         return ret_conv;
27363 }
27364
27365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27366         if (!ptr_is_owned(_res)) return;
27367         void* _res_ptr = untag_ptr(_res);
27368         CHECK_ACCESS(_res_ptr);
27369         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
27370         FREE(untag_ptr(_res));
27371         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
27372 }
27373
27374 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
27375         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27376         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
27377         return tag_ptr(ret_conv, true);
27378 }
27379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27380         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
27381         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
27382         return ret_conv;
27383 }
27384
27385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27386         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
27387         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27388         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
27389         return tag_ptr(ret_conv, true);
27390 }
27391
27392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27393         LDKCVec_NodeIdZ _res_constr;
27394         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27395         if (_res_constr.datalen > 0)
27396                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
27397         else
27398                 _res_constr.data = NULL;
27399         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27400         for (size_t i = 0; i < _res_constr.datalen; i++) {
27401                 int64_t _res_conv_8 = _res_vals[i];
27402                 LDKNodeId _res_conv_8_conv;
27403                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
27404                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
27405                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
27406                 _res_constr.data[i] = _res_conv_8_conv;
27407         }
27408         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27409         CVec_NodeIdZ_free(_res_constr);
27410 }
27411
27412 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
27413         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27414         *ret_conv = C2Tuple_u64u64Z_clone(arg);
27415         return tag_ptr(ret_conv, true);
27416 }
27417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27418         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
27419         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
27420         return ret_conv;
27421 }
27422
27423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27424         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
27425         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27426         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
27427         return tag_ptr(ret_conv, true);
27428 }
27429
27430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27431         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27432         *ret_conv = C2Tuple_u64u64Z_new(a, b);
27433         return tag_ptr(ret_conv, true);
27434 }
27435
27436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27437         if (!ptr_is_owned(_res)) return;
27438         void* _res_ptr = untag_ptr(_res);
27439         CHECK_ACCESS(_res_ptr);
27440         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
27441         FREE(untag_ptr(_res));
27442         C2Tuple_u64u64Z_free(_res_conv);
27443 }
27444
27445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27446         void* o_ptr = untag_ptr(o);
27447         CHECK_ACCESS(o_ptr);
27448         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
27449         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
27450         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27451         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
27452         int64_t ret_ref = tag_ptr(ret_copy, true);
27453         return ret_ref;
27454 }
27455
27456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
27457         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27458         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
27459         int64_t ret_ref = tag_ptr(ret_copy, true);
27460         return ret_ref;
27461 }
27462
27463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27464         if (!ptr_is_owned(_res)) return;
27465         void* _res_ptr = untag_ptr(_res);
27466         CHECK_ACCESS(_res_ptr);
27467         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
27468         FREE(untag_ptr(_res));
27469         COption_C2Tuple_u64u64ZZ_free(_res_conv);
27470 }
27471
27472 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
27473         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27474         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
27475         int64_t ret_ref = tag_ptr(ret_copy, true);
27476         return ret_ref;
27477 }
27478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27479         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
27480         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
27481         return ret_conv;
27482 }
27483
27484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27485         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
27486         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27487         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
27488         int64_t ret_ref = tag_ptr(ret_copy, true);
27489         return ret_ref;
27490 }
27491
27492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
27493         LDKThirtyTwoU16s a_ref;
27494         CHECK((*env)->GetArrayLength(env, a) == 32);
27495         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
27496         LDKThirtyTwoU16s b_ref;
27497         CHECK((*env)->GetArrayLength(env, b) == 32);
27498         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
27499         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
27500         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
27501         return tag_ptr(ret_conv, true);
27502 }
27503
27504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27505         if (!ptr_is_owned(_res)) return;
27506         void* _res_ptr = untag_ptr(_res);
27507         CHECK_ACCESS(_res_ptr);
27508         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
27509         FREE(untag_ptr(_res));
27510         C2Tuple_Z_free(_res_conv);
27511 }
27512
27513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
27514         LDKThirtyTwoU16s a_ref;
27515         CHECK((*env)->GetArrayLength(env, a) == 32);
27516         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
27517         LDKThirtyTwoU16s b_ref;
27518         CHECK((*env)->GetArrayLength(env, b) == 32);
27519         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
27520         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
27521         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
27522         return tag_ptr(ret_conv, true);
27523 }
27524
27525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27526         if (!ptr_is_owned(_res)) return;
27527         void* _res_ptr = untag_ptr(_res);
27528         CHECK_ACCESS(_res_ptr);
27529         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
27530         FREE(untag_ptr(_res));
27531         C2Tuple__u1632_u1632Z_free(_res_conv);
27532 }
27533
27534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27535         void* o_ptr = untag_ptr(o);
27536         CHECK_ACCESS(o_ptr);
27537         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
27538         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
27539         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
27540         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
27541         int64_t ret_ref = tag_ptr(ret_copy, true);
27542         return ret_ref;
27543 }
27544
27545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
27546         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
27547         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
27548         int64_t ret_ref = tag_ptr(ret_copy, true);
27549         return ret_ref;
27550 }
27551
27552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27553         if (!ptr_is_owned(_res)) return;
27554         void* _res_ptr = untag_ptr(_res);
27555         CHECK_ACCESS(_res_ptr);
27556         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
27557         FREE(untag_ptr(_res));
27558         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
27559 }
27560
27561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
27562         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27563         *ret_copy = COption_f64Z_some(o);
27564         int64_t ret_ref = tag_ptr(ret_copy, true);
27565         return ret_ref;
27566 }
27567
27568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
27569         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27570         *ret_copy = COption_f64Z_none();
27571         int64_t ret_ref = tag_ptr(ret_copy, true);
27572         return ret_ref;
27573 }
27574
27575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27576         if (!ptr_is_owned(_res)) return;
27577         void* _res_ptr = untag_ptr(_res);
27578         CHECK_ACCESS(_res_ptr);
27579         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
27580         FREE(untag_ptr(_res));
27581         COption_f64Z_free(_res_conv);
27582 }
27583
27584 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
27585         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27586         *ret_copy = COption_f64Z_clone(arg);
27587         int64_t ret_ref = tag_ptr(ret_copy, true);
27588         return ret_ref;
27589 }
27590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27591         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
27592         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
27593         return ret_conv;
27594 }
27595
27596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27597         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
27598         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27599         *ret_copy = COption_f64Z_clone(orig_conv);
27600         int64_t ret_ref = tag_ptr(ret_copy, true);
27601         return ret_ref;
27602 }
27603
27604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27605         LDKProbabilisticScorer o_conv;
27606         o_conv.inner = untag_ptr(o);
27607         o_conv.is_owned = ptr_is_owned(o);
27608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27609         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
27610         
27611         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
27612         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
27613         return tag_ptr(ret_conv, true);
27614 }
27615
27616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27617         void* e_ptr = untag_ptr(e);
27618         CHECK_ACCESS(e_ptr);
27619         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27620         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27621         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
27622         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
27623         return tag_ptr(ret_conv, true);
27624 }
27625
27626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27627         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
27628         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
27629         return ret_conv;
27630 }
27631
27632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27633         if (!ptr_is_owned(_res)) return;
27634         void* _res_ptr = untag_ptr(_res);
27635         CHECK_ACCESS(_res_ptr);
27636         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
27637         FREE(untag_ptr(_res));
27638         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
27639 }
27640
27641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27642         LDKBestBlock o_conv;
27643         o_conv.inner = untag_ptr(o);
27644         o_conv.is_owned = ptr_is_owned(o);
27645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27646         o_conv = BestBlock_clone(&o_conv);
27647         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27648         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
27649         return tag_ptr(ret_conv, true);
27650 }
27651
27652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27653         void* e_ptr = untag_ptr(e);
27654         CHECK_ACCESS(e_ptr);
27655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27657         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27658         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
27659         return tag_ptr(ret_conv, true);
27660 }
27661
27662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27663         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
27664         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
27665         return ret_conv;
27666 }
27667
27668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27669         if (!ptr_is_owned(_res)) return;
27670         void* _res_ptr = untag_ptr(_res);
27671         CHECK_ACCESS(_res_ptr);
27672         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
27673         FREE(untag_ptr(_res));
27674         CResult_BestBlockDecodeErrorZ_free(_res_conv);
27675 }
27676
27677 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
27678         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27679         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
27680         return tag_ptr(ret_conv, true);
27681 }
27682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27683         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
27684         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
27685         return ret_conv;
27686 }
27687
27688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27689         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
27690         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27691         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
27692         return tag_ptr(ret_conv, true);
27693 }
27694
27695 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
27696         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27697         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
27698         return tag_ptr(ret_conv, true);
27699 }
27700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27701         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
27702         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
27703         return ret_conv;
27704 }
27705
27706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27707         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
27708         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27709         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
27710         return tag_ptr(ret_conv, true);
27711 }
27712
27713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
27714         LDKTransaction b_ref;
27715         b_ref.datalen = (*env)->GetArrayLength(env, b);
27716         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
27717         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27718         b_ref.data_is_owned = true;
27719         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27720         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
27721         return tag_ptr(ret_conv, true);
27722 }
27723
27724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27725         if (!ptr_is_owned(_res)) return;
27726         void* _res_ptr = untag_ptr(_res);
27727         CHECK_ACCESS(_res_ptr);
27728         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
27729         FREE(untag_ptr(_res));
27730         C2Tuple_usizeTransactionZ_free(_res_conv);
27731 }
27732
27733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27734         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
27735         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27736         if (_res_constr.datalen > 0)
27737                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27738         else
27739                 _res_constr.data = NULL;
27740         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27741         for (size_t c = 0; c < _res_constr.datalen; c++) {
27742                 int64_t _res_conv_28 = _res_vals[c];
27743                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
27744                 CHECK_ACCESS(_res_conv_28_ptr);
27745                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
27746                 FREE(untag_ptr(_res_conv_28));
27747                 _res_constr.data[c] = _res_conv_28_conv;
27748         }
27749         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27750         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
27751 }
27752
27753 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
27754         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27755         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
27756         return tag_ptr(ret_conv, true);
27757 }
27758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27759         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
27760         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
27761         return ret_conv;
27762 }
27763
27764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27765         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
27766         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27767         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
27768         return tag_ptr(ret_conv, true);
27769 }
27770
27771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int32_t b, int64_t c) {
27772         LDKThirtyTwoBytes a_ref;
27773         CHECK((*env)->GetArrayLength(env, a) == 32);
27774         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27775         void* c_ptr = untag_ptr(c);
27776         CHECK_ACCESS(c_ptr);
27777         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
27778         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
27779         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27780         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
27781         return tag_ptr(ret_conv, true);
27782 }
27783
27784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27785         if (!ptr_is_owned(_res)) return;
27786         void* _res_ptr = untag_ptr(_res);
27787         CHECK_ACCESS(_res_ptr);
27788         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
27789         FREE(untag_ptr(_res));
27790         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
27791 }
27792
27793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27794         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
27795         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27796         if (_res_constr.datalen > 0)
27797                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
27798         else
27799                 _res_constr.data = NULL;
27800         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27801         for (size_t c = 0; c < _res_constr.datalen; c++) {
27802                 int64_t _res_conv_54 = _res_vals[c];
27803                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
27804                 CHECK_ACCESS(_res_conv_54_ptr);
27805                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
27806                 FREE(untag_ptr(_res_conv_54));
27807                 _res_constr.data[c] = _res_conv_54_conv;
27808         }
27809         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27810         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
27811 }
27812
27813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
27814         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
27815         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27816         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
27817         return tag_ptr(ret_conv, true);
27818 }
27819
27820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
27821         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27822         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
27823         return tag_ptr(ret_conv, true);
27824 }
27825
27826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27827         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
27828         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
27829         return ret_conv;
27830 }
27831
27832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27833         if (!ptr_is_owned(_res)) return;
27834         void* _res_ptr = untag_ptr(_res);
27835         CHECK_ACCESS(_res_ptr);
27836         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
27837         FREE(untag_ptr(_res));
27838         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
27839 }
27840
27841 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
27842         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27843         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
27844         return tag_ptr(ret_conv, true);
27845 }
27846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27847         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
27848         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
27849         return ret_conv;
27850 }
27851
27852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27853         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
27854         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27855         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
27856         return tag_ptr(ret_conv, true);
27857 }
27858
27859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27860         LDKCVec_MonitorEventZ _res_constr;
27861         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27862         if (_res_constr.datalen > 0)
27863                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
27864         else
27865                 _res_constr.data = NULL;
27866         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27867         for (size_t o = 0; o < _res_constr.datalen; o++) {
27868                 int64_t _res_conv_14 = _res_vals[o];
27869                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
27870                 CHECK_ACCESS(_res_conv_14_ptr);
27871                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
27872                 FREE(untag_ptr(_res_conv_14));
27873                 _res_constr.data[o] = _res_conv_14_conv;
27874         }
27875         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27876         CVec_MonitorEventZ_free(_res_constr);
27877 }
27878
27879 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
27880         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27881         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
27882         return tag_ptr(ret_conv, true);
27883 }
27884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27885         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
27886         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
27887         return ret_conv;
27888 }
27889
27890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27891         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
27892         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27893         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
27894         return tag_ptr(ret_conv, true);
27895 }
27896
27897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_tArray c, int8_tArray d) {
27898         LDKOutPoint a_conv;
27899         a_conv.inner = untag_ptr(a);
27900         a_conv.is_owned = ptr_is_owned(a);
27901         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27902         a_conv = OutPoint_clone(&a_conv);
27903         LDKChannelId b_conv;
27904         b_conv.inner = untag_ptr(b);
27905         b_conv.is_owned = ptr_is_owned(b);
27906         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27907         b_conv = ChannelId_clone(&b_conv);
27908         LDKCVec_MonitorEventZ c_constr;
27909         c_constr.datalen = (*env)->GetArrayLength(env, c);
27910         if (c_constr.datalen > 0)
27911                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
27912         else
27913                 c_constr.data = NULL;
27914         int64_t* c_vals = (*env)->GetLongArrayElements (env, c, NULL);
27915         for (size_t o = 0; o < c_constr.datalen; o++) {
27916                 int64_t c_conv_14 = c_vals[o];
27917                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
27918                 CHECK_ACCESS(c_conv_14_ptr);
27919                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
27920                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
27921                 c_constr.data[o] = c_conv_14_conv;
27922         }
27923         (*env)->ReleaseLongArrayElements(env, c, c_vals, 0);
27924         LDKPublicKey d_ref;
27925         CHECK((*env)->GetArrayLength(env, d) == 33);
27926         (*env)->GetByteArrayRegion(env, d, 0, 33, d_ref.compressed_form);
27927         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27928         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
27929         return tag_ptr(ret_conv, true);
27930 }
27931
27932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27933         if (!ptr_is_owned(_res)) return;
27934         void* _res_ptr = untag_ptr(_res);
27935         CHECK_ACCESS(_res_ptr);
27936         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
27937         FREE(untag_ptr(_res));
27938         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
27939 }
27940
27941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27942         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
27943         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27944         if (_res_constr.datalen > 0)
27945                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
27946         else
27947                 _res_constr.data = NULL;
27948         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27949         for (size_t f = 0; f < _res_constr.datalen; f++) {
27950                 int64_t _res_conv_57 = _res_vals[f];
27951                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
27952                 CHECK_ACCESS(_res_conv_57_ptr);
27953                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
27954                 FREE(untag_ptr(_res_conv_57));
27955                 _res_constr.data[f] = _res_conv_57_conv;
27956         }
27957         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27958         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
27959 }
27960
27961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27962         LDKInitFeatures o_conv;
27963         o_conv.inner = untag_ptr(o);
27964         o_conv.is_owned = ptr_is_owned(o);
27965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27966         o_conv = InitFeatures_clone(&o_conv);
27967         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27968         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
27969         return tag_ptr(ret_conv, true);
27970 }
27971
27972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27973         void* e_ptr = untag_ptr(e);
27974         CHECK_ACCESS(e_ptr);
27975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27977         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27978         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
27979         return tag_ptr(ret_conv, true);
27980 }
27981
27982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27983         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
27984         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
27985         return ret_conv;
27986 }
27987
27988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27989         if (!ptr_is_owned(_res)) return;
27990         void* _res_ptr = untag_ptr(_res);
27991         CHECK_ACCESS(_res_ptr);
27992         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
27993         FREE(untag_ptr(_res));
27994         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
27995 }
27996
27997 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27998         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27999         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
28000         return tag_ptr(ret_conv, true);
28001 }
28002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28003         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
28004         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28005         return ret_conv;
28006 }
28007
28008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28009         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
28010         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
28011         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
28012         return tag_ptr(ret_conv, true);
28013 }
28014
28015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28016         LDKChannelFeatures o_conv;
28017         o_conv.inner = untag_ptr(o);
28018         o_conv.is_owned = ptr_is_owned(o);
28019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28020         o_conv = ChannelFeatures_clone(&o_conv);
28021         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
28022         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
28023         return tag_ptr(ret_conv, true);
28024 }
28025
28026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28027         void* e_ptr = untag_ptr(e);
28028         CHECK_ACCESS(e_ptr);
28029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28031         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
28032         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
28033         return tag_ptr(ret_conv, true);
28034 }
28035
28036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28037         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
28038         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
28039         return ret_conv;
28040 }
28041
28042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28043         if (!ptr_is_owned(_res)) return;
28044         void* _res_ptr = untag_ptr(_res);
28045         CHECK_ACCESS(_res_ptr);
28046         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
28047         FREE(untag_ptr(_res));
28048         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
28049 }
28050
28051 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28052         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
28053         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
28054         return tag_ptr(ret_conv, true);
28055 }
28056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28057         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
28058         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28059         return ret_conv;
28060 }
28061
28062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28063         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
28064         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
28065         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
28066         return tag_ptr(ret_conv, true);
28067 }
28068
28069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28070         LDKNodeFeatures o_conv;
28071         o_conv.inner = untag_ptr(o);
28072         o_conv.is_owned = ptr_is_owned(o);
28073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28074         o_conv = NodeFeatures_clone(&o_conv);
28075         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
28076         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
28077         return tag_ptr(ret_conv, true);
28078 }
28079
28080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28081         void* e_ptr = untag_ptr(e);
28082         CHECK_ACCESS(e_ptr);
28083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28085         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
28086         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
28087         return tag_ptr(ret_conv, true);
28088 }
28089
28090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28091         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
28092         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
28093         return ret_conv;
28094 }
28095
28096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28097         if (!ptr_is_owned(_res)) return;
28098         void* _res_ptr = untag_ptr(_res);
28099         CHECK_ACCESS(_res_ptr);
28100         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
28101         FREE(untag_ptr(_res));
28102         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
28103 }
28104
28105 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28106         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
28107         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
28108         return tag_ptr(ret_conv, true);
28109 }
28110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28111         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
28112         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28113         return ret_conv;
28114 }
28115
28116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28117         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
28118         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
28119         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
28120         return tag_ptr(ret_conv, true);
28121 }
28122
28123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28124         LDKBolt11InvoiceFeatures o_conv;
28125         o_conv.inner = untag_ptr(o);
28126         o_conv.is_owned = ptr_is_owned(o);
28127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28128         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
28129         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
28130         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
28131         return tag_ptr(ret_conv, true);
28132 }
28133
28134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28135         void* e_ptr = untag_ptr(e);
28136         CHECK_ACCESS(e_ptr);
28137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28139         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
28140         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
28141         return tag_ptr(ret_conv, true);
28142 }
28143
28144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28145         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
28146         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
28147         return ret_conv;
28148 }
28149
28150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28151         if (!ptr_is_owned(_res)) return;
28152         void* _res_ptr = untag_ptr(_res);
28153         CHECK_ACCESS(_res_ptr);
28154         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
28155         FREE(untag_ptr(_res));
28156         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
28157 }
28158
28159 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28160         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
28161         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
28162         return tag_ptr(ret_conv, true);
28163 }
28164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28165         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
28166         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28167         return ret_conv;
28168 }
28169
28170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28171         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
28172         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
28173         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
28174         return tag_ptr(ret_conv, true);
28175 }
28176
28177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28178         LDKBolt12InvoiceFeatures o_conv;
28179         o_conv.inner = untag_ptr(o);
28180         o_conv.is_owned = ptr_is_owned(o);
28181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28182         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
28183         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
28184         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
28185         return tag_ptr(ret_conv, true);
28186 }
28187
28188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28189         void* e_ptr = untag_ptr(e);
28190         CHECK_ACCESS(e_ptr);
28191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28193         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
28194         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
28195         return tag_ptr(ret_conv, true);
28196 }
28197
28198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28199         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
28200         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
28201         return ret_conv;
28202 }
28203
28204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28205         if (!ptr_is_owned(_res)) return;
28206         void* _res_ptr = untag_ptr(_res);
28207         CHECK_ACCESS(_res_ptr);
28208         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
28209         FREE(untag_ptr(_res));
28210         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
28211 }
28212
28213 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28214         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
28215         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
28216         return tag_ptr(ret_conv, true);
28217 }
28218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28219         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
28220         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28221         return ret_conv;
28222 }
28223
28224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28225         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
28226         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
28227         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
28228         return tag_ptr(ret_conv, true);
28229 }
28230
28231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28232         LDKBlindedHopFeatures o_conv;
28233         o_conv.inner = untag_ptr(o);
28234         o_conv.is_owned = ptr_is_owned(o);
28235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28236         o_conv = BlindedHopFeatures_clone(&o_conv);
28237         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28238         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
28239         return tag_ptr(ret_conv, true);
28240 }
28241
28242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28243         void* e_ptr = untag_ptr(e);
28244         CHECK_ACCESS(e_ptr);
28245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28247         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28248         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
28249         return tag_ptr(ret_conv, true);
28250 }
28251
28252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28253         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
28254         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
28255         return ret_conv;
28256 }
28257
28258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28259         if (!ptr_is_owned(_res)) return;
28260         void* _res_ptr = untag_ptr(_res);
28261         CHECK_ACCESS(_res_ptr);
28262         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
28263         FREE(untag_ptr(_res));
28264         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
28265 }
28266
28267 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28268         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28269         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
28270         return tag_ptr(ret_conv, true);
28271 }
28272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28273         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
28274         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28275         return ret_conv;
28276 }
28277
28278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28279         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
28280         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28281         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
28282         return tag_ptr(ret_conv, true);
28283 }
28284
28285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28286         LDKChannelTypeFeatures o_conv;
28287         o_conv.inner = untag_ptr(o);
28288         o_conv.is_owned = ptr_is_owned(o);
28289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28290         o_conv = ChannelTypeFeatures_clone(&o_conv);
28291         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28292         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
28293         return tag_ptr(ret_conv, true);
28294 }
28295
28296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28297         void* e_ptr = untag_ptr(e);
28298         CHECK_ACCESS(e_ptr);
28299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28301         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28302         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
28303         return tag_ptr(ret_conv, true);
28304 }
28305
28306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28307         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
28308         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
28309         return ret_conv;
28310 }
28311
28312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28313         if (!ptr_is_owned(_res)) return;
28314         void* _res_ptr = untag_ptr(_res);
28315         CHECK_ACCESS(_res_ptr);
28316         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
28317         FREE(untag_ptr(_res));
28318         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
28319 }
28320
28321 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28322         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28323         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
28324         return tag_ptr(ret_conv, true);
28325 }
28326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28327         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
28328         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28329         return ret_conv;
28330 }
28331
28332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28333         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
28334         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28335         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
28336         return tag_ptr(ret_conv, true);
28337 }
28338
28339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28340         LDKOfferId o_conv;
28341         o_conv.inner = untag_ptr(o);
28342         o_conv.is_owned = ptr_is_owned(o);
28343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28344         o_conv = OfferId_clone(&o_conv);
28345         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28346         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
28347         return tag_ptr(ret_conv, true);
28348 }
28349
28350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28351         void* e_ptr = untag_ptr(e);
28352         CHECK_ACCESS(e_ptr);
28353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28355         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28356         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
28357         return tag_ptr(ret_conv, true);
28358 }
28359
28360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28361         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
28362         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
28363         return ret_conv;
28364 }
28365
28366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28367         if (!ptr_is_owned(_res)) return;
28368         void* _res_ptr = untag_ptr(_res);
28369         CHECK_ACCESS(_res_ptr);
28370         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
28371         FREE(untag_ptr(_res));
28372         CResult_OfferIdDecodeErrorZ_free(_res_conv);
28373 }
28374
28375 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
28376         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28377         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
28378         return tag_ptr(ret_conv, true);
28379 }
28380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28381         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
28382         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
28383         return ret_conv;
28384 }
28385
28386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28387         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
28388         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28389         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
28390         return tag_ptr(ret_conv, true);
28391 }
28392
28393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
28394         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28395         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
28396         return tag_ptr(ret_conv, true);
28397 }
28398
28399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28400         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28401         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28402         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
28403         return tag_ptr(ret_conv, true);
28404 }
28405
28406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28407         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
28408         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
28409         return ret_conv;
28410 }
28411
28412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28413         if (!ptr_is_owned(_res)) return;
28414         void* _res_ptr = untag_ptr(_res);
28415         CHECK_ACCESS(_res_ptr);
28416         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
28417         FREE(untag_ptr(_res));
28418         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
28419 }
28420
28421 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
28422         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28423         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
28424         return tag_ptr(ret_conv, true);
28425 }
28426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28427         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
28428         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
28429         return ret_conv;
28430 }
28431
28432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28433         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
28434         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28435         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
28436         return tag_ptr(ret_conv, true);
28437 }
28438
28439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28440         LDKOffer o_conv;
28441         o_conv.inner = untag_ptr(o);
28442         o_conv.is_owned = ptr_is_owned(o);
28443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28444         o_conv = Offer_clone(&o_conv);
28445         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28446         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
28447         return tag_ptr(ret_conv, true);
28448 }
28449
28450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28451         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28452         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28453         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
28454         return tag_ptr(ret_conv, true);
28455 }
28456
28457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28458         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
28459         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
28460         return ret_conv;
28461 }
28462
28463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28464         if (!ptr_is_owned(_res)) return;
28465         void* _res_ptr = untag_ptr(_res);
28466         CHECK_ACCESS(_res_ptr);
28467         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
28468         FREE(untag_ptr(_res));
28469         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
28470 }
28471
28472 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
28473         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28474         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
28475         return tag_ptr(ret_conv, true);
28476 }
28477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28478         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
28479         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
28480         return ret_conv;
28481 }
28482
28483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28484         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
28485         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28486         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
28487         return tag_ptr(ret_conv, true);
28488 }
28489
28490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28491         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
28492         o_conv.inner = untag_ptr(o);
28493         o_conv.is_owned = ptr_is_owned(o);
28494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28495         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
28496         
28497         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
28498         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
28499         return tag_ptr(ret_conv, true);
28500 }
28501
28502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28503         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28504         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
28505         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
28506         return tag_ptr(ret_conv, true);
28507 }
28508
28509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28510         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
28511         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
28512         return ret_conv;
28513 }
28514
28515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28516         if (!ptr_is_owned(_res)) return;
28517         void* _res_ptr = untag_ptr(_res);
28518         CHECK_ACCESS(_res_ptr);
28519         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
28520         FREE(untag_ptr(_res));
28521         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
28522 }
28523
28524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28525         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
28526         o_conv.inner = untag_ptr(o);
28527         o_conv.is_owned = ptr_is_owned(o);
28528         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28529         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
28530         
28531         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
28532         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
28533         return tag_ptr(ret_conv, true);
28534 }
28535
28536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28537         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28538         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
28539         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
28540         return tag_ptr(ret_conv, true);
28541 }
28542
28543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28544         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
28545         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
28546         return ret_conv;
28547 }
28548
28549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28550         if (!ptr_is_owned(_res)) return;
28551         void* _res_ptr = untag_ptr(_res);
28552         CHECK_ACCESS(_res_ptr);
28553         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
28554         FREE(untag_ptr(_res));
28555         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
28556 }
28557
28558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28559         LDKOffer o_conv;
28560         o_conv.inner = untag_ptr(o);
28561         o_conv.is_owned = ptr_is_owned(o);
28562         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28563         o_conv = Offer_clone(&o_conv);
28564         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28565         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
28566         return tag_ptr(ret_conv, true);
28567 }
28568
28569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28570         LDKBolt12ParseError e_conv;
28571         e_conv.inner = untag_ptr(e);
28572         e_conv.is_owned = ptr_is_owned(e);
28573         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28574         e_conv = Bolt12ParseError_clone(&e_conv);
28575         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28576         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
28577         return tag_ptr(ret_conv, true);
28578 }
28579
28580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28581         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
28582         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
28583         return ret_conv;
28584 }
28585
28586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28587         if (!ptr_is_owned(_res)) return;
28588         void* _res_ptr = untag_ptr(_res);
28589         CHECK_ACCESS(_res_ptr);
28590         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
28591         FREE(untag_ptr(_res));
28592         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
28593 }
28594
28595 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
28596         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28597         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
28598         return tag_ptr(ret_conv, true);
28599 }
28600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28601         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
28602         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
28603         return ret_conv;
28604 }
28605
28606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28607         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
28608         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28609         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
28610         return tag_ptr(ret_conv, true);
28611 }
28612
28613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28614         LDKNodeId o_conv;
28615         o_conv.inner = untag_ptr(o);
28616         o_conv.is_owned = ptr_is_owned(o);
28617         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28618         o_conv = NodeId_clone(&o_conv);
28619         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28620         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
28621         return tag_ptr(ret_conv, true);
28622 }
28623
28624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28625         void* e_ptr = untag_ptr(e);
28626         CHECK_ACCESS(e_ptr);
28627         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28628         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28629         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28630         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
28631         return tag_ptr(ret_conv, true);
28632 }
28633
28634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28635         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
28636         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
28637         return ret_conv;
28638 }
28639
28640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28641         if (!ptr_is_owned(_res)) return;
28642         void* _res_ptr = untag_ptr(_res);
28643         CHECK_ACCESS(_res_ptr);
28644         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
28645         FREE(untag_ptr(_res));
28646         CResult_NodeIdDecodeErrorZ_free(_res_conv);
28647 }
28648
28649 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
28650         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28651         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
28652         return tag_ptr(ret_conv, true);
28653 }
28654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28655         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
28656         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
28657         return ret_conv;
28658 }
28659
28660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28661         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
28662         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28663         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
28664         return tag_ptr(ret_conv, true);
28665 }
28666
28667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28668         LDKPublicKey o_ref;
28669         CHECK((*env)->GetArrayLength(env, o) == 33);
28670         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
28671         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28672         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
28673         return tag_ptr(ret_conv, true);
28674 }
28675
28676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28677         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
28678         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28679         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
28680         return tag_ptr(ret_conv, true);
28681 }
28682
28683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28684         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
28685         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
28686         return ret_conv;
28687 }
28688
28689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28690         if (!ptr_is_owned(_res)) return;
28691         void* _res_ptr = untag_ptr(_res);
28692         CHECK_ACCESS(_res_ptr);
28693         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
28694         FREE(untag_ptr(_res));
28695         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
28696 }
28697
28698 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
28699         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28700         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
28701         return tag_ptr(ret_conv, true);
28702 }
28703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28704         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
28705         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
28706         return ret_conv;
28707 }
28708
28709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28710         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
28711         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28712         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
28713         return tag_ptr(ret_conv, true);
28714 }
28715
28716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28717         void* o_ptr = untag_ptr(o);
28718         CHECK_ACCESS(o_ptr);
28719         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
28720         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
28721         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28722         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
28723         int64_t ret_ref = tag_ptr(ret_copy, true);
28724         return ret_ref;
28725 }
28726
28727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
28728         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28729         *ret_copy = COption_NetworkUpdateZ_none();
28730         int64_t ret_ref = tag_ptr(ret_copy, true);
28731         return ret_ref;
28732 }
28733
28734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28735         if (!ptr_is_owned(_res)) return;
28736         void* _res_ptr = untag_ptr(_res);
28737         CHECK_ACCESS(_res_ptr);
28738         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
28739         FREE(untag_ptr(_res));
28740         COption_NetworkUpdateZ_free(_res_conv);
28741 }
28742
28743 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
28744         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28745         *ret_copy = COption_NetworkUpdateZ_clone(arg);
28746         int64_t ret_ref = tag_ptr(ret_copy, true);
28747         return ret_ref;
28748 }
28749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28750         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
28751         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
28752         return ret_conv;
28753 }
28754
28755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28756         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
28757         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28758         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
28759         int64_t ret_ref = tag_ptr(ret_copy, true);
28760         return ret_ref;
28761 }
28762
28763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28764         void* o_ptr = untag_ptr(o);
28765         CHECK_ACCESS(o_ptr);
28766         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
28767         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
28768         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28769         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
28770         return tag_ptr(ret_conv, true);
28771 }
28772
28773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28774         void* e_ptr = untag_ptr(e);
28775         CHECK_ACCESS(e_ptr);
28776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28778         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28779         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
28780         return tag_ptr(ret_conv, true);
28781 }
28782
28783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28784         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
28785         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
28786         return ret_conv;
28787 }
28788
28789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28790         if (!ptr_is_owned(_res)) return;
28791         void* _res_ptr = untag_ptr(_res);
28792         CHECK_ACCESS(_res_ptr);
28793         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
28794         FREE(untag_ptr(_res));
28795         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
28796 }
28797
28798 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
28799         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28800         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
28801         return tag_ptr(ret_conv, true);
28802 }
28803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28804         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
28805         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
28806         return ret_conv;
28807 }
28808
28809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28810         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
28811         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28812         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
28813         return tag_ptr(ret_conv, true);
28814 }
28815
28816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28817         void* o_ptr = untag_ptr(o);
28818         CHECK_ACCESS(o_ptr);
28819         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
28820         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
28821                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28822                 LDKUtxoLookup_JCalls_cloned(&o_conv);
28823         }
28824         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
28825         *ret_copy = COption_UtxoLookupZ_some(o_conv);
28826         int64_t ret_ref = tag_ptr(ret_copy, true);
28827         return ret_ref;
28828 }
28829
28830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
28831         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
28832         *ret_copy = COption_UtxoLookupZ_none();
28833         int64_t ret_ref = tag_ptr(ret_copy, true);
28834         return ret_ref;
28835 }
28836
28837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28838         if (!ptr_is_owned(_res)) return;
28839         void* _res_ptr = untag_ptr(_res);
28840         CHECK_ACCESS(_res_ptr);
28841         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
28842         FREE(untag_ptr(_res));
28843         COption_UtxoLookupZ_free(_res_conv);
28844 }
28845
28846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
28847         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28848         *ret_conv = CResult_NoneLightningErrorZ_ok();
28849         return tag_ptr(ret_conv, true);
28850 }
28851
28852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28853         LDKLightningError e_conv;
28854         e_conv.inner = untag_ptr(e);
28855         e_conv.is_owned = ptr_is_owned(e);
28856         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28857         e_conv = LightningError_clone(&e_conv);
28858         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28859         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
28860         return tag_ptr(ret_conv, true);
28861 }
28862
28863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28864         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
28865         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
28866         return ret_conv;
28867 }
28868
28869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28870         if (!ptr_is_owned(_res)) return;
28871         void* _res_ptr = untag_ptr(_res);
28872         CHECK_ACCESS(_res_ptr);
28873         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
28874         FREE(untag_ptr(_res));
28875         CResult_NoneLightningErrorZ_free(_res_conv);
28876 }
28877
28878 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
28879         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28880         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
28881         return tag_ptr(ret_conv, true);
28882 }
28883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28884         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
28885         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
28886         return ret_conv;
28887 }
28888
28889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28890         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
28891         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28892         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
28893         return tag_ptr(ret_conv, true);
28894 }
28895
28896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
28897         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28898         *ret_conv = CResult_boolLightningErrorZ_ok(o);
28899         return tag_ptr(ret_conv, true);
28900 }
28901
28902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28903         LDKLightningError e_conv;
28904         e_conv.inner = untag_ptr(e);
28905         e_conv.is_owned = ptr_is_owned(e);
28906         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28907         e_conv = LightningError_clone(&e_conv);
28908         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28909         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
28910         return tag_ptr(ret_conv, true);
28911 }
28912
28913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28914         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
28915         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
28916         return ret_conv;
28917 }
28918
28919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28920         if (!ptr_is_owned(_res)) return;
28921         void* _res_ptr = untag_ptr(_res);
28922         CHECK_ACCESS(_res_ptr);
28923         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
28924         FREE(untag_ptr(_res));
28925         CResult_boolLightningErrorZ_free(_res_conv);
28926 }
28927
28928 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
28929         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28930         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
28931         return tag_ptr(ret_conv, true);
28932 }
28933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28934         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
28935         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
28936         return ret_conv;
28937 }
28938
28939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28940         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
28941         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28942         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
28943         return tag_ptr(ret_conv, true);
28944 }
28945
28946 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
28947         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28948         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
28949         return tag_ptr(ret_conv, true);
28950 }
28951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28952         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
28953         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
28954         return ret_conv;
28955 }
28956
28957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28958         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
28959         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28960         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
28961         return tag_ptr(ret_conv, true);
28962 }
28963
28964 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) {
28965         LDKChannelAnnouncement a_conv;
28966         a_conv.inner = untag_ptr(a);
28967         a_conv.is_owned = ptr_is_owned(a);
28968         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28969         a_conv = ChannelAnnouncement_clone(&a_conv);
28970         LDKChannelUpdate b_conv;
28971         b_conv.inner = untag_ptr(b);
28972         b_conv.is_owned = ptr_is_owned(b);
28973         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28974         b_conv = ChannelUpdate_clone(&b_conv);
28975         LDKChannelUpdate c_conv;
28976         c_conv.inner = untag_ptr(c);
28977         c_conv.is_owned = ptr_is_owned(c);
28978         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
28979         c_conv = ChannelUpdate_clone(&c_conv);
28980         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28981         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
28982         return tag_ptr(ret_conv, true);
28983 }
28984
28985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28986         if (!ptr_is_owned(_res)) return;
28987         void* _res_ptr = untag_ptr(_res);
28988         CHECK_ACCESS(_res_ptr);
28989         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
28990         FREE(untag_ptr(_res));
28991         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
28992 }
28993
28994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28995         void* o_ptr = untag_ptr(o);
28996         CHECK_ACCESS(o_ptr);
28997         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
28998         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
28999         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
29000         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
29001         int64_t ret_ref = tag_ptr(ret_copy, true);
29002         return ret_ref;
29003 }
29004
29005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
29006         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
29007         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
29008         int64_t ret_ref = tag_ptr(ret_copy, true);
29009         return ret_ref;
29010 }
29011
29012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29013         if (!ptr_is_owned(_res)) return;
29014         void* _res_ptr = untag_ptr(_res);
29015         CHECK_ACCESS(_res_ptr);
29016         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
29017         FREE(untag_ptr(_res));
29018         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
29019 }
29020
29021 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
29022         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
29023         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
29024         int64_t ret_ref = tag_ptr(ret_copy, true);
29025         return ret_ref;
29026 }
29027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29028         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
29029         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
29030         return ret_conv;
29031 }
29032
29033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29034         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
29035         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
29036         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
29037         int64_t ret_ref = tag_ptr(ret_copy, true);
29038         return ret_ref;
29039 }
29040
29041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29042         LDKCVec_MessageSendEventZ _res_constr;
29043         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29044         if (_res_constr.datalen > 0)
29045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
29046         else
29047                 _res_constr.data = NULL;
29048         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29049         for (size_t s = 0; s < _res_constr.datalen; s++) {
29050                 int64_t _res_conv_18 = _res_vals[s];
29051                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
29052                 CHECK_ACCESS(_res_conv_18_ptr);
29053                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
29054                 FREE(untag_ptr(_res_conv_18));
29055                 _res_constr.data[s] = _res_conv_18_conv;
29056         }
29057         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29058         CVec_MessageSendEventZ_free(_res_constr);
29059 }
29060
29061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29062         LDKChannelUpdateInfo o_conv;
29063         o_conv.inner = untag_ptr(o);
29064         o_conv.is_owned = ptr_is_owned(o);
29065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29066         o_conv = ChannelUpdateInfo_clone(&o_conv);
29067         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
29068         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
29069         return tag_ptr(ret_conv, true);
29070 }
29071
29072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29073         void* e_ptr = untag_ptr(e);
29074         CHECK_ACCESS(e_ptr);
29075         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29076         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29077         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
29078         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
29079         return tag_ptr(ret_conv, true);
29080 }
29081
29082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29083         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
29084         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
29085         return ret_conv;
29086 }
29087
29088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29089         if (!ptr_is_owned(_res)) return;
29090         void* _res_ptr = untag_ptr(_res);
29091         CHECK_ACCESS(_res_ptr);
29092         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
29093         FREE(untag_ptr(_res));
29094         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
29095 }
29096
29097 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
29098         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
29099         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
29100         return tag_ptr(ret_conv, true);
29101 }
29102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29103         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
29104         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
29105         return ret_conv;
29106 }
29107
29108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29109         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
29110         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
29111         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
29112         return tag_ptr(ret_conv, true);
29113 }
29114
29115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29116         LDKChannelInfo o_conv;
29117         o_conv.inner = untag_ptr(o);
29118         o_conv.is_owned = ptr_is_owned(o);
29119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29120         o_conv = ChannelInfo_clone(&o_conv);
29121         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
29122         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
29123         return tag_ptr(ret_conv, true);
29124 }
29125
29126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29127         void* e_ptr = untag_ptr(e);
29128         CHECK_ACCESS(e_ptr);
29129         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29130         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29131         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
29132         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
29133         return tag_ptr(ret_conv, true);
29134 }
29135
29136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29137         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
29138         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
29139         return ret_conv;
29140 }
29141
29142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29143         if (!ptr_is_owned(_res)) return;
29144         void* _res_ptr = untag_ptr(_res);
29145         CHECK_ACCESS(_res_ptr);
29146         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
29147         FREE(untag_ptr(_res));
29148         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
29149 }
29150
29151 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
29152         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
29153         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
29154         return tag_ptr(ret_conv, true);
29155 }
29156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29157         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
29158         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
29159         return ret_conv;
29160 }
29161
29162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29163         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
29164         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
29165         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
29166         return tag_ptr(ret_conv, true);
29167 }
29168
29169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29170         LDKRoutingFees o_conv;
29171         o_conv.inner = untag_ptr(o);
29172         o_conv.is_owned = ptr_is_owned(o);
29173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29174         o_conv = RoutingFees_clone(&o_conv);
29175         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
29176         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
29177         return tag_ptr(ret_conv, true);
29178 }
29179
29180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29181         void* e_ptr = untag_ptr(e);
29182         CHECK_ACCESS(e_ptr);
29183         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29184         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29185         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
29186         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
29187         return tag_ptr(ret_conv, true);
29188 }
29189
29190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29191         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
29192         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
29193         return ret_conv;
29194 }
29195
29196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29197         if (!ptr_is_owned(_res)) return;
29198         void* _res_ptr = untag_ptr(_res);
29199         CHECK_ACCESS(_res_ptr);
29200         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
29201         FREE(untag_ptr(_res));
29202         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
29203 }
29204
29205 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
29206         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
29207         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
29208         return tag_ptr(ret_conv, true);
29209 }
29210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29211         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
29212         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
29213         return ret_conv;
29214 }
29215
29216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29217         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
29218         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
29219         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
29220         return tag_ptr(ret_conv, true);
29221 }
29222
29223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29224         LDKCVec_SocketAddressZ _res_constr;
29225         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29226         if (_res_constr.datalen > 0)
29227                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
29228         else
29229                 _res_constr.data = NULL;
29230         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29231         for (size_t p = 0; p < _res_constr.datalen; p++) {
29232                 int64_t _res_conv_15 = _res_vals[p];
29233                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
29234                 CHECK_ACCESS(_res_conv_15_ptr);
29235                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
29236                 FREE(untag_ptr(_res_conv_15));
29237                 _res_constr.data[p] = _res_conv_15_conv;
29238         }
29239         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29240         CVec_SocketAddressZ_free(_res_constr);
29241 }
29242
29243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29244         LDKNodeAnnouncementInfo o_conv;
29245         o_conv.inner = untag_ptr(o);
29246         o_conv.is_owned = ptr_is_owned(o);
29247         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29248         o_conv = NodeAnnouncementInfo_clone(&o_conv);
29249         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29250         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
29251         return tag_ptr(ret_conv, true);
29252 }
29253
29254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29255         void* e_ptr = untag_ptr(e);
29256         CHECK_ACCESS(e_ptr);
29257         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29258         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29259         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29260         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
29261         return tag_ptr(ret_conv, true);
29262 }
29263
29264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29265         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
29266         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
29267         return ret_conv;
29268 }
29269
29270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29271         if (!ptr_is_owned(_res)) return;
29272         void* _res_ptr = untag_ptr(_res);
29273         CHECK_ACCESS(_res_ptr);
29274         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
29275         FREE(untag_ptr(_res));
29276         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
29277 }
29278
29279 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
29280         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29281         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
29282         return tag_ptr(ret_conv, true);
29283 }
29284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29285         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
29286         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
29287         return ret_conv;
29288 }
29289
29290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29291         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
29292         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29293         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
29294         return tag_ptr(ret_conv, true);
29295 }
29296
29297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29298         LDKNodeAlias o_conv;
29299         o_conv.inner = untag_ptr(o);
29300         o_conv.is_owned = ptr_is_owned(o);
29301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29302         o_conv = NodeAlias_clone(&o_conv);
29303         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29304         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
29305         return tag_ptr(ret_conv, true);
29306 }
29307
29308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29309         void* e_ptr = untag_ptr(e);
29310         CHECK_ACCESS(e_ptr);
29311         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29312         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29313         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29314         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
29315         return tag_ptr(ret_conv, true);
29316 }
29317
29318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29319         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
29320         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
29321         return ret_conv;
29322 }
29323
29324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29325         if (!ptr_is_owned(_res)) return;
29326         void* _res_ptr = untag_ptr(_res);
29327         CHECK_ACCESS(_res_ptr);
29328         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
29329         FREE(untag_ptr(_res));
29330         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
29331 }
29332
29333 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
29334         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29335         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
29336         return tag_ptr(ret_conv, true);
29337 }
29338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29339         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
29340         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
29341         return ret_conv;
29342 }
29343
29344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29345         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
29346         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29347         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
29348         return tag_ptr(ret_conv, true);
29349 }
29350
29351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29352         LDKNodeInfo o_conv;
29353         o_conv.inner = untag_ptr(o);
29354         o_conv.is_owned = ptr_is_owned(o);
29355         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29356         o_conv = NodeInfo_clone(&o_conv);
29357         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29358         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
29359         return tag_ptr(ret_conv, true);
29360 }
29361
29362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29363         void* e_ptr = untag_ptr(e);
29364         CHECK_ACCESS(e_ptr);
29365         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29366         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29367         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29368         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
29369         return tag_ptr(ret_conv, true);
29370 }
29371
29372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29373         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
29374         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
29375         return ret_conv;
29376 }
29377
29378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29379         if (!ptr_is_owned(_res)) return;
29380         void* _res_ptr = untag_ptr(_res);
29381         CHECK_ACCESS(_res_ptr);
29382         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
29383         FREE(untag_ptr(_res));
29384         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
29385 }
29386
29387 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
29388         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29389         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
29390         return tag_ptr(ret_conv, true);
29391 }
29392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29393         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
29394         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
29395         return ret_conv;
29396 }
29397
29398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29399         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
29400         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29401         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
29402         return tag_ptr(ret_conv, true);
29403 }
29404
29405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29406         LDKNetworkGraph o_conv;
29407         o_conv.inner = untag_ptr(o);
29408         o_conv.is_owned = ptr_is_owned(o);
29409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29410         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
29411         
29412         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29413         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
29414         return tag_ptr(ret_conv, true);
29415 }
29416
29417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29418         void* e_ptr = untag_ptr(e);
29419         CHECK_ACCESS(e_ptr);
29420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29422         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29423         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
29424         return tag_ptr(ret_conv, true);
29425 }
29426
29427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29428         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
29429         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
29430         return ret_conv;
29431 }
29432
29433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29434         if (!ptr_is_owned(_res)) return;
29435         void* _res_ptr = untag_ptr(_res);
29436         CHECK_ACCESS(_res_ptr);
29437         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
29438         FREE(untag_ptr(_res));
29439         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
29440 }
29441
29442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
29443         LDKCVec_SocketAddressZ o_constr;
29444         o_constr.datalen = (*env)->GetArrayLength(env, o);
29445         if (o_constr.datalen > 0)
29446                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
29447         else
29448                 o_constr.data = NULL;
29449         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
29450         for (size_t p = 0; p < o_constr.datalen; p++) {
29451                 int64_t o_conv_15 = o_vals[p];
29452                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
29453                 CHECK_ACCESS(o_conv_15_ptr);
29454                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
29455                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
29456                 o_constr.data[p] = o_conv_15_conv;
29457         }
29458         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
29459         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29460         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
29461         int64_t ret_ref = tag_ptr(ret_copy, true);
29462         return ret_ref;
29463 }
29464
29465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
29466         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29467         *ret_copy = COption_CVec_SocketAddressZZ_none();
29468         int64_t ret_ref = tag_ptr(ret_copy, true);
29469         return ret_ref;
29470 }
29471
29472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29473         if (!ptr_is_owned(_res)) return;
29474         void* _res_ptr = untag_ptr(_res);
29475         CHECK_ACCESS(_res_ptr);
29476         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
29477         FREE(untag_ptr(_res));
29478         COption_CVec_SocketAddressZZ_free(_res_conv);
29479 }
29480
29481 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
29482         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29483         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
29484         int64_t ret_ref = tag_ptr(ret_copy, true);
29485         return ret_ref;
29486 }
29487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29488         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
29489         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
29490         return ret_conv;
29491 }
29492
29493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29494         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
29495         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29496         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
29497         int64_t ret_ref = tag_ptr(ret_copy, true);
29498         return ret_ref;
29499 }
29500
29501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29502         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
29503         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
29504         return tag_ptr(ret_conv, true);
29505 }
29506
29507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
29508         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_java(env, e);
29509         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
29510         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
29511         return tag_ptr(ret_conv, true);
29512 }
29513
29514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29515         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
29516         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
29517         return ret_conv;
29518 }
29519
29520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29521         if (!ptr_is_owned(_res)) return;
29522         void* _res_ptr = untag_ptr(_res);
29523         CHECK_ACCESS(_res_ptr);
29524         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
29525         FREE(untag_ptr(_res));
29526         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
29527 }
29528
29529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29530         LDKPendingHTLCInfo o_conv;
29531         o_conv.inner = untag_ptr(o);
29532         o_conv.is_owned = ptr_is_owned(o);
29533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29534         o_conv = PendingHTLCInfo_clone(&o_conv);
29535         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29536         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
29537         return tag_ptr(ret_conv, true);
29538 }
29539
29540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29541         LDKInboundHTLCErr e_conv;
29542         e_conv.inner = untag_ptr(e);
29543         e_conv.is_owned = ptr_is_owned(e);
29544         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
29545         e_conv = InboundHTLCErr_clone(&e_conv);
29546         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29547         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
29548         return tag_ptr(ret_conv, true);
29549 }
29550
29551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29552         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
29553         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
29554         return ret_conv;
29555 }
29556
29557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29558         if (!ptr_is_owned(_res)) return;
29559         void* _res_ptr = untag_ptr(_res);
29560         CHECK_ACCESS(_res_ptr);
29561         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
29562         FREE(untag_ptr(_res));
29563         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
29564 }
29565
29566 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
29567         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29568         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
29569         return tag_ptr(ret_conv, true);
29570 }
29571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29572         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
29573         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
29574         return ret_conv;
29575 }
29576
29577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29578         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
29579         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29580         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
29581         return tag_ptr(ret_conv, true);
29582 }
29583
29584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29585         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
29586         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29587         if (_res_constr.datalen > 0)
29588                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
29589         else
29590                 _res_constr.data = NULL;
29591         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29592         for (size_t y = 0; y < _res_constr.datalen; y++) {
29593                 int64_t _res_conv_24 = _res_vals[y];
29594                 LDKHTLCOutputInCommitment _res_conv_24_conv;
29595                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
29596                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
29597                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
29598                 _res_constr.data[y] = _res_conv_24_conv;
29599         }
29600         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29601         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
29602 }
29603
29604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29605         LDKCVec_HTLCDescriptorZ _res_constr;
29606         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29607         if (_res_constr.datalen > 0)
29608                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
29609         else
29610                 _res_constr.data = NULL;
29611         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29612         for (size_t q = 0; q < _res_constr.datalen; q++) {
29613                 int64_t _res_conv_16 = _res_vals[q];
29614                 LDKHTLCDescriptor _res_conv_16_conv;
29615                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
29616                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
29617                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
29618                 _res_constr.data[q] = _res_conv_16_conv;
29619         }
29620         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29621         CVec_HTLCDescriptorZ_free(_res_constr);
29622 }
29623
29624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29625         LDKCVec_UtxoZ _res_constr;
29626         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29627         if (_res_constr.datalen > 0)
29628                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
29629         else
29630                 _res_constr.data = NULL;
29631         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29632         for (size_t g = 0; g < _res_constr.datalen; g++) {
29633                 int64_t _res_conv_6 = _res_vals[g];
29634                 LDKUtxo _res_conv_6_conv;
29635                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
29636                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
29637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
29638                 _res_constr.data[g] = _res_conv_6_conv;
29639         }
29640         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29641         CVec_UtxoZ_free(_res_constr);
29642 }
29643
29644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29645         void* o_ptr = untag_ptr(o);
29646         CHECK_ACCESS(o_ptr);
29647         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
29648         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
29649         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29650         *ret_copy = COption_TxOutZ_some(o_conv);
29651         int64_t ret_ref = tag_ptr(ret_copy, true);
29652         return ret_ref;
29653 }
29654
29655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
29656         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29657         *ret_copy = COption_TxOutZ_none();
29658         int64_t ret_ref = tag_ptr(ret_copy, true);
29659         return ret_ref;
29660 }
29661
29662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29663         if (!ptr_is_owned(_res)) return;
29664         void* _res_ptr = untag_ptr(_res);
29665         CHECK_ACCESS(_res_ptr);
29666         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
29667         FREE(untag_ptr(_res));
29668         COption_TxOutZ_free(_res_conv);
29669 }
29670
29671 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
29672         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29673         *ret_copy = COption_TxOutZ_clone(arg);
29674         int64_t ret_ref = tag_ptr(ret_copy, true);
29675         return ret_ref;
29676 }
29677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29678         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
29679         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
29680         return ret_conv;
29681 }
29682
29683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29684         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
29685         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29686         *ret_copy = COption_TxOutZ_clone(orig_conv);
29687         int64_t ret_ref = tag_ptr(ret_copy, true);
29688         return ret_ref;
29689 }
29690
29691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29692         LDKCVec_InputZ _res_constr;
29693         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29694         if (_res_constr.datalen > 0)
29695                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
29696         else
29697                 _res_constr.data = NULL;
29698         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29699         for (size_t h = 0; h < _res_constr.datalen; h++) {
29700                 int64_t _res_conv_7 = _res_vals[h];
29701                 LDKInput _res_conv_7_conv;
29702                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
29703                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
29704                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
29705                 _res_constr.data[h] = _res_conv_7_conv;
29706         }
29707         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29708         CVec_InputZ_free(_res_constr);
29709 }
29710
29711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29712         LDKCoinSelection o_conv;
29713         o_conv.inner = untag_ptr(o);
29714         o_conv.is_owned = ptr_is_owned(o);
29715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29716         o_conv = CoinSelection_clone(&o_conv);
29717         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29718         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
29719         return tag_ptr(ret_conv, true);
29720 }
29721
29722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
29723         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29724         *ret_conv = CResult_CoinSelectionNoneZ_err();
29725         return tag_ptr(ret_conv, true);
29726 }
29727
29728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29729         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
29730         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
29731         return ret_conv;
29732 }
29733
29734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29735         if (!ptr_is_owned(_res)) return;
29736         void* _res_ptr = untag_ptr(_res);
29737         CHECK_ACCESS(_res_ptr);
29738         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
29739         FREE(untag_ptr(_res));
29740         CResult_CoinSelectionNoneZ_free(_res_conv);
29741 }
29742
29743 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
29744         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29745         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
29746         return tag_ptr(ret_conv, true);
29747 }
29748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29749         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
29750         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
29751         return ret_conv;
29752 }
29753
29754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29755         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
29756         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29757         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
29758         return tag_ptr(ret_conv, true);
29759 }
29760
29761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
29762         LDKCVec_UtxoZ o_constr;
29763         o_constr.datalen = (*env)->GetArrayLength(env, o);
29764         if (o_constr.datalen > 0)
29765                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
29766         else
29767                 o_constr.data = NULL;
29768         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
29769         for (size_t g = 0; g < o_constr.datalen; g++) {
29770                 int64_t o_conv_6 = o_vals[g];
29771                 LDKUtxo o_conv_6_conv;
29772                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
29773                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
29774                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
29775                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
29776                 o_constr.data[g] = o_conv_6_conv;
29777         }
29778         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
29779         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29780         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
29781         return tag_ptr(ret_conv, true);
29782 }
29783
29784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
29785         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29786         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
29787         return tag_ptr(ret_conv, true);
29788 }
29789
29790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29791         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
29792         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
29793         return ret_conv;
29794 }
29795
29796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29797         if (!ptr_is_owned(_res)) return;
29798         void* _res_ptr = untag_ptr(_res);
29799         CHECK_ACCESS(_res_ptr);
29800         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
29801         FREE(untag_ptr(_res));
29802         CResult_CVec_UtxoZNoneZ_free(_res_conv);
29803 }
29804
29805 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
29806         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29807         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
29808         return tag_ptr(ret_conv, true);
29809 }
29810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29811         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
29812         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
29813         return ret_conv;
29814 }
29815
29816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29817         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
29818         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29819         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
29820         return tag_ptr(ret_conv, true);
29821 }
29822
29823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29824         void* o_ptr = untag_ptr(o);
29825         CHECK_ACCESS(o_ptr);
29826         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
29827         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
29828         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29829         *ret_copy = COption_PaymentContextZ_some(o_conv);
29830         int64_t ret_ref = tag_ptr(ret_copy, true);
29831         return ret_ref;
29832 }
29833
29834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1none(JNIEnv *env, jclass clz) {
29835         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29836         *ret_copy = COption_PaymentContextZ_none();
29837         int64_t ret_ref = tag_ptr(ret_copy, true);
29838         return ret_ref;
29839 }
29840
29841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29842         if (!ptr_is_owned(_res)) return;
29843         void* _res_ptr = untag_ptr(_res);
29844         CHECK_ACCESS(_res_ptr);
29845         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
29846         FREE(untag_ptr(_res));
29847         COption_PaymentContextZ_free(_res_conv);
29848 }
29849
29850 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
29851         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29852         *ret_copy = COption_PaymentContextZ_clone(arg);
29853         int64_t ret_ref = tag_ptr(ret_copy, true);
29854         return ret_ref;
29855 }
29856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29857         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
29858         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
29859         return ret_conv;
29860 }
29861
29862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29863         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
29864         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29865         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
29866         int64_t ret_ref = tag_ptr(ret_copy, true);
29867         return ret_ref;
29868 }
29869
29870 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
29871         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29872         *ret_conv = C2Tuple_u64u16Z_clone(arg);
29873         return tag_ptr(ret_conv, true);
29874 }
29875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29876         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
29877         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
29878         return ret_conv;
29879 }
29880
29881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29882         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
29883         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29884         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
29885         return tag_ptr(ret_conv, true);
29886 }
29887
29888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
29889         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29890         *ret_conv = C2Tuple_u64u16Z_new(a, b);
29891         return tag_ptr(ret_conv, true);
29892 }
29893
29894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
29895         if (!ptr_is_owned(_res)) return;
29896         void* _res_ptr = untag_ptr(_res);
29897         CHECK_ACCESS(_res_ptr);
29898         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
29899         FREE(untag_ptr(_res));
29900         C2Tuple_u64u16Z_free(_res_conv);
29901 }
29902
29903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29904         void* o_ptr = untag_ptr(o);
29905         CHECK_ACCESS(o_ptr);
29906         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
29907         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
29908         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29909         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
29910         int64_t ret_ref = tag_ptr(ret_copy, true);
29911         return ret_ref;
29912 }
29913
29914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
29915         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29916         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
29917         int64_t ret_ref = tag_ptr(ret_copy, true);
29918         return ret_ref;
29919 }
29920
29921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29922         if (!ptr_is_owned(_res)) return;
29923         void* _res_ptr = untag_ptr(_res);
29924         CHECK_ACCESS(_res_ptr);
29925         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
29926         FREE(untag_ptr(_res));
29927         COption_C2Tuple_u64u16ZZ_free(_res_conv);
29928 }
29929
29930 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
29931         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29932         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
29933         int64_t ret_ref = tag_ptr(ret_copy, true);
29934         return ret_ref;
29935 }
29936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29937         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
29938         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
29939         return ret_conv;
29940 }
29941
29942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29943         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
29944         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29945         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
29946         int64_t ret_ref = tag_ptr(ret_copy, true);
29947         return ret_ref;
29948 }
29949
29950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29951         LDKChannelId o_conv;
29952         o_conv.inner = untag_ptr(o);
29953         o_conv.is_owned = ptr_is_owned(o);
29954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29955         o_conv = ChannelId_clone(&o_conv);
29956         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29957         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
29958         return tag_ptr(ret_conv, true);
29959 }
29960
29961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29962         void* e_ptr = untag_ptr(e);
29963         CHECK_ACCESS(e_ptr);
29964         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
29965         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
29966         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29967         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
29968         return tag_ptr(ret_conv, true);
29969 }
29970
29971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29972         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
29973         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
29974         return ret_conv;
29975 }
29976
29977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29978         if (!ptr_is_owned(_res)) return;
29979         void* _res_ptr = untag_ptr(_res);
29980         CHECK_ACCESS(_res_ptr);
29981         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
29982         FREE(untag_ptr(_res));
29983         CResult_ChannelIdAPIErrorZ_free(_res_conv);
29984 }
29985
29986 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
29987         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29988         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
29989         return tag_ptr(ret_conv, true);
29990 }
29991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29992         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
29993         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
29994         return ret_conv;
29995 }
29996
29997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29998         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
29999         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
30000         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
30001         return tag_ptr(ret_conv, true);
30002 }
30003
30004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30005         LDKCVec_RecentPaymentDetailsZ _res_constr;
30006         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30007         if (_res_constr.datalen > 0)
30008                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
30009         else
30010                 _res_constr.data = NULL;
30011         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30012         for (size_t w = 0; w < _res_constr.datalen; w++) {
30013                 int64_t _res_conv_22 = _res_vals[w];
30014                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
30015                 CHECK_ACCESS(_res_conv_22_ptr);
30016                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
30017                 FREE(untag_ptr(_res_conv_22));
30018                 _res_constr.data[w] = _res_conv_22_conv;
30019         }
30020         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30021         CVec_RecentPaymentDetailsZ_free(_res_constr);
30022 }
30023
30024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
30025         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30026         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
30027         return tag_ptr(ret_conv, true);
30028 }
30029
30030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30031         void* e_ptr = untag_ptr(e);
30032         CHECK_ACCESS(e_ptr);
30033         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
30034         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
30035         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30036         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
30037         return tag_ptr(ret_conv, true);
30038 }
30039
30040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30041         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
30042         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
30043         return ret_conv;
30044 }
30045
30046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30047         if (!ptr_is_owned(_res)) return;
30048         void* _res_ptr = untag_ptr(_res);
30049         CHECK_ACCESS(_res_ptr);
30050         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
30051         FREE(untag_ptr(_res));
30052         CResult_NonePaymentSendFailureZ_free(_res_conv);
30053 }
30054
30055 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
30056         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30057         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
30058         return tag_ptr(ret_conv, true);
30059 }
30060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30061         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
30062         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
30063         return ret_conv;
30064 }
30065
30066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30067         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
30068         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
30069         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
30070         return tag_ptr(ret_conv, true);
30071 }
30072
30073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
30074         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
30075         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
30076         return tag_ptr(ret_conv, true);
30077 }
30078
30079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
30080         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
30081         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
30082         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
30083         return tag_ptr(ret_conv, true);
30084 }
30085
30086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30087         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
30088         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
30089         return ret_conv;
30090 }
30091
30092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30093         if (!ptr_is_owned(_res)) return;
30094         void* _res_ptr = untag_ptr(_res);
30095         CHECK_ACCESS(_res_ptr);
30096         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
30097         FREE(untag_ptr(_res));
30098         CResult_NoneRetryableSendFailureZ_free(_res_conv);
30099 }
30100
30101 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
30102         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
30103         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
30104         return tag_ptr(ret_conv, true);
30105 }
30106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30107         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
30108         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
30109         return ret_conv;
30110 }
30111
30112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30113         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
30114         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
30115         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
30116         return tag_ptr(ret_conv, true);
30117 }
30118
30119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30120         LDKThirtyTwoBytes o_ref;
30121         CHECK((*env)->GetArrayLength(env, o) == 32);
30122         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30123         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
30124         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
30125         return tag_ptr(ret_conv, true);
30126 }
30127
30128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30129         void* e_ptr = untag_ptr(e);
30130         CHECK_ACCESS(e_ptr);
30131         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
30132         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
30133         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
30134         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
30135         return tag_ptr(ret_conv, true);
30136 }
30137
30138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30139         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
30140         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
30141         return ret_conv;
30142 }
30143
30144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30145         if (!ptr_is_owned(_res)) return;
30146         void* _res_ptr = untag_ptr(_res);
30147         CHECK_ACCESS(_res_ptr);
30148         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
30149         FREE(untag_ptr(_res));
30150         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
30151 }
30152
30153 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
30154         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
30155         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
30156         return tag_ptr(ret_conv, true);
30157 }
30158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30159         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
30160         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
30161         return ret_conv;
30162 }
30163
30164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30165         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
30166         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
30167         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
30168         return tag_ptr(ret_conv, true);
30169 }
30170
30171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30172         LDKThirtyTwoBytes o_ref;
30173         CHECK((*env)->GetArrayLength(env, o) == 32);
30174         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30175         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
30176         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
30177         return tag_ptr(ret_conv, true);
30178 }
30179
30180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
30181         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
30182         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
30183         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
30184         return tag_ptr(ret_conv, true);
30185 }
30186
30187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30188         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
30189         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
30190         return ret_conv;
30191 }
30192
30193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30194         if (!ptr_is_owned(_res)) return;
30195         void* _res_ptr = untag_ptr(_res);
30196         CHECK_ACCESS(_res_ptr);
30197         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
30198         FREE(untag_ptr(_res));
30199         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
30200 }
30201
30202 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
30203         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
30204         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
30205         return tag_ptr(ret_conv, true);
30206 }
30207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30208         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
30209         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
30210         return ret_conv;
30211 }
30212
30213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30214         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
30215         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
30216         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
30217         return tag_ptr(ret_conv, true);
30218 }
30219
30220 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
30221         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30222         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
30223         return tag_ptr(ret_conv, true);
30224 }
30225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30226         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
30227         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
30228         return ret_conv;
30229 }
30230
30231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30232         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
30233         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30234         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
30235         return tag_ptr(ret_conv, true);
30236 }
30237
30238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
30239         LDKThirtyTwoBytes a_ref;
30240         CHECK((*env)->GetArrayLength(env, a) == 32);
30241         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
30242         LDKThirtyTwoBytes b_ref;
30243         CHECK((*env)->GetArrayLength(env, b) == 32);
30244         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
30245         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30246         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
30247         return tag_ptr(ret_conv, true);
30248 }
30249
30250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30251         if (!ptr_is_owned(_res)) return;
30252         void* _res_ptr = untag_ptr(_res);
30253         CHECK_ACCESS(_res_ptr);
30254         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
30255         FREE(untag_ptr(_res));
30256         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
30257 }
30258
30259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30260         void* o_ptr = untag_ptr(o);
30261         CHECK_ACCESS(o_ptr);
30262         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
30263         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
30264         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30265         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
30266         return tag_ptr(ret_conv, true);
30267 }
30268
30269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30270         void* e_ptr = untag_ptr(e);
30271         CHECK_ACCESS(e_ptr);
30272         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
30273         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
30274         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30275         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
30276         return tag_ptr(ret_conv, true);
30277 }
30278
30279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30280         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
30281         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
30282         return ret_conv;
30283 }
30284
30285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30286         if (!ptr_is_owned(_res)) return;
30287         void* _res_ptr = untag_ptr(_res);
30288         CHECK_ACCESS(_res_ptr);
30289         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
30290         FREE(untag_ptr(_res));
30291         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
30292 }
30293
30294 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
30295         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30296         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
30297         return tag_ptr(ret_conv, true);
30298 }
30299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30300         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
30301         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
30302         return ret_conv;
30303 }
30304
30305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30306         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
30307         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30308         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
30309         return tag_ptr(ret_conv, true);
30310 }
30311
30312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30313         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
30314         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30315         if (_res_constr.datalen > 0)
30316                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
30317         else
30318                 _res_constr.data = NULL;
30319         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30320         for (size_t o = 0; o < _res_constr.datalen; o++) {
30321                 int64_t _res_conv_40 = _res_vals[o];
30322                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
30323                 CHECK_ACCESS(_res_conv_40_ptr);
30324                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
30325                 FREE(untag_ptr(_res_conv_40));
30326                 _res_constr.data[o] = _res_conv_40_conv;
30327         }
30328         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30329         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
30330 }
30331
30332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30333         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
30334         o_constr.datalen = (*env)->GetArrayLength(env, o);
30335         if (o_constr.datalen > 0)
30336                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
30337         else
30338                 o_constr.data = NULL;
30339         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30340         for (size_t o = 0; o < o_constr.datalen; o++) {
30341                 int64_t o_conv_40 = o_vals[o];
30342                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
30343                 CHECK_ACCESS(o_conv_40_ptr);
30344                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
30345                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
30346                 o_constr.data[o] = o_conv_40_conv;
30347         }
30348         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30349         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30350         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
30351         return tag_ptr(ret_conv, true);
30352 }
30353
30354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30355         void* e_ptr = untag_ptr(e);
30356         CHECK_ACCESS(e_ptr);
30357         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
30358         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
30359         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30360         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
30361         return tag_ptr(ret_conv, true);
30362 }
30363
30364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30365         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
30366         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
30367         return ret_conv;
30368 }
30369
30370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30371         if (!ptr_is_owned(_res)) return;
30372         void* _res_ptr = untag_ptr(_res);
30373         CHECK_ACCESS(_res_ptr);
30374         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
30375         FREE(untag_ptr(_res));
30376         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
30377 }
30378
30379 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
30380         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30381         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
30382         return tag_ptr(ret_conv, true);
30383 }
30384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30385         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
30386         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
30387         return ret_conv;
30388 }
30389
30390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30391         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
30392         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30393         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
30394         return tag_ptr(ret_conv, true);
30395 }
30396
30397 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
30398         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30399         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
30400         return tag_ptr(ret_conv, true);
30401 }
30402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30403         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
30404         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
30405         return ret_conv;
30406 }
30407
30408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30409         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
30410         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30411         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
30412         return tag_ptr(ret_conv, true);
30413 }
30414
30415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
30416         LDKChannelId a_conv;
30417         a_conv.inner = untag_ptr(a);
30418         a_conv.is_owned = ptr_is_owned(a);
30419         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30420         a_conv = ChannelId_clone(&a_conv);
30421         LDKPublicKey b_ref;
30422         CHECK((*env)->GetArrayLength(env, b) == 33);
30423         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
30424         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30425         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
30426         return tag_ptr(ret_conv, true);
30427 }
30428
30429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30430         if (!ptr_is_owned(_res)) return;
30431         void* _res_ptr = untag_ptr(_res);
30432         CHECK_ACCESS(_res_ptr);
30433         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
30434         FREE(untag_ptr(_res));
30435         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
30436 }
30437
30438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ChannelIdPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30439         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
30440         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30441         if (_res_constr.datalen > 0)
30442                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
30443         else
30444                 _res_constr.data = NULL;
30445         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30446         for (size_t e = 0; e < _res_constr.datalen; e++) {
30447                 int64_t _res_conv_30 = _res_vals[e];
30448                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
30449                 CHECK_ACCESS(_res_conv_30_ptr);
30450                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
30451                 FREE(untag_ptr(_res_conv_30));
30452                 _res_constr.data[e] = _res_conv_30_conv;
30453         }
30454         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30455         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
30456 }
30457
30458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30459         LDKCVec_ChannelIdZ _res_constr;
30460         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30461         if (_res_constr.datalen > 0)
30462                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
30463         else
30464                 _res_constr.data = NULL;
30465         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30466         for (size_t l = 0; l < _res_constr.datalen; l++) {
30467                 int64_t _res_conv_11 = _res_vals[l];
30468                 LDKChannelId _res_conv_11_conv;
30469                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
30470                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
30471                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
30472                 _res_constr.data[l] = _res_conv_11_conv;
30473         }
30474         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30475         CVec_ChannelIdZ_free(_res_constr);
30476 }
30477
30478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30479         LDKOfferWithDerivedMetadataBuilder o_conv;
30480         o_conv.inner = untag_ptr(o);
30481         o_conv.is_owned = ptr_is_owned(o);
30482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30483         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
30484         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30485         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
30486         return tag_ptr(ret_conv, true);
30487 }
30488
30489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30490         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
30491         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30492         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
30493         return tag_ptr(ret_conv, true);
30494 }
30495
30496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30497         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
30498         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
30499         return ret_conv;
30500 }
30501
30502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
30507         FREE(untag_ptr(_res));
30508         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
30509 }
30510
30511 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
30512         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30513         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
30514         return tag_ptr(ret_conv, true);
30515 }
30516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30517         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
30518         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
30519         return ret_conv;
30520 }
30521
30522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30523         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
30524         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30525         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
30526         return tag_ptr(ret_conv, true);
30527 }
30528
30529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
30530         LDKStr o_conv = java_to_owned_str(env, o);
30531         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30532         *ret_copy = COption_StrZ_some(o_conv);
30533         int64_t ret_ref = tag_ptr(ret_copy, true);
30534         return ret_ref;
30535 }
30536
30537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
30538         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30539         *ret_copy = COption_StrZ_none();
30540         int64_t ret_ref = tag_ptr(ret_copy, true);
30541         return ret_ref;
30542 }
30543
30544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30545         if (!ptr_is_owned(_res)) return;
30546         void* _res_ptr = untag_ptr(_res);
30547         CHECK_ACCESS(_res_ptr);
30548         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
30549         FREE(untag_ptr(_res));
30550         COption_StrZ_free(_res_conv);
30551 }
30552
30553 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
30554         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30555         *ret_copy = COption_StrZ_clone(arg);
30556         int64_t ret_ref = tag_ptr(ret_copy, true);
30557         return ret_ref;
30558 }
30559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30560         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
30561         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
30562         return ret_conv;
30563 }
30564
30565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30566         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
30567         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30568         *ret_copy = COption_StrZ_clone(orig_conv);
30569         int64_t ret_ref = tag_ptr(ret_copy, true);
30570         return ret_ref;
30571 }
30572
30573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30574         void* o_ptr = untag_ptr(o);
30575         CHECK_ACCESS(o_ptr);
30576         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
30577         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
30578         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30579         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
30580         return tag_ptr(ret_conv, true);
30581 }
30582
30583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
30584         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30585         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
30586         return tag_ptr(ret_conv, true);
30587 }
30588
30589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30590         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
30591         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
30592         return ret_conv;
30593 }
30594
30595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30596         if (!ptr_is_owned(_res)) return;
30597         void* _res_ptr = untag_ptr(_res);
30598         CHECK_ACCESS(_res_ptr);
30599         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
30600         FREE(untag_ptr(_res));
30601         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
30602 }
30603
30604 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
30605         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30606         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
30607         return tag_ptr(ret_conv, true);
30608 }
30609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30610         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
30611         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
30612         return ret_conv;
30613 }
30614
30615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30616         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
30617         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30618         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
30619         return tag_ptr(ret_conv, true);
30620 }
30621
30622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30623         LDKThirtyTwoBytes o_ref;
30624         CHECK((*env)->GetArrayLength(env, o) == 32);
30625         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30626         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30627         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
30628         return tag_ptr(ret_conv, true);
30629 }
30630
30631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30632         void* e_ptr = untag_ptr(e);
30633         CHECK_ACCESS(e_ptr);
30634         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
30635         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
30636         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30637         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
30638         return tag_ptr(ret_conv, true);
30639 }
30640
30641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30642         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
30643         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
30644         return ret_conv;
30645 }
30646
30647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30648         if (!ptr_is_owned(_res)) return;
30649         void* _res_ptr = untag_ptr(_res);
30650         CHECK_ACCESS(_res_ptr);
30651         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
30652         FREE(untag_ptr(_res));
30653         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
30654 }
30655
30656 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
30657         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30658         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
30659         return tag_ptr(ret_conv, true);
30660 }
30661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30662         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
30663         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
30664         return ret_conv;
30665 }
30666
30667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30668         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
30669         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30670         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
30671         return tag_ptr(ret_conv, true);
30672 }
30673
30674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30675         void* o_ptr = untag_ptr(o);
30676         CHECK_ACCESS(o_ptr);
30677         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
30678         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
30679         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30680         *ret_copy = COption_OffersMessageZ_some(o_conv);
30681         int64_t ret_ref = tag_ptr(ret_copy, true);
30682         return ret_ref;
30683 }
30684
30685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
30686         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30687         *ret_copy = COption_OffersMessageZ_none();
30688         int64_t ret_ref = tag_ptr(ret_copy, true);
30689         return ret_ref;
30690 }
30691
30692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30693         if (!ptr_is_owned(_res)) return;
30694         void* _res_ptr = untag_ptr(_res);
30695         CHECK_ACCESS(_res_ptr);
30696         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
30697         FREE(untag_ptr(_res));
30698         COption_OffersMessageZ_free(_res_conv);
30699 }
30700
30701 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
30702         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30703         *ret_copy = COption_OffersMessageZ_clone(arg);
30704         int64_t ret_ref = tag_ptr(ret_copy, true);
30705         return ret_ref;
30706 }
30707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30708         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
30709         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
30710         return ret_conv;
30711 }
30712
30713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30714         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
30715         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30716         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
30717         int64_t ret_ref = tag_ptr(ret_copy, true);
30718         return ret_ref;
30719 }
30720
30721 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
30722         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30723         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
30724         return tag_ptr(ret_conv, true);
30725 }
30726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30727         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
30728         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
30729         return ret_conv;
30730 }
30731
30732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30733         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
30734         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30735         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
30736         return tag_ptr(ret_conv, true);
30737 }
30738
30739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
30740         void* a_ptr = untag_ptr(a);
30741         CHECK_ACCESS(a_ptr);
30742         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
30743         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
30744         void* b_ptr = untag_ptr(b);
30745         CHECK_ACCESS(b_ptr);
30746         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
30747         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
30748         LDKBlindedPath c_conv;
30749         c_conv.inner = untag_ptr(c);
30750         c_conv.is_owned = ptr_is_owned(c);
30751         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30752         c_conv = BlindedPath_clone(&c_conv);
30753         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30754         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
30755         return tag_ptr(ret_conv, true);
30756 }
30757
30758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30759         if (!ptr_is_owned(_res)) return;
30760         void* _res_ptr = untag_ptr(_res);
30761         CHECK_ACCESS(_res_ptr);
30762         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
30763         FREE(untag_ptr(_res));
30764         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
30765 }
30766
30767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30768         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
30769         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30770         if (_res_constr.datalen > 0)
30771                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
30772         else
30773                 _res_constr.data = NULL;
30774         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30775         for (size_t x = 0; x < _res_constr.datalen; x++) {
30776                 int64_t _res_conv_49 = _res_vals[x];
30777                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
30778                 CHECK_ACCESS(_res_conv_49_ptr);
30779                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
30780                 FREE(untag_ptr(_res_conv_49));
30781                 _res_constr.data[x] = _res_conv_49_conv;
30782         }
30783         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30784         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
30785 }
30786
30787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30788         LDKPhantomRouteHints o_conv;
30789         o_conv.inner = untag_ptr(o);
30790         o_conv.is_owned = ptr_is_owned(o);
30791         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30792         o_conv = PhantomRouteHints_clone(&o_conv);
30793         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30794         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
30795         return tag_ptr(ret_conv, true);
30796 }
30797
30798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30799         void* e_ptr = untag_ptr(e);
30800         CHECK_ACCESS(e_ptr);
30801         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30802         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30803         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30804         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
30805         return tag_ptr(ret_conv, true);
30806 }
30807
30808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30809         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
30810         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
30811         return ret_conv;
30812 }
30813
30814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30815         if (!ptr_is_owned(_res)) return;
30816         void* _res_ptr = untag_ptr(_res);
30817         CHECK_ACCESS(_res_ptr);
30818         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
30819         FREE(untag_ptr(_res));
30820         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
30821 }
30822
30823 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
30824         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30825         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
30826         return tag_ptr(ret_conv, true);
30827 }
30828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30829         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
30830         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
30831         return ret_conv;
30832 }
30833
30834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30835         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
30836         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30837         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
30838         return tag_ptr(ret_conv, true);
30839 }
30840
30841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30842         LDKBlindedForward o_conv;
30843         o_conv.inner = untag_ptr(o);
30844         o_conv.is_owned = ptr_is_owned(o);
30845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30846         o_conv = BlindedForward_clone(&o_conv);
30847         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30848         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
30849         return tag_ptr(ret_conv, true);
30850 }
30851
30852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30853         void* e_ptr = untag_ptr(e);
30854         CHECK_ACCESS(e_ptr);
30855         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30856         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30857         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30858         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
30859         return tag_ptr(ret_conv, true);
30860 }
30861
30862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30863         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
30864         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
30865         return ret_conv;
30866 }
30867
30868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30869         if (!ptr_is_owned(_res)) return;
30870         void* _res_ptr = untag_ptr(_res);
30871         CHECK_ACCESS(_res_ptr);
30872         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
30873         FREE(untag_ptr(_res));
30874         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
30875 }
30876
30877 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
30878         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30879         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
30880         return tag_ptr(ret_conv, true);
30881 }
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30883         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
30884         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
30885         return ret_conv;
30886 }
30887
30888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30889         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
30890         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30891         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
30892         return tag_ptr(ret_conv, true);
30893 }
30894
30895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30896         void* o_ptr = untag_ptr(o);
30897         CHECK_ACCESS(o_ptr);
30898         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
30899         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
30900         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30901         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
30902         return tag_ptr(ret_conv, true);
30903 }
30904
30905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30906         void* e_ptr = untag_ptr(e);
30907         CHECK_ACCESS(e_ptr);
30908         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30909         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30910         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30911         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
30912         return tag_ptr(ret_conv, true);
30913 }
30914
30915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30916         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
30917         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
30918         return ret_conv;
30919 }
30920
30921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30922         if (!ptr_is_owned(_res)) return;
30923         void* _res_ptr = untag_ptr(_res);
30924         CHECK_ACCESS(_res_ptr);
30925         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
30926         FREE(untag_ptr(_res));
30927         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
30928 }
30929
30930 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
30931         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30932         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
30933         return tag_ptr(ret_conv, true);
30934 }
30935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30936         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
30937         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
30938         return ret_conv;
30939 }
30940
30941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30942         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
30943         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30944         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
30945         return tag_ptr(ret_conv, true);
30946 }
30947
30948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30949         LDKPendingHTLCInfo o_conv;
30950         o_conv.inner = untag_ptr(o);
30951         o_conv.is_owned = ptr_is_owned(o);
30952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30953         o_conv = PendingHTLCInfo_clone(&o_conv);
30954         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30955         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
30956         return tag_ptr(ret_conv, true);
30957 }
30958
30959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30960         void* e_ptr = untag_ptr(e);
30961         CHECK_ACCESS(e_ptr);
30962         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30963         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30964         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30965         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
30966         return tag_ptr(ret_conv, true);
30967 }
30968
30969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30970         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
30971         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
30972         return ret_conv;
30973 }
30974
30975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30976         if (!ptr_is_owned(_res)) return;
30977         void* _res_ptr = untag_ptr(_res);
30978         CHECK_ACCESS(_res_ptr);
30979         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
30980         FREE(untag_ptr(_res));
30981         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
30982 }
30983
30984 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
30985         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30986         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
30987         return tag_ptr(ret_conv, true);
30988 }
30989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30990         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
30991         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
30992         return ret_conv;
30993 }
30994
30995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30996         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
30997         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30998         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
30999         return tag_ptr(ret_conv, true);
31000 }
31001
31002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
31003         LDKBlindedFailure o_conv = LDKBlindedFailure_from_java(env, o);
31004         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
31005         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
31006         return tag_ptr(ret_conv, true);
31007 }
31008
31009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31010         void* e_ptr = untag_ptr(e);
31011         CHECK_ACCESS(e_ptr);
31012         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31013         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31014         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
31015         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
31016         return tag_ptr(ret_conv, true);
31017 }
31018
31019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31020         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
31021         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
31022         return ret_conv;
31023 }
31024
31025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31026         if (!ptr_is_owned(_res)) return;
31027         void* _res_ptr = untag_ptr(_res);
31028         CHECK_ACCESS(_res_ptr);
31029         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
31030         FREE(untag_ptr(_res));
31031         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
31032 }
31033
31034 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
31035         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
31036         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
31037         return tag_ptr(ret_conv, true);
31038 }
31039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31040         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
31041         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
31042         return ret_conv;
31043 }
31044
31045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31046         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
31047         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
31048         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
31049         return tag_ptr(ret_conv, true);
31050 }
31051
31052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31053         LDKCVec_ChannelMonitorZ _res_constr;
31054         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31055         if (_res_constr.datalen > 0)
31056                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
31057         else
31058                 _res_constr.data = NULL;
31059         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31060         for (size_t q = 0; q < _res_constr.datalen; q++) {
31061                 int64_t _res_conv_16 = _res_vals[q];
31062                 LDKChannelMonitor _res_conv_16_conv;
31063                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
31064                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
31065                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
31066                 _res_constr.data[q] = _res_conv_16_conv;
31067         }
31068         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31069         CVec_ChannelMonitorZ_free(_res_constr);
31070 }
31071
31072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
31073         LDKThirtyTwoBytes a_ref;
31074         CHECK((*env)->GetArrayLength(env, a) == 32);
31075         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31076         LDKChannelManager b_conv;
31077         b_conv.inner = untag_ptr(b);
31078         b_conv.is_owned = ptr_is_owned(b);
31079         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31080         // WARNING: we need a move here but no clone is available for LDKChannelManager
31081         
31082         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
31083         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
31084         return tag_ptr(ret_conv, true);
31085 }
31086
31087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31088         if (!ptr_is_owned(_res)) return;
31089         void* _res_ptr = untag_ptr(_res);
31090         CHECK_ACCESS(_res_ptr);
31091         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
31092         FREE(untag_ptr(_res));
31093         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
31094 }
31095
31096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31097         void* o_ptr = untag_ptr(o);
31098         CHECK_ACCESS(o_ptr);
31099         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
31100         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
31101         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
31102         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
31103         return tag_ptr(ret_conv, true);
31104 }
31105
31106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31107         void* e_ptr = untag_ptr(e);
31108         CHECK_ACCESS(e_ptr);
31109         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31110         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31111         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
31112         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
31113         return tag_ptr(ret_conv, true);
31114 }
31115
31116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31117         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
31118         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
31119         return ret_conv;
31120 }
31121
31122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31123         if (!ptr_is_owned(_res)) return;
31124         void* _res_ptr = untag_ptr(_res);
31125         CHECK_ACCESS(_res_ptr);
31126         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
31127         FREE(untag_ptr(_res));
31128         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
31129 }
31130
31131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31132         void* o_ptr = untag_ptr(o);
31133         CHECK_ACCESS(o_ptr);
31134         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
31135         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
31136         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31137         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
31138         return tag_ptr(ret_conv, true);
31139 }
31140
31141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31142         void* e_ptr = untag_ptr(e);
31143         CHECK_ACCESS(e_ptr);
31144         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31145         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31146         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31147         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
31148         return tag_ptr(ret_conv, true);
31149 }
31150
31151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31152         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
31153         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
31154         return ret_conv;
31155 }
31156
31157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31158         if (!ptr_is_owned(_res)) return;
31159         void* _res_ptr = untag_ptr(_res);
31160         CHECK_ACCESS(_res_ptr);
31161         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
31162         FREE(untag_ptr(_res));
31163         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
31164 }
31165
31166 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
31167         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31168         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
31169         return tag_ptr(ret_conv, true);
31170 }
31171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31172         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
31173         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
31174         return ret_conv;
31175 }
31176
31177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31178         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
31179         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31180         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
31181         return tag_ptr(ret_conv, true);
31182 }
31183
31184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31185         LDKChannelConfig o_conv;
31186         o_conv.inner = untag_ptr(o);
31187         o_conv.is_owned = ptr_is_owned(o);
31188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31189         o_conv = ChannelConfig_clone(&o_conv);
31190         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31191         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
31192         return tag_ptr(ret_conv, true);
31193 }
31194
31195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31196         void* e_ptr = untag_ptr(e);
31197         CHECK_ACCESS(e_ptr);
31198         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31199         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31200         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31201         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
31202         return tag_ptr(ret_conv, true);
31203 }
31204
31205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31206         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
31207         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
31208         return ret_conv;
31209 }
31210
31211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31212         if (!ptr_is_owned(_res)) return;
31213         void* _res_ptr = untag_ptr(_res);
31214         CHECK_ACCESS(_res_ptr);
31215         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
31216         FREE(untag_ptr(_res));
31217         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
31218 }
31219
31220 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
31221         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31222         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
31223         return tag_ptr(ret_conv, true);
31224 }
31225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31226         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
31227         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
31228         return ret_conv;
31229 }
31230
31231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31232         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
31233         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31234         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
31235         return tag_ptr(ret_conv, true);
31236 }
31237
31238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31239         void* o_ptr = untag_ptr(o);
31240         CHECK_ACCESS(o_ptr);
31241         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
31242         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
31243         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31244         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
31245         int64_t ret_ref = tag_ptr(ret_copy, true);
31246         return ret_ref;
31247 }
31248
31249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
31250         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31251         *ret_copy = COption_MaxDustHTLCExposureZ_none();
31252         int64_t ret_ref = tag_ptr(ret_copy, true);
31253         return ret_ref;
31254 }
31255
31256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31257         if (!ptr_is_owned(_res)) return;
31258         void* _res_ptr = untag_ptr(_res);
31259         CHECK_ACCESS(_res_ptr);
31260         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
31261         FREE(untag_ptr(_res));
31262         COption_MaxDustHTLCExposureZ_free(_res_conv);
31263 }
31264
31265 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
31266         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31267         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
31268         int64_t ret_ref = tag_ptr(ret_copy, true);
31269         return ret_ref;
31270 }
31271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31272         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
31273         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
31274         return ret_conv;
31275 }
31276
31277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31278         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
31279         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31280         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
31281         int64_t ret_ref = tag_ptr(ret_copy, true);
31282         return ret_ref;
31283 }
31284
31285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31286         void* o_ptr = untag_ptr(o);
31287         CHECK_ACCESS(o_ptr);
31288         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
31289         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
31290         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31291         *ret_copy = COption_APIErrorZ_some(o_conv);
31292         int64_t ret_ref = tag_ptr(ret_copy, true);
31293         return ret_ref;
31294 }
31295
31296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
31297         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31298         *ret_copy = COption_APIErrorZ_none();
31299         int64_t ret_ref = tag_ptr(ret_copy, true);
31300         return ret_ref;
31301 }
31302
31303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31304         if (!ptr_is_owned(_res)) return;
31305         void* _res_ptr = untag_ptr(_res);
31306         CHECK_ACCESS(_res_ptr);
31307         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
31308         FREE(untag_ptr(_res));
31309         COption_APIErrorZ_free(_res_conv);
31310 }
31311
31312 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
31313         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31314         *ret_copy = COption_APIErrorZ_clone(arg);
31315         int64_t ret_ref = tag_ptr(ret_copy, true);
31316         return ret_ref;
31317 }
31318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31319         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
31320         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
31321         return ret_conv;
31322 }
31323
31324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31325         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
31326         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31327         *ret_copy = COption_APIErrorZ_clone(orig_conv);
31328         int64_t ret_ref = tag_ptr(ret_copy, true);
31329         return ret_ref;
31330 }
31331
31332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31333         void* o_ptr = untag_ptr(o);
31334         CHECK_ACCESS(o_ptr);
31335         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
31336         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
31337         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31338         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
31339         return tag_ptr(ret_conv, true);
31340 }
31341
31342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31343         void* e_ptr = untag_ptr(e);
31344         CHECK_ACCESS(e_ptr);
31345         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31346         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31347         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31348         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
31349         return tag_ptr(ret_conv, true);
31350 }
31351
31352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31353         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
31354         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
31355         return ret_conv;
31356 }
31357
31358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31359         if (!ptr_is_owned(_res)) return;
31360         void* _res_ptr = untag_ptr(_res);
31361         CHECK_ACCESS(_res_ptr);
31362         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
31363         FREE(untag_ptr(_res));
31364         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
31365 }
31366
31367 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
31368         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31369         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
31370         return tag_ptr(ret_conv, true);
31371 }
31372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31373         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
31374         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
31375         return ret_conv;
31376 }
31377
31378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31379         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
31380         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31381         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
31382         return tag_ptr(ret_conv, true);
31383 }
31384
31385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31386         LDKChannelMonitorUpdate o_conv;
31387         o_conv.inner = untag_ptr(o);
31388         o_conv.is_owned = ptr_is_owned(o);
31389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31390         o_conv = ChannelMonitorUpdate_clone(&o_conv);
31391         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31392         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
31393         return tag_ptr(ret_conv, true);
31394 }
31395
31396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31397         void* e_ptr = untag_ptr(e);
31398         CHECK_ACCESS(e_ptr);
31399         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31400         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31401         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31402         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
31403         return tag_ptr(ret_conv, true);
31404 }
31405
31406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31407         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
31408         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
31409         return ret_conv;
31410 }
31411
31412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31413         if (!ptr_is_owned(_res)) return;
31414         void* _res_ptr = untag_ptr(_res);
31415         CHECK_ACCESS(_res_ptr);
31416         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
31417         FREE(untag_ptr(_res));
31418         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
31419 }
31420
31421 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
31422         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31423         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
31424         return tag_ptr(ret_conv, true);
31425 }
31426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31427         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
31428         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
31429         return ret_conv;
31430 }
31431
31432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31433         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
31434         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31435         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
31436         return tag_ptr(ret_conv, true);
31437 }
31438
31439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31440         void* o_ptr = untag_ptr(o);
31441         CHECK_ACCESS(o_ptr);
31442         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
31443         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
31444         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31445         *ret_copy = COption_MonitorEventZ_some(o_conv);
31446         int64_t ret_ref = tag_ptr(ret_copy, true);
31447         return ret_ref;
31448 }
31449
31450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
31451         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31452         *ret_copy = COption_MonitorEventZ_none();
31453         int64_t ret_ref = tag_ptr(ret_copy, true);
31454         return ret_ref;
31455 }
31456
31457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31458         if (!ptr_is_owned(_res)) return;
31459         void* _res_ptr = untag_ptr(_res);
31460         CHECK_ACCESS(_res_ptr);
31461         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
31462         FREE(untag_ptr(_res));
31463         COption_MonitorEventZ_free(_res_conv);
31464 }
31465
31466 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
31467         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31468         *ret_copy = COption_MonitorEventZ_clone(arg);
31469         int64_t ret_ref = tag_ptr(ret_copy, true);
31470         return ret_ref;
31471 }
31472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31473         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
31474         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
31475         return ret_conv;
31476 }
31477
31478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31479         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
31480         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31481         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
31482         int64_t ret_ref = tag_ptr(ret_copy, true);
31483         return ret_ref;
31484 }
31485
31486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31487         void* o_ptr = untag_ptr(o);
31488         CHECK_ACCESS(o_ptr);
31489         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
31490         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
31491         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31492         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
31493         return tag_ptr(ret_conv, true);
31494 }
31495
31496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31497         void* e_ptr = untag_ptr(e);
31498         CHECK_ACCESS(e_ptr);
31499         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31500         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31501         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31502         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
31503         return tag_ptr(ret_conv, true);
31504 }
31505
31506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31507         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
31508         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
31509         return ret_conv;
31510 }
31511
31512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31513         if (!ptr_is_owned(_res)) return;
31514         void* _res_ptr = untag_ptr(_res);
31515         CHECK_ACCESS(_res_ptr);
31516         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
31517         FREE(untag_ptr(_res));
31518         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
31519 }
31520
31521 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
31522         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31523         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
31524         return tag_ptr(ret_conv, true);
31525 }
31526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31527         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
31528         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
31529         return ret_conv;
31530 }
31531
31532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31533         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
31534         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31535         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
31536         return tag_ptr(ret_conv, true);
31537 }
31538
31539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31540         LDKHTLCUpdate o_conv;
31541         o_conv.inner = untag_ptr(o);
31542         o_conv.is_owned = ptr_is_owned(o);
31543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31544         o_conv = HTLCUpdate_clone(&o_conv);
31545         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31546         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
31547         return tag_ptr(ret_conv, true);
31548 }
31549
31550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31551         void* e_ptr = untag_ptr(e);
31552         CHECK_ACCESS(e_ptr);
31553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31555         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31556         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
31557         return tag_ptr(ret_conv, true);
31558 }
31559
31560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31561         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
31562         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
31563         return ret_conv;
31564 }
31565
31566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31567         if (!ptr_is_owned(_res)) return;
31568         void* _res_ptr = untag_ptr(_res);
31569         CHECK_ACCESS(_res_ptr);
31570         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
31571         FREE(untag_ptr(_res));
31572         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
31573 }
31574
31575 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
31576         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31577         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
31578         return tag_ptr(ret_conv, true);
31579 }
31580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31581         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
31582         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
31583         return ret_conv;
31584 }
31585
31586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31587         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
31588         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31589         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
31590         return tag_ptr(ret_conv, true);
31591 }
31592
31593 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
31594         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31595         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
31596         return tag_ptr(ret_conv, true);
31597 }
31598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31599         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
31600         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
31601         return ret_conv;
31602 }
31603
31604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31605         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
31606         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31607         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
31608         return tag_ptr(ret_conv, true);
31609 }
31610
31611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
31612         LDKOutPoint a_conv;
31613         a_conv.inner = untag_ptr(a);
31614         a_conv.is_owned = ptr_is_owned(a);
31615         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31616         a_conv = OutPoint_clone(&a_conv);
31617         LDKCVec_u8Z b_ref;
31618         b_ref.datalen = (*env)->GetArrayLength(env, b);
31619         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
31620         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
31621         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31622         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
31623         return tag_ptr(ret_conv, true);
31624 }
31625
31626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31627         if (!ptr_is_owned(_res)) return;
31628         void* _res_ptr = untag_ptr(_res);
31629         CHECK_ACCESS(_res_ptr);
31630         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
31631         FREE(untag_ptr(_res));
31632         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
31633 }
31634
31635 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
31636         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31637         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
31638         return tag_ptr(ret_conv, true);
31639 }
31640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31641         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
31642         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
31643         return ret_conv;
31644 }
31645
31646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31647         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
31648         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31649         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
31650         return tag_ptr(ret_conv, true);
31651 }
31652
31653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
31654         LDKCVec_u8Z b_ref;
31655         b_ref.datalen = (*env)->GetArrayLength(env, b);
31656         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
31657         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
31658         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31659         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
31660         return tag_ptr(ret_conv, true);
31661 }
31662
31663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31664         if (!ptr_is_owned(_res)) return;
31665         void* _res_ptr = untag_ptr(_res);
31666         CHECK_ACCESS(_res_ptr);
31667         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
31668         FREE(untag_ptr(_res));
31669         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
31670 }
31671
31672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31673         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
31674         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31675         if (_res_constr.datalen > 0)
31676                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
31677         else
31678                 _res_constr.data = NULL;
31679         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31680         for (size_t x = 0; x < _res_constr.datalen; x++) {
31681                 int64_t _res_conv_23 = _res_vals[x];
31682                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
31683                 CHECK_ACCESS(_res_conv_23_ptr);
31684                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
31685                 FREE(untag_ptr(_res_conv_23));
31686                 _res_constr.data[x] = _res_conv_23_conv;
31687         }
31688         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31689         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
31690 }
31691
31692 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
31693         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31694         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
31695         return tag_ptr(ret_conv, true);
31696 }
31697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31698         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
31699         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
31700         return ret_conv;
31701 }
31702
31703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31704         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
31705         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31706         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
31707         return tag_ptr(ret_conv, true);
31708 }
31709
31710 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) {
31711         LDKThirtyTwoBytes a_ref;
31712         CHECK((*env)->GetArrayLength(env, a) == 32);
31713         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31714         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
31715         b_constr.datalen = (*env)->GetArrayLength(env, b);
31716         if (b_constr.datalen > 0)
31717                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
31718         else
31719                 b_constr.data = NULL;
31720         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
31721         for (size_t x = 0; x < b_constr.datalen; x++) {
31722                 int64_t b_conv_23 = b_vals[x];
31723                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
31724                 CHECK_ACCESS(b_conv_23_ptr);
31725                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
31726                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
31727                 b_constr.data[x] = b_conv_23_conv;
31728         }
31729         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
31730         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31731         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
31732         return tag_ptr(ret_conv, true);
31733 }
31734
31735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31736         if (!ptr_is_owned(_res)) return;
31737         void* _res_ptr = untag_ptr(_res);
31738         CHECK_ACCESS(_res_ptr);
31739         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
31740         FREE(untag_ptr(_res));
31741         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
31742 }
31743
31744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31745         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
31746         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31747         if (_res_constr.datalen > 0)
31748                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
31749         else
31750                 _res_constr.data = NULL;
31751         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31752         for (size_t a = 0; a < _res_constr.datalen; a++) {
31753                 int64_t _res_conv_52 = _res_vals[a];
31754                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
31755                 CHECK_ACCESS(_res_conv_52_ptr);
31756                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
31757                 FREE(untag_ptr(_res_conv_52));
31758                 _res_constr.data[a] = _res_conv_52_conv;
31759         }
31760         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31761         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
31762 }
31763
31764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31765         LDKCVec_CommitmentTransactionZ _res_constr;
31766         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31767         if (_res_constr.datalen > 0)
31768                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
31769         else
31770                 _res_constr.data = NULL;
31771         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31772         for (size_t x = 0; x < _res_constr.datalen; x++) {
31773                 int64_t _res_conv_23 = _res_vals[x];
31774                 LDKCommitmentTransaction _res_conv_23_conv;
31775                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
31776                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
31777                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
31778                 _res_constr.data[x] = _res_conv_23_conv;
31779         }
31780         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31781         CVec_CommitmentTransactionZ_free(_res_constr);
31782 }
31783
31784 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
31785         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31786         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
31787         return tag_ptr(ret_conv, true);
31788 }
31789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31790         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
31791         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
31792         return ret_conv;
31793 }
31794
31795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31796         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
31797         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31798         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
31799         return tag_ptr(ret_conv, true);
31800 }
31801
31802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
31803         void* b_ptr = untag_ptr(b);
31804         CHECK_ACCESS(b_ptr);
31805         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
31806         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
31807         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31808         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
31809         return tag_ptr(ret_conv, true);
31810 }
31811
31812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31813         if (!ptr_is_owned(_res)) return;
31814         void* _res_ptr = untag_ptr(_res);
31815         CHECK_ACCESS(_res_ptr);
31816         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
31817         FREE(untag_ptr(_res));
31818         C2Tuple_u32TxOutZ_free(_res_conv);
31819 }
31820
31821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31822         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
31823         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31824         if (_res_constr.datalen > 0)
31825                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
31826         else
31827                 _res_constr.data = NULL;
31828         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31829         for (size_t u = 0; u < _res_constr.datalen; u++) {
31830                 int64_t _res_conv_20 = _res_vals[u];
31831                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
31832                 CHECK_ACCESS(_res_conv_20_ptr);
31833                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
31834                 FREE(untag_ptr(_res_conv_20));
31835                 _res_constr.data[u] = _res_conv_20_conv;
31836         }
31837         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31838         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
31839 }
31840
31841 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
31842         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31843         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
31844         return tag_ptr(ret_conv, true);
31845 }
31846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31847         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
31848         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
31849         return ret_conv;
31850 }
31851
31852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31853         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
31854         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31855         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
31856         return tag_ptr(ret_conv, true);
31857 }
31858
31859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
31860         LDKThirtyTwoBytes a_ref;
31861         CHECK((*env)->GetArrayLength(env, a) == 32);
31862         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31863         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
31864         b_constr.datalen = (*env)->GetArrayLength(env, b);
31865         if (b_constr.datalen > 0)
31866                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
31867         else
31868                 b_constr.data = NULL;
31869         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
31870         for (size_t u = 0; u < b_constr.datalen; u++) {
31871                 int64_t b_conv_20 = b_vals[u];
31872                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
31873                 CHECK_ACCESS(b_conv_20_ptr);
31874                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
31875                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
31876                 b_constr.data[u] = b_conv_20_conv;
31877         }
31878         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
31879         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31880         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
31881         return tag_ptr(ret_conv, true);
31882 }
31883
31884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31885         if (!ptr_is_owned(_res)) return;
31886         void* _res_ptr = untag_ptr(_res);
31887         CHECK_ACCESS(_res_ptr);
31888         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
31889         FREE(untag_ptr(_res));
31890         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
31891 }
31892
31893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31894         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
31895         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31896         if (_res_constr.datalen > 0)
31897                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
31898         else
31899                 _res_constr.data = NULL;
31900         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31901         for (size_t x = 0; x < _res_constr.datalen; x++) {
31902                 int64_t _res_conv_49 = _res_vals[x];
31903                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
31904                 CHECK_ACCESS(_res_conv_49_ptr);
31905                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
31906                 FREE(untag_ptr(_res_conv_49));
31907                 _res_constr.data[x] = _res_conv_49_conv;
31908         }
31909         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31910         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
31911 }
31912
31913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31914         LDKCVec_BalanceZ _res_constr;
31915         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31916         if (_res_constr.datalen > 0)
31917                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
31918         else
31919                 _res_constr.data = NULL;
31920         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31921         for (size_t j = 0; j < _res_constr.datalen; j++) {
31922                 int64_t _res_conv_9 = _res_vals[j];
31923                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
31924                 CHECK_ACCESS(_res_conv_9_ptr);
31925                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
31926                 FREE(untag_ptr(_res_conv_9));
31927                 _res_constr.data[j] = _res_conv_9_conv;
31928         }
31929         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31930         CVec_BalanceZ_free(_res_constr);
31931 }
31932
31933 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
31934         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31935         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
31936         return tag_ptr(ret_conv, true);
31937 }
31938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31939         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
31940         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
31941         return ret_conv;
31942 }
31943
31944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31945         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
31946         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31947         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
31948         return tag_ptr(ret_conv, true);
31949 }
31950
31951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
31952         LDKThirtyTwoBytes a_ref;
31953         CHECK((*env)->GetArrayLength(env, a) == 32);
31954         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31955         LDKChannelMonitor b_conv;
31956         b_conv.inner = untag_ptr(b);
31957         b_conv.is_owned = ptr_is_owned(b);
31958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31959         b_conv = ChannelMonitor_clone(&b_conv);
31960         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31961         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
31962         return tag_ptr(ret_conv, true);
31963 }
31964
31965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_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         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
31970         FREE(untag_ptr(_res));
31971         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
31972 }
31973
31974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31975         void* o_ptr = untag_ptr(o);
31976         CHECK_ACCESS(o_ptr);
31977         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
31978         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
31979         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31980         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
31981         return tag_ptr(ret_conv, true);
31982 }
31983
31984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31985         void* e_ptr = untag_ptr(e);
31986         CHECK_ACCESS(e_ptr);
31987         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31988         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31989         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31990         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
31991         return tag_ptr(ret_conv, true);
31992 }
31993
31994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31995         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
31996         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
31997         return ret_conv;
31998 }
31999
32000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32001         if (!ptr_is_owned(_res)) return;
32002         void* _res_ptr = untag_ptr(_res);
32003         CHECK_ACCESS(_res_ptr);
32004         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
32005         FREE(untag_ptr(_res));
32006         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
32007 }
32008
32009 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
32010         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32011         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
32012         return tag_ptr(ret_conv, true);
32013 }
32014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32015         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
32016         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
32017         return ret_conv;
32018 }
32019
32020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32021         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
32022         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32023         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
32024         return tag_ptr(ret_conv, true);
32025 }
32026
32027 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
32028         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32029         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
32030         return tag_ptr(ret_conv, true);
32031 }
32032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32033         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
32034         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
32035         return ret_conv;
32036 }
32037
32038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32039         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
32040         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32041         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
32042         return tag_ptr(ret_conv, true);
32043 }
32044
32045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
32046         LDKPublicKey a_ref;
32047         CHECK((*env)->GetArrayLength(env, a) == 33);
32048         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
32049         void* b_ptr = untag_ptr(b);
32050         CHECK_ACCESS(b_ptr);
32051         LDKType b_conv = *(LDKType*)(b_ptr);
32052         if (b_conv.free == LDKType_JCalls_free) {
32053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32054                 LDKType_JCalls_cloned(&b_conv);
32055         }
32056         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32057         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
32058         return tag_ptr(ret_conv, true);
32059 }
32060
32061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32062         if (!ptr_is_owned(_res)) return;
32063         void* _res_ptr = untag_ptr(_res);
32064         CHECK_ACCESS(_res_ptr);
32065         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
32066         FREE(untag_ptr(_res));
32067         C2Tuple_PublicKeyTypeZ_free(_res_conv);
32068 }
32069
32070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32071         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
32072         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32073         if (_res_constr.datalen > 0)
32074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
32075         else
32076                 _res_constr.data = NULL;
32077         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32078         for (size_t z = 0; z < _res_constr.datalen; z++) {
32079                 int64_t _res_conv_25 = _res_vals[z];
32080                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
32081                 CHECK_ACCESS(_res_conv_25_ptr);
32082                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
32083                 FREE(untag_ptr(_res_conv_25));
32084                 _res_constr.data[z] = _res_conv_25_conv;
32085         }
32086         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32087         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
32088 }
32089
32090 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
32091         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32092         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
32093         return tag_ptr(ret_conv, true);
32094 }
32095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32096         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
32097         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
32098         return ret_conv;
32099 }
32100
32101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32102         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
32103         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32104         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
32105         return tag_ptr(ret_conv, true);
32106 }
32107
32108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
32109         LDKPublicKey a_ref;
32110         CHECK((*env)->GetArrayLength(env, a) == 33);
32111         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
32112         LDKCVec_SocketAddressZ b_constr;
32113         b_constr.datalen = (*env)->GetArrayLength(env, b);
32114         if (b_constr.datalen > 0)
32115                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
32116         else
32117                 b_constr.data = NULL;
32118         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
32119         for (size_t p = 0; p < b_constr.datalen; p++) {
32120                 int64_t b_conv_15 = b_vals[p];
32121                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
32122                 CHECK_ACCESS(b_conv_15_ptr);
32123                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
32124                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
32125                 b_constr.data[p] = b_conv_15_conv;
32126         }
32127         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
32128         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32129         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
32130         return tag_ptr(ret_conv, true);
32131 }
32132
32133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32134         if (!ptr_is_owned(_res)) return;
32135         void* _res_ptr = untag_ptr(_res);
32136         CHECK_ACCESS(_res_ptr);
32137         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
32138         FREE(untag_ptr(_res));
32139         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
32140 }
32141
32142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32143         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
32144         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32145         if (_res_constr.datalen > 0)
32146                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
32147         else
32148                 _res_constr.data = NULL;
32149         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32150         for (size_t o = 0; o < _res_constr.datalen; o++) {
32151                 int64_t _res_conv_40 = _res_vals[o];
32152                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
32153                 CHECK_ACCESS(_res_conv_40_ptr);
32154                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
32155                 FREE(untag_ptr(_res_conv_40));
32156                 _res_constr.data[o] = _res_conv_40_conv;
32157         }
32158         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32159         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
32160 }
32161
32162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32163         void* o_ptr = untag_ptr(o);
32164         CHECK_ACCESS(o_ptr);
32165         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
32166         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
32167                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32168                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
32169         }
32170         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32171         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
32172         int64_t ret_ref = tag_ptr(ret_copy, true);
32173         return ret_ref;
32174 }
32175
32176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
32177         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32178         *ret_copy = COption_OnionMessageContentsZ_none();
32179         int64_t ret_ref = tag_ptr(ret_copy, true);
32180         return ret_ref;
32181 }
32182
32183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32184         if (!ptr_is_owned(_res)) return;
32185         void* _res_ptr = untag_ptr(_res);
32186         CHECK_ACCESS(_res_ptr);
32187         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
32188         FREE(untag_ptr(_res));
32189         COption_OnionMessageContentsZ_free(_res_conv);
32190 }
32191
32192 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
32193         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32194         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
32195         int64_t ret_ref = tag_ptr(ret_copy, true);
32196         return ret_ref;
32197 }
32198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32199         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
32200         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
32201         return ret_conv;
32202 }
32203
32204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32205         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
32206         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32207         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
32208         int64_t ret_ref = tag_ptr(ret_copy, true);
32209         return ret_ref;
32210 }
32211
32212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32213         void* o_ptr = untag_ptr(o);
32214         CHECK_ACCESS(o_ptr);
32215         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
32216         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
32217         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32218         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
32219         return tag_ptr(ret_conv, true);
32220 }
32221
32222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32223         void* e_ptr = untag_ptr(e);
32224         CHECK_ACCESS(e_ptr);
32225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32227         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32228         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
32229         return tag_ptr(ret_conv, true);
32230 }
32231
32232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32233         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
32234         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
32235         return ret_conv;
32236 }
32237
32238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32239         if (!ptr_is_owned(_res)) return;
32240         void* _res_ptr = untag_ptr(_res);
32241         CHECK_ACCESS(_res_ptr);
32242         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
32243         FREE(untag_ptr(_res));
32244         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
32245 }
32246
32247 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
32248         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32249         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
32250         return tag_ptr(ret_conv, true);
32251 }
32252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32253         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
32254         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
32255         return ret_conv;
32256 }
32257
32258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32259         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
32260         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32261         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
32262         return tag_ptr(ret_conv, true);
32263 }
32264
32265 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
32266         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32267         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
32268         return tag_ptr(ret_conv, true);
32269 }
32270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32271         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
32272         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
32273         return ret_conv;
32274 }
32275
32276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32277         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
32278         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32279         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
32280         return tag_ptr(ret_conv, true);
32281 }
32282
32283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
32284         void* a_ptr = untag_ptr(a);
32285         CHECK_ACCESS(a_ptr);
32286         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
32287         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
32288                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32289                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
32290         }
32291         void* b_ptr = untag_ptr(b);
32292         CHECK_ACCESS(b_ptr);
32293         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
32294         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
32295         LDKBlindedPath c_conv;
32296         c_conv.inner = untag_ptr(c);
32297         c_conv.is_owned = ptr_is_owned(c);
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32299         c_conv = BlindedPath_clone(&c_conv);
32300         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32301         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
32302         return tag_ptr(ret_conv, true);
32303 }
32304
32305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32306         if (!ptr_is_owned(_res)) return;
32307         void* _res_ptr = untag_ptr(_res);
32308         CHECK_ACCESS(_res_ptr);
32309         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
32310         FREE(untag_ptr(_res));
32311         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
32312 }
32313
32314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32315         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
32316         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32317         if (_res_constr.datalen > 0)
32318                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
32319         else
32320                 _res_constr.data = NULL;
32321         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32322         for (size_t e = 0; e < _res_constr.datalen; e++) {
32323                 int64_t _res_conv_56 = _res_vals[e];
32324                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
32325                 CHECK_ACCESS(_res_conv_56_ptr);
32326                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
32327                 FREE(untag_ptr(_res_conv_56));
32328                 _res_constr.data[e] = _res_conv_56_conv;
32329         }
32330         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32331         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
32332 }
32333
32334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32335         void* o_ptr = untag_ptr(o);
32336         CHECK_ACCESS(o_ptr);
32337         LDKType o_conv = *(LDKType*)(o_ptr);
32338         if (o_conv.free == LDKType_JCalls_free) {
32339                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32340                 LDKType_JCalls_cloned(&o_conv);
32341         }
32342         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32343         *ret_copy = COption_TypeZ_some(o_conv);
32344         int64_t ret_ref = tag_ptr(ret_copy, true);
32345         return ret_ref;
32346 }
32347
32348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
32349         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32350         *ret_copy = COption_TypeZ_none();
32351         int64_t ret_ref = tag_ptr(ret_copy, true);
32352         return ret_ref;
32353 }
32354
32355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32356         if (!ptr_is_owned(_res)) return;
32357         void* _res_ptr = untag_ptr(_res);
32358         CHECK_ACCESS(_res_ptr);
32359         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
32360         FREE(untag_ptr(_res));
32361         COption_TypeZ_free(_res_conv);
32362 }
32363
32364 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
32365         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32366         *ret_copy = COption_TypeZ_clone(arg);
32367         int64_t ret_ref = tag_ptr(ret_copy, true);
32368         return ret_ref;
32369 }
32370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32371         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
32372         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
32373         return ret_conv;
32374 }
32375
32376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32377         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
32378         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32379         *ret_copy = COption_TypeZ_clone(orig_conv);
32380         int64_t ret_ref = tag_ptr(ret_copy, true);
32381         return ret_ref;
32382 }
32383
32384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32385         void* o_ptr = untag_ptr(o);
32386         CHECK_ACCESS(o_ptr);
32387         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
32388         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
32389         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32390         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
32391         return tag_ptr(ret_conv, true);
32392 }
32393
32394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32395         void* e_ptr = untag_ptr(e);
32396         CHECK_ACCESS(e_ptr);
32397         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32398         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32399         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32400         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
32401         return tag_ptr(ret_conv, true);
32402 }
32403
32404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32405         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
32406         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
32407         return ret_conv;
32408 }
32409
32410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32411         if (!ptr_is_owned(_res)) return;
32412         void* _res_ptr = untag_ptr(_res);
32413         CHECK_ACCESS(_res_ptr);
32414         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
32415         FREE(untag_ptr(_res));
32416         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
32417 }
32418
32419 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
32420         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32421         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
32422         return tag_ptr(ret_conv, true);
32423 }
32424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32425         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
32426         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
32427         return ret_conv;
32428 }
32429
32430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32431         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
32432         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32433         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
32434         return tag_ptr(ret_conv, true);
32435 }
32436
32437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32438         void* o_ptr = untag_ptr(o);
32439         CHECK_ACCESS(o_ptr);
32440         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
32441         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
32442         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32443         *ret_copy = COption_SocketAddressZ_some(o_conv);
32444         int64_t ret_ref = tag_ptr(ret_copy, true);
32445         return ret_ref;
32446 }
32447
32448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
32449         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32450         *ret_copy = COption_SocketAddressZ_none();
32451         int64_t ret_ref = tag_ptr(ret_copy, true);
32452         return ret_ref;
32453 }
32454
32455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32456         if (!ptr_is_owned(_res)) return;
32457         void* _res_ptr = untag_ptr(_res);
32458         CHECK_ACCESS(_res_ptr);
32459         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
32460         FREE(untag_ptr(_res));
32461         COption_SocketAddressZ_free(_res_conv);
32462 }
32463
32464 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
32465         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32466         *ret_copy = COption_SocketAddressZ_clone(arg);
32467         int64_t ret_ref = tag_ptr(ret_copy, true);
32468         return ret_ref;
32469 }
32470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32471         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
32472         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
32473         return ret_conv;
32474 }
32475
32476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32477         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
32478         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32479         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
32480         int64_t ret_ref = tag_ptr(ret_copy, true);
32481         return ret_ref;
32482 }
32483
32484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PeerDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32485         LDKCVec_PeerDetailsZ _res_constr;
32486         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32487         if (_res_constr.datalen > 0)
32488                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
32489         else
32490                 _res_constr.data = NULL;
32491         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32492         for (size_t n = 0; n < _res_constr.datalen; n++) {
32493                 int64_t _res_conv_13 = _res_vals[n];
32494                 LDKPeerDetails _res_conv_13_conv;
32495                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32496                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32498                 _res_constr.data[n] = _res_conv_13_conv;
32499         }
32500         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32501         CVec_PeerDetailsZ_free(_res_constr);
32502 }
32503
32504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
32505         LDKCVec_u8Z o_ref;
32506         o_ref.datalen = (*env)->GetArrayLength(env, o);
32507         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
32508         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
32509         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32510         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
32511         return tag_ptr(ret_conv, true);
32512 }
32513
32514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32515         LDKPeerHandleError e_conv;
32516         e_conv.inner = untag_ptr(e);
32517         e_conv.is_owned = ptr_is_owned(e);
32518         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32519         e_conv = PeerHandleError_clone(&e_conv);
32520         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32521         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
32522         return tag_ptr(ret_conv, true);
32523 }
32524
32525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32526         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
32527         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
32528         return ret_conv;
32529 }
32530
32531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32532         if (!ptr_is_owned(_res)) return;
32533         void* _res_ptr = untag_ptr(_res);
32534         CHECK_ACCESS(_res_ptr);
32535         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
32536         FREE(untag_ptr(_res));
32537         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
32538 }
32539
32540 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
32541         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32542         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
32543         return tag_ptr(ret_conv, true);
32544 }
32545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32546         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
32547         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
32548         return ret_conv;
32549 }
32550
32551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32552         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
32553         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32554         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
32555         return tag_ptr(ret_conv, true);
32556 }
32557
32558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
32559         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32560         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
32561         return tag_ptr(ret_conv, true);
32562 }
32563
32564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32565         LDKPeerHandleError e_conv;
32566         e_conv.inner = untag_ptr(e);
32567         e_conv.is_owned = ptr_is_owned(e);
32568         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32569         e_conv = PeerHandleError_clone(&e_conv);
32570         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32571         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
32572         return tag_ptr(ret_conv, true);
32573 }
32574
32575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32576         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
32577         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
32578         return ret_conv;
32579 }
32580
32581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32582         if (!ptr_is_owned(_res)) return;
32583         void* _res_ptr = untag_ptr(_res);
32584         CHECK_ACCESS(_res_ptr);
32585         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
32586         FREE(untag_ptr(_res));
32587         CResult_NonePeerHandleErrorZ_free(_res_conv);
32588 }
32589
32590 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
32591         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32592         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
32593         return tag_ptr(ret_conv, true);
32594 }
32595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32596         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
32597         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
32598         return ret_conv;
32599 }
32600
32601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32602         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
32603         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32604         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
32605         return tag_ptr(ret_conv, true);
32606 }
32607
32608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
32609         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32610         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
32611         return tag_ptr(ret_conv, true);
32612 }
32613
32614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32615         LDKPeerHandleError e_conv;
32616         e_conv.inner = untag_ptr(e);
32617         e_conv.is_owned = ptr_is_owned(e);
32618         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32619         e_conv = PeerHandleError_clone(&e_conv);
32620         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32621         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
32622         return tag_ptr(ret_conv, true);
32623 }
32624
32625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32626         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
32627         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
32628         return ret_conv;
32629 }
32630
32631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32632         if (!ptr_is_owned(_res)) return;
32633         void* _res_ptr = untag_ptr(_res);
32634         CHECK_ACCESS(_res_ptr);
32635         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
32636         FREE(untag_ptr(_res));
32637         CResult_boolPeerHandleErrorZ_free(_res_conv);
32638 }
32639
32640 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
32641         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32642         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
32643         return tag_ptr(ret_conv, true);
32644 }
32645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32646         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
32647         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
32648         return ret_conv;
32649 }
32650
32651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32652         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
32653         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32654         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
32655         return tag_ptr(ret_conv, true);
32656 }
32657
32658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
32659         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
32660         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
32661         return tag_ptr(ret_conv, true);
32662 }
32663
32664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32665         void* e_ptr = untag_ptr(e);
32666         CHECK_ACCESS(e_ptr);
32667         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
32668         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
32669         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
32670         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
32671         return tag_ptr(ret_conv, true);
32672 }
32673
32674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32675         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
32676         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
32677         return ret_conv;
32678 }
32679
32680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32681         if (!ptr_is_owned(_res)) return;
32682         void* _res_ptr = untag_ptr(_res);
32683         CHECK_ACCESS(_res_ptr);
32684         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
32685         FREE(untag_ptr(_res));
32686         CResult_u32GraphSyncErrorZ_free(_res_conv);
32687 }
32688
32689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
32690         LDKCVec_u8Z o_ref;
32691         o_ref.datalen = (*env)->GetArrayLength(env, o);
32692         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
32693         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
32694         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32695         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
32696         return tag_ptr(ret_conv, true);
32697 }
32698
32699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32700         LDKIOError e_conv = LDKIOError_from_java(env, e);
32701         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32702         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
32703         return tag_ptr(ret_conv, true);
32704 }
32705
32706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32707         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
32708         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
32709         return ret_conv;
32710 }
32711
32712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32713         if (!ptr_is_owned(_res)) return;
32714         void* _res_ptr = untag_ptr(_res);
32715         CHECK_ACCESS(_res_ptr);
32716         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
32717         FREE(untag_ptr(_res));
32718         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
32719 }
32720
32721 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
32722         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32723         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
32724         return tag_ptr(ret_conv, true);
32725 }
32726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32727         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
32728         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
32729         return ret_conv;
32730 }
32731
32732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32733         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
32734         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32735         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
32736         return tag_ptr(ret_conv, true);
32737 }
32738
32739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
32740         LDKCVec_StrZ _res_constr;
32741         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32742         if (_res_constr.datalen > 0)
32743                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
32744         else
32745                 _res_constr.data = NULL;
32746         for (size_t i = 0; i < _res_constr.datalen; i++) {
32747                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
32748                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
32749                 _res_constr.data[i] = dummy;
32750         }
32751         CVec_StrZ_free(_res_constr);
32752 }
32753
32754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
32755         LDKCVec_StrZ o_constr;
32756         o_constr.datalen = (*env)->GetArrayLength(env, o);
32757         if (o_constr.datalen > 0)
32758                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
32759         else
32760                 o_constr.data = NULL;
32761         for (size_t i = 0; i < o_constr.datalen; i++) {
32762                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
32763                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
32764                 o_constr.data[i] = o_conv_8_conv;
32765         }
32766         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32767         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
32768         return tag_ptr(ret_conv, true);
32769 }
32770
32771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32772         LDKIOError e_conv = LDKIOError_from_java(env, e);
32773         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32774         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
32775         return tag_ptr(ret_conv, true);
32776 }
32777
32778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32779         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
32780         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
32781         return ret_conv;
32782 }
32783
32784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32785         if (!ptr_is_owned(_res)) return;
32786         void* _res_ptr = untag_ptr(_res);
32787         CHECK_ACCESS(_res_ptr);
32788         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
32789         FREE(untag_ptr(_res));
32790         CResult_CVec_StrZIOErrorZ_free(_res_conv);
32791 }
32792
32793 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
32794         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32795         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
32796         return tag_ptr(ret_conv, true);
32797 }
32798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32799         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
32800         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
32801         return ret_conv;
32802 }
32803
32804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32805         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
32806         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32807         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
32808         return tag_ptr(ret_conv, true);
32809 }
32810
32811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32812         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
32813         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32814         if (_res_constr.datalen > 0)
32815                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
32816         else
32817                 _res_constr.data = NULL;
32818         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32819         for (size_t o = 0; o < _res_constr.datalen; o++) {
32820                 int64_t _res_conv_40 = _res_vals[o];
32821                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
32822                 CHECK_ACCESS(_res_conv_40_ptr);
32823                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
32824                 FREE(untag_ptr(_res_conv_40));
32825                 _res_constr.data[o] = _res_conv_40_conv;
32826         }
32827         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32828         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
32829 }
32830
32831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
32832         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
32833         o_constr.datalen = (*env)->GetArrayLength(env, o);
32834         if (o_constr.datalen > 0)
32835                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
32836         else
32837                 o_constr.data = NULL;
32838         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
32839         for (size_t o = 0; o < o_constr.datalen; o++) {
32840                 int64_t o_conv_40 = o_vals[o];
32841                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
32842                 CHECK_ACCESS(o_conv_40_ptr);
32843                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
32844                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
32845                 o_constr.data[o] = o_conv_40_conv;
32846         }
32847         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
32848         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32849         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
32850         return tag_ptr(ret_conv, true);
32851 }
32852
32853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32854         LDKIOError e_conv = LDKIOError_from_java(env, e);
32855         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32856         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
32857         return tag_ptr(ret_conv, true);
32858 }
32859
32860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32861         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
32862         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
32863         return ret_conv;
32864 }
32865
32866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32867         if (!ptr_is_owned(_res)) return;
32868         void* _res_ptr = untag_ptr(_res);
32869         CHECK_ACCESS(_res_ptr);
32870         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
32871         FREE(untag_ptr(_res));
32872         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
32873 }
32874
32875 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
32876         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32877         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
32878         return tag_ptr(ret_conv, true);
32879 }
32880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32881         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
32882         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
32883         return ret_conv;
32884 }
32885
32886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32887         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
32888         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32889         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
32890         return tag_ptr(ret_conv, true);
32891 }
32892
32893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32894         void* o_ptr = untag_ptr(o);
32895         CHECK_ACCESS(o_ptr);
32896         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
32897         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
32898         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32899         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
32900         return tag_ptr(ret_conv, true);
32901 }
32902
32903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32904         LDKIOError e_conv = LDKIOError_from_java(env, e);
32905         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32906         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
32907         return tag_ptr(ret_conv, true);
32908 }
32909
32910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32911         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
32912         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
32913         return ret_conv;
32914 }
32915
32916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32917         if (!ptr_is_owned(_res)) return;
32918         void* _res_ptr = untag_ptr(_res);
32919         CHECK_ACCESS(_res_ptr);
32920         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
32921         FREE(untag_ptr(_res));
32922         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
32923 }
32924
32925 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
32926         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32927         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
32928         return tag_ptr(ret_conv, true);
32929 }
32930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32931         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
32932         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
32933         return ret_conv;
32934 }
32935
32936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32937         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
32938         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32939         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
32940         return tag_ptr(ret_conv, true);
32941 }
32942
32943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32944         LDKUnsignedInvoiceRequest o_conv;
32945         o_conv.inner = untag_ptr(o);
32946         o_conv.is_owned = ptr_is_owned(o);
32947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32948         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
32949         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32950         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
32951         return tag_ptr(ret_conv, true);
32952 }
32953
32954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32955         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
32956         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32957         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
32958         return tag_ptr(ret_conv, true);
32959 }
32960
32961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32962         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
32963         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
32964         return ret_conv;
32965 }
32966
32967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32968         if (!ptr_is_owned(_res)) return;
32969         void* _res_ptr = untag_ptr(_res);
32970         CHECK_ACCESS(_res_ptr);
32971         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
32972         FREE(untag_ptr(_res));
32973         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
32974 }
32975
32976 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
32977         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32978         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
32979         return tag_ptr(ret_conv, true);
32980 }
32981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32982         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
32983         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
32984         return ret_conv;
32985 }
32986
32987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32988         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
32989         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32990         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
32991         return tag_ptr(ret_conv, true);
32992 }
32993
32994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32995         LDKInvoiceRequest o_conv;
32996         o_conv.inner = untag_ptr(o);
32997         o_conv.is_owned = ptr_is_owned(o);
32998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32999         o_conv = InvoiceRequest_clone(&o_conv);
33000         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33001         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
33002         return tag_ptr(ret_conv, true);
33003 }
33004
33005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33006         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33007         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33008         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
33009         return tag_ptr(ret_conv, true);
33010 }
33011
33012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33013         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
33014         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
33015         return ret_conv;
33016 }
33017
33018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33019         if (!ptr_is_owned(_res)) return;
33020         void* _res_ptr = untag_ptr(_res);
33021         CHECK_ACCESS(_res_ptr);
33022         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
33023         FREE(untag_ptr(_res));
33024         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
33025 }
33026
33027 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
33028         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33029         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
33030         return tag_ptr(ret_conv, true);
33031 }
33032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33033         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
33034         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
33035         return ret_conv;
33036 }
33037
33038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33039         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
33040         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33041         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
33042         return tag_ptr(ret_conv, true);
33043 }
33044
33045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
33046         LDKSecretKey o_ref;
33047         CHECK((*env)->GetArrayLength(env, o) == 32);
33048         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
33049         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33050         *ret_copy = COption_SecretKeyZ_some(o_ref);
33051         int64_t ret_ref = tag_ptr(ret_copy, true);
33052         return ret_ref;
33053 }
33054
33055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
33056         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33057         *ret_copy = COption_SecretKeyZ_none();
33058         int64_t ret_ref = tag_ptr(ret_copy, true);
33059         return ret_ref;
33060 }
33061
33062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33063         if (!ptr_is_owned(_res)) return;
33064         void* _res_ptr = untag_ptr(_res);
33065         CHECK_ACCESS(_res_ptr);
33066         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
33067         FREE(untag_ptr(_res));
33068         COption_SecretKeyZ_free(_res_conv);
33069 }
33070
33071 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
33072         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33073         *ret_copy = COption_SecretKeyZ_clone(arg);
33074         int64_t ret_ref = tag_ptr(ret_copy, true);
33075         return ret_ref;
33076 }
33077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33078         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
33079         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
33080         return ret_conv;
33081 }
33082
33083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33084         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
33085         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33086         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
33087         int64_t ret_ref = tag_ptr(ret_copy, true);
33088         return ret_ref;
33089 }
33090
33091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33092         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
33093         o_conv.inner = untag_ptr(o);
33094         o_conv.is_owned = ptr_is_owned(o);
33095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33096         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
33097         
33098         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
33099         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
33100         return tag_ptr(ret_conv, true);
33101 }
33102
33103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33104         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33105         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
33106         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
33107         return tag_ptr(ret_conv, true);
33108 }
33109
33110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33111         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
33112         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
33113         return ret_conv;
33114 }
33115
33116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33117         if (!ptr_is_owned(_res)) return;
33118         void* _res_ptr = untag_ptr(_res);
33119         CHECK_ACCESS(_res_ptr);
33120         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
33121         FREE(untag_ptr(_res));
33122         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
33123 }
33124
33125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33126         LDKVerifiedInvoiceRequest o_conv;
33127         o_conv.inner = untag_ptr(o);
33128         o_conv.is_owned = ptr_is_owned(o);
33129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33130         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
33131         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33132         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
33133         return tag_ptr(ret_conv, true);
33134 }
33135
33136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
33137         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33138         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
33139         return tag_ptr(ret_conv, true);
33140 }
33141
33142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33143         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
33144         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
33145         return ret_conv;
33146 }
33147
33148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33149         if (!ptr_is_owned(_res)) return;
33150         void* _res_ptr = untag_ptr(_res);
33151         CHECK_ACCESS(_res_ptr);
33152         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
33153         FREE(untag_ptr(_res));
33154         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
33155 }
33156
33157 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
33158         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33159         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
33160         return tag_ptr(ret_conv, true);
33161 }
33162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33163         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
33164         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
33165         return ret_conv;
33166 }
33167
33168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33169         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
33170         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33171         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
33172         return tag_ptr(ret_conv, true);
33173 }
33174
33175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33176         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
33177         o_conv.inner = untag_ptr(o);
33178         o_conv.is_owned = ptr_is_owned(o);
33179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33180         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
33181         
33182         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
33183         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
33184         return tag_ptr(ret_conv, true);
33185 }
33186
33187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33188         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33189         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
33190         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
33191         return tag_ptr(ret_conv, true);
33192 }
33193
33194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33195         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
33196         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
33197         return ret_conv;
33198 }
33199
33200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33201         if (!ptr_is_owned(_res)) return;
33202         void* _res_ptr = untag_ptr(_res);
33203         CHECK_ACCESS(_res_ptr);
33204         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
33205         FREE(untag_ptr(_res));
33206         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
33207 }
33208
33209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33210         LDKInvoiceRequestFields o_conv;
33211         o_conv.inner = untag_ptr(o);
33212         o_conv.is_owned = ptr_is_owned(o);
33213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33214         o_conv = InvoiceRequestFields_clone(&o_conv);
33215         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33216         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
33217         return tag_ptr(ret_conv, true);
33218 }
33219
33220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33221         void* e_ptr = untag_ptr(e);
33222         CHECK_ACCESS(e_ptr);
33223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33225         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33226         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
33227         return tag_ptr(ret_conv, true);
33228 }
33229
33230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33231         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
33232         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
33233         return ret_conv;
33234 }
33235
33236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33237         if (!ptr_is_owned(_res)) return;
33238         void* _res_ptr = untag_ptr(_res);
33239         CHECK_ACCESS(_res_ptr);
33240         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
33241         FREE(untag_ptr(_res));
33242         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
33243 }
33244
33245 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
33246         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33247         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
33248         return tag_ptr(ret_conv, true);
33249 }
33250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33251         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
33252         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
33253         return ret_conv;
33254 }
33255
33256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33257         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
33258         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33259         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
33260         return tag_ptr(ret_conv, true);
33261 }
33262
33263 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
33264         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
33265         return ret_conv;
33266 }
33267
33268 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
33269         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
33270         return ret_conv;
33271 }
33272
33273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
33274         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
33275         COption_NoneZ_free(_res_conv);
33276 }
33277
33278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
33279         LDKCVec_WitnessZ _res_constr;
33280         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33281         if (_res_constr.datalen > 0)
33282                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
33283         else
33284                 _res_constr.data = NULL;
33285         for (size_t i = 0; i < _res_constr.datalen; i++) {
33286                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
33287                 LDKWitness _res_conv_8_ref;
33288                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
33289                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
33290                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
33291                 _res_conv_8_ref.data_is_owned = true;
33292                 _res_constr.data[i] = _res_conv_8_ref;
33293         }
33294         CVec_WitnessZ_free(_res_constr);
33295 }
33296
33297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
33298         LDKECDSASignature o_ref;
33299         CHECK((*env)->GetArrayLength(env, o) == 64);
33300         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
33301         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33302         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
33303         int64_t ret_ref = tag_ptr(ret_copy, true);
33304         return ret_ref;
33305 }
33306
33307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1none(JNIEnv *env, jclass clz) {
33308         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33309         *ret_copy = COption_ECDSASignatureZ_none();
33310         int64_t ret_ref = tag_ptr(ret_copy, true);
33311         return ret_ref;
33312 }
33313
33314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33315         if (!ptr_is_owned(_res)) return;
33316         void* _res_ptr = untag_ptr(_res);
33317         CHECK_ACCESS(_res_ptr);
33318         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
33319         FREE(untag_ptr(_res));
33320         COption_ECDSASignatureZ_free(_res_conv);
33321 }
33322
33323 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
33324         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33325         *ret_copy = COption_ECDSASignatureZ_clone(arg);
33326         int64_t ret_ref = tag_ptr(ret_copy, true);
33327         return ret_ref;
33328 }
33329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33330         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
33331         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
33332         return ret_conv;
33333 }
33334
33335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33336         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
33337         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33338         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
33339         int64_t ret_ref = tag_ptr(ret_copy, true);
33340         return ret_ref;
33341 }
33342
33343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
33344         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33345         *ret_copy = COption_i64Z_some(o);
33346         int64_t ret_ref = tag_ptr(ret_copy, true);
33347         return ret_ref;
33348 }
33349
33350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
33351         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33352         *ret_copy = COption_i64Z_none();
33353         int64_t ret_ref = tag_ptr(ret_copy, true);
33354         return ret_ref;
33355 }
33356
33357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
33358         if (!ptr_is_owned(_res)) return;
33359         void* _res_ptr = untag_ptr(_res);
33360         CHECK_ACCESS(_res_ptr);
33361         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
33362         FREE(untag_ptr(_res));
33363         COption_i64Z_free(_res_conv);
33364 }
33365
33366 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
33367         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33368         *ret_copy = COption_i64Z_clone(arg);
33369         int64_t ret_ref = tag_ptr(ret_copy, true);
33370         return ret_ref;
33371 }
33372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33373         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
33374         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
33375         return ret_conv;
33376 }
33377
33378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33379         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
33380         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33381         *ret_copy = COption_i64Z_clone(orig_conv);
33382         int64_t ret_ref = tag_ptr(ret_copy, true);
33383         return ret_ref;
33384 }
33385
33386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33387         void* o_ptr = untag_ptr(o);
33388         CHECK_ACCESS(o_ptr);
33389         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
33390         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
33391         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33392         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
33393         return tag_ptr(ret_conv, true);
33394 }
33395
33396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33397         void* e_ptr = untag_ptr(e);
33398         CHECK_ACCESS(e_ptr);
33399         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33400         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33401         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33402         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
33403         return tag_ptr(ret_conv, true);
33404 }
33405
33406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33407         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
33408         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
33409         return ret_conv;
33410 }
33411
33412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33413         if (!ptr_is_owned(_res)) return;
33414         void* _res_ptr = untag_ptr(_res);
33415         CHECK_ACCESS(_res_ptr);
33416         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
33417         FREE(untag_ptr(_res));
33418         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
33419 }
33420
33421 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
33422         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33423         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
33424         return tag_ptr(ret_conv, true);
33425 }
33426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33427         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
33428         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
33429         return ret_conv;
33430 }
33431
33432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33433         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
33434         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33435         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
33436         return tag_ptr(ret_conv, true);
33437 }
33438
33439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33440         void* o_ptr = untag_ptr(o);
33441         CHECK_ACCESS(o_ptr);
33442         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
33443         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
33444         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33445         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
33446         return tag_ptr(ret_conv, true);
33447 }
33448
33449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33450         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
33451         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33452         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
33453         return tag_ptr(ret_conv, true);
33454 }
33455
33456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33457         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
33458         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
33459         return ret_conv;
33460 }
33461
33462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33463         if (!ptr_is_owned(_res)) return;
33464         void* _res_ptr = untag_ptr(_res);
33465         CHECK_ACCESS(_res_ptr);
33466         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
33467         FREE(untag_ptr(_res));
33468         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
33469 }
33470
33471 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
33472         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33473         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
33474         return tag_ptr(ret_conv, true);
33475 }
33476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33477         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
33478         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
33479         return ret_conv;
33480 }
33481
33482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33483         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
33484         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33485         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
33486         return tag_ptr(ret_conv, true);
33487 }
33488
33489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33490         LDKCVec_UpdateAddHTLCZ _res_constr;
33491         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33492         if (_res_constr.datalen > 0)
33493                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33494         else
33495                 _res_constr.data = NULL;
33496         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33497         for (size_t p = 0; p < _res_constr.datalen; p++) {
33498                 int64_t _res_conv_15 = _res_vals[p];
33499                 LDKUpdateAddHTLC _res_conv_15_conv;
33500                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
33501                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
33502                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
33503                 _res_constr.data[p] = _res_conv_15_conv;
33504         }
33505         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33506         CVec_UpdateAddHTLCZ_free(_res_constr);
33507 }
33508
33509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33510         LDKCVec_UpdateFulfillHTLCZ _res_constr;
33511         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33512         if (_res_constr.datalen > 0)
33513                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33514         else
33515                 _res_constr.data = NULL;
33516         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33517         for (size_t t = 0; t < _res_constr.datalen; t++) {
33518                 int64_t _res_conv_19 = _res_vals[t];
33519                 LDKUpdateFulfillHTLC _res_conv_19_conv;
33520                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
33521                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
33522                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
33523                 _res_constr.data[t] = _res_conv_19_conv;
33524         }
33525         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33526         CVec_UpdateFulfillHTLCZ_free(_res_constr);
33527 }
33528
33529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33530         LDKCVec_UpdateFailHTLCZ _res_constr;
33531         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33532         if (_res_constr.datalen > 0)
33533                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33534         else
33535                 _res_constr.data = NULL;
33536         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33537         for (size_t q = 0; q < _res_constr.datalen; q++) {
33538                 int64_t _res_conv_16 = _res_vals[q];
33539                 LDKUpdateFailHTLC _res_conv_16_conv;
33540                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
33541                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
33542                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
33543                 _res_constr.data[q] = _res_conv_16_conv;
33544         }
33545         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33546         CVec_UpdateFailHTLCZ_free(_res_constr);
33547 }
33548
33549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33550         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
33551         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33552         if (_res_constr.datalen > 0)
33553                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33554         else
33555                 _res_constr.data = NULL;
33556         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33557         for (size_t z = 0; z < _res_constr.datalen; z++) {
33558                 int64_t _res_conv_25 = _res_vals[z];
33559                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
33560                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
33561                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
33562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
33563                 _res_constr.data[z] = _res_conv_25_conv;
33564         }
33565         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33566         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
33567 }
33568
33569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33570         LDKAcceptChannel o_conv;
33571         o_conv.inner = untag_ptr(o);
33572         o_conv.is_owned = ptr_is_owned(o);
33573         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33574         o_conv = AcceptChannel_clone(&o_conv);
33575         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33576         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
33577         return tag_ptr(ret_conv, true);
33578 }
33579
33580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33581         void* e_ptr = untag_ptr(e);
33582         CHECK_ACCESS(e_ptr);
33583         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33584         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33585         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33586         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
33587         return tag_ptr(ret_conv, true);
33588 }
33589
33590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33591         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
33592         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
33593         return ret_conv;
33594 }
33595
33596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33597         if (!ptr_is_owned(_res)) return;
33598         void* _res_ptr = untag_ptr(_res);
33599         CHECK_ACCESS(_res_ptr);
33600         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
33601         FREE(untag_ptr(_res));
33602         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
33603 }
33604
33605 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
33606         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33607         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
33608         return tag_ptr(ret_conv, true);
33609 }
33610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33611         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
33612         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
33613         return ret_conv;
33614 }
33615
33616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33617         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
33618         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33619         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
33620         return tag_ptr(ret_conv, true);
33621 }
33622
33623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33624         LDKAcceptChannelV2 o_conv;
33625         o_conv.inner = untag_ptr(o);
33626         o_conv.is_owned = ptr_is_owned(o);
33627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33628         o_conv = AcceptChannelV2_clone(&o_conv);
33629         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33630         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
33631         return tag_ptr(ret_conv, true);
33632 }
33633
33634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33635         void* e_ptr = untag_ptr(e);
33636         CHECK_ACCESS(e_ptr);
33637         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33638         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33639         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33640         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
33641         return tag_ptr(ret_conv, true);
33642 }
33643
33644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33645         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
33646         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
33647         return ret_conv;
33648 }
33649
33650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33651         if (!ptr_is_owned(_res)) return;
33652         void* _res_ptr = untag_ptr(_res);
33653         CHECK_ACCESS(_res_ptr);
33654         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
33655         FREE(untag_ptr(_res));
33656         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
33657 }
33658
33659 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
33660         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33661         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
33662         return tag_ptr(ret_conv, true);
33663 }
33664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33665         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
33666         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
33667         return ret_conv;
33668 }
33669
33670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33671         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
33672         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33673         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
33674         return tag_ptr(ret_conv, true);
33675 }
33676
33677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33678         LDKStfu o_conv;
33679         o_conv.inner = untag_ptr(o);
33680         o_conv.is_owned = ptr_is_owned(o);
33681         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33682         o_conv = Stfu_clone(&o_conv);
33683         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33684         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
33685         return tag_ptr(ret_conv, true);
33686 }
33687
33688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33689         void* e_ptr = untag_ptr(e);
33690         CHECK_ACCESS(e_ptr);
33691         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33692         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33693         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33694         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
33695         return tag_ptr(ret_conv, true);
33696 }
33697
33698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33699         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
33700         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
33701         return ret_conv;
33702 }
33703
33704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33705         if (!ptr_is_owned(_res)) return;
33706         void* _res_ptr = untag_ptr(_res);
33707         CHECK_ACCESS(_res_ptr);
33708         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
33709         FREE(untag_ptr(_res));
33710         CResult_StfuDecodeErrorZ_free(_res_conv);
33711 }
33712
33713 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
33714         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33715         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
33716         return tag_ptr(ret_conv, true);
33717 }
33718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33719         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
33720         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
33721         return ret_conv;
33722 }
33723
33724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33725         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
33726         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33727         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
33728         return tag_ptr(ret_conv, true);
33729 }
33730
33731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33732         LDKSplice o_conv;
33733         o_conv.inner = untag_ptr(o);
33734         o_conv.is_owned = ptr_is_owned(o);
33735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33736         o_conv = Splice_clone(&o_conv);
33737         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33738         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
33739         return tag_ptr(ret_conv, true);
33740 }
33741
33742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33743         void* e_ptr = untag_ptr(e);
33744         CHECK_ACCESS(e_ptr);
33745         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33746         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33747         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33748         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
33749         return tag_ptr(ret_conv, true);
33750 }
33751
33752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33753         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
33754         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
33755         return ret_conv;
33756 }
33757
33758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33759         if (!ptr_is_owned(_res)) return;
33760         void* _res_ptr = untag_ptr(_res);
33761         CHECK_ACCESS(_res_ptr);
33762         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
33763         FREE(untag_ptr(_res));
33764         CResult_SpliceDecodeErrorZ_free(_res_conv);
33765 }
33766
33767 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
33768         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33769         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
33770         return tag_ptr(ret_conv, true);
33771 }
33772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33773         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
33774         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
33775         return ret_conv;
33776 }
33777
33778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33779         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
33780         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33781         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
33782         return tag_ptr(ret_conv, true);
33783 }
33784
33785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33786         LDKSpliceAck o_conv;
33787         o_conv.inner = untag_ptr(o);
33788         o_conv.is_owned = ptr_is_owned(o);
33789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33790         o_conv = SpliceAck_clone(&o_conv);
33791         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33792         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
33793         return tag_ptr(ret_conv, true);
33794 }
33795
33796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33797         void* e_ptr = untag_ptr(e);
33798         CHECK_ACCESS(e_ptr);
33799         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33800         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33801         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33802         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
33803         return tag_ptr(ret_conv, true);
33804 }
33805
33806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33807         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
33808         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
33809         return ret_conv;
33810 }
33811
33812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33813         if (!ptr_is_owned(_res)) return;
33814         void* _res_ptr = untag_ptr(_res);
33815         CHECK_ACCESS(_res_ptr);
33816         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
33817         FREE(untag_ptr(_res));
33818         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
33819 }
33820
33821 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
33822         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33823         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
33824         return tag_ptr(ret_conv, true);
33825 }
33826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33827         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
33828         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
33829         return ret_conv;
33830 }
33831
33832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33833         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
33834         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33835         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
33836         return tag_ptr(ret_conv, true);
33837 }
33838
33839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33840         LDKSpliceLocked o_conv;
33841         o_conv.inner = untag_ptr(o);
33842         o_conv.is_owned = ptr_is_owned(o);
33843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33844         o_conv = SpliceLocked_clone(&o_conv);
33845         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33846         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
33847         return tag_ptr(ret_conv, true);
33848 }
33849
33850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33851         void* e_ptr = untag_ptr(e);
33852         CHECK_ACCESS(e_ptr);
33853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33855         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33856         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
33857         return tag_ptr(ret_conv, true);
33858 }
33859
33860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33861         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
33862         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
33863         return ret_conv;
33864 }
33865
33866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33867         if (!ptr_is_owned(_res)) return;
33868         void* _res_ptr = untag_ptr(_res);
33869         CHECK_ACCESS(_res_ptr);
33870         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
33871         FREE(untag_ptr(_res));
33872         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
33873 }
33874
33875 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
33876         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33877         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
33878         return tag_ptr(ret_conv, true);
33879 }
33880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33881         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
33882         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
33883         return ret_conv;
33884 }
33885
33886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33887         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
33888         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33889         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
33890         return tag_ptr(ret_conv, true);
33891 }
33892
33893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33894         LDKTxAddInput o_conv;
33895         o_conv.inner = untag_ptr(o);
33896         o_conv.is_owned = ptr_is_owned(o);
33897         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33898         o_conv = TxAddInput_clone(&o_conv);
33899         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33900         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
33901         return tag_ptr(ret_conv, true);
33902 }
33903
33904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33905         void* e_ptr = untag_ptr(e);
33906         CHECK_ACCESS(e_ptr);
33907         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33908         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33909         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33910         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
33911         return tag_ptr(ret_conv, true);
33912 }
33913
33914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33915         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
33916         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
33917         return ret_conv;
33918 }
33919
33920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33921         if (!ptr_is_owned(_res)) return;
33922         void* _res_ptr = untag_ptr(_res);
33923         CHECK_ACCESS(_res_ptr);
33924         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
33925         FREE(untag_ptr(_res));
33926         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
33927 }
33928
33929 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
33930         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33931         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
33932         return tag_ptr(ret_conv, true);
33933 }
33934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33935         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
33936         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
33937         return ret_conv;
33938 }
33939
33940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33941         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
33942         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33943         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
33944         return tag_ptr(ret_conv, true);
33945 }
33946
33947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33948         LDKTxAddOutput o_conv;
33949         o_conv.inner = untag_ptr(o);
33950         o_conv.is_owned = ptr_is_owned(o);
33951         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33952         o_conv = TxAddOutput_clone(&o_conv);
33953         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33954         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
33955         return tag_ptr(ret_conv, true);
33956 }
33957
33958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33959         void* e_ptr = untag_ptr(e);
33960         CHECK_ACCESS(e_ptr);
33961         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33962         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33963         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33964         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
33965         return tag_ptr(ret_conv, true);
33966 }
33967
33968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33969         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
33970         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
33971         return ret_conv;
33972 }
33973
33974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33975         if (!ptr_is_owned(_res)) return;
33976         void* _res_ptr = untag_ptr(_res);
33977         CHECK_ACCESS(_res_ptr);
33978         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
33979         FREE(untag_ptr(_res));
33980         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
33981 }
33982
33983 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
33984         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33985         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
33986         return tag_ptr(ret_conv, true);
33987 }
33988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33989         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
33990         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
33991         return ret_conv;
33992 }
33993
33994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33995         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
33996         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33997         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
33998         return tag_ptr(ret_conv, true);
33999 }
34000
34001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34002         LDKTxRemoveInput o_conv;
34003         o_conv.inner = untag_ptr(o);
34004         o_conv.is_owned = ptr_is_owned(o);
34005         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34006         o_conv = TxRemoveInput_clone(&o_conv);
34007         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34008         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
34009         return tag_ptr(ret_conv, true);
34010 }
34011
34012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34013         void* e_ptr = untag_ptr(e);
34014         CHECK_ACCESS(e_ptr);
34015         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34016         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34017         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34018         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
34019         return tag_ptr(ret_conv, true);
34020 }
34021
34022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34023         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
34024         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
34025         return ret_conv;
34026 }
34027
34028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34029         if (!ptr_is_owned(_res)) return;
34030         void* _res_ptr = untag_ptr(_res);
34031         CHECK_ACCESS(_res_ptr);
34032         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
34033         FREE(untag_ptr(_res));
34034         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
34035 }
34036
34037 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
34038         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34039         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
34040         return tag_ptr(ret_conv, true);
34041 }
34042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34043         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
34044         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
34045         return ret_conv;
34046 }
34047
34048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34049         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
34050         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34051         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
34052         return tag_ptr(ret_conv, true);
34053 }
34054
34055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34056         LDKTxRemoveOutput o_conv;
34057         o_conv.inner = untag_ptr(o);
34058         o_conv.is_owned = ptr_is_owned(o);
34059         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34060         o_conv = TxRemoveOutput_clone(&o_conv);
34061         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34062         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
34063         return tag_ptr(ret_conv, true);
34064 }
34065
34066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34067         void* e_ptr = untag_ptr(e);
34068         CHECK_ACCESS(e_ptr);
34069         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34070         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34071         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34072         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
34073         return tag_ptr(ret_conv, true);
34074 }
34075
34076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34077         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
34078         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
34079         return ret_conv;
34080 }
34081
34082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34083         if (!ptr_is_owned(_res)) return;
34084         void* _res_ptr = untag_ptr(_res);
34085         CHECK_ACCESS(_res_ptr);
34086         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
34087         FREE(untag_ptr(_res));
34088         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
34089 }
34090
34091 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
34092         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34093         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
34094         return tag_ptr(ret_conv, true);
34095 }
34096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34097         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
34098         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
34099         return ret_conv;
34100 }
34101
34102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34103         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
34104         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34105         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
34106         return tag_ptr(ret_conv, true);
34107 }
34108
34109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34110         LDKTxComplete o_conv;
34111         o_conv.inner = untag_ptr(o);
34112         o_conv.is_owned = ptr_is_owned(o);
34113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34114         o_conv = TxComplete_clone(&o_conv);
34115         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34116         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
34117         return tag_ptr(ret_conv, true);
34118 }
34119
34120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34121         void* e_ptr = untag_ptr(e);
34122         CHECK_ACCESS(e_ptr);
34123         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34124         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34125         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34126         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
34127         return tag_ptr(ret_conv, true);
34128 }
34129
34130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34131         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
34132         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
34133         return ret_conv;
34134 }
34135
34136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34137         if (!ptr_is_owned(_res)) return;
34138         void* _res_ptr = untag_ptr(_res);
34139         CHECK_ACCESS(_res_ptr);
34140         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
34141         FREE(untag_ptr(_res));
34142         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
34143 }
34144
34145 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
34146         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34147         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
34148         return tag_ptr(ret_conv, true);
34149 }
34150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34151         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
34152         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
34153         return ret_conv;
34154 }
34155
34156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34157         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
34158         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34159         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
34160         return tag_ptr(ret_conv, true);
34161 }
34162
34163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34164         LDKTxSignatures o_conv;
34165         o_conv.inner = untag_ptr(o);
34166         o_conv.is_owned = ptr_is_owned(o);
34167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34168         o_conv = TxSignatures_clone(&o_conv);
34169         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34170         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
34171         return tag_ptr(ret_conv, true);
34172 }
34173
34174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34175         void* e_ptr = untag_ptr(e);
34176         CHECK_ACCESS(e_ptr);
34177         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34178         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34179         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34180         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
34181         return tag_ptr(ret_conv, true);
34182 }
34183
34184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34185         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
34186         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
34187         return ret_conv;
34188 }
34189
34190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34191         if (!ptr_is_owned(_res)) return;
34192         void* _res_ptr = untag_ptr(_res);
34193         CHECK_ACCESS(_res_ptr);
34194         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
34195         FREE(untag_ptr(_res));
34196         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
34197 }
34198
34199 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
34200         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34201         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
34202         return tag_ptr(ret_conv, true);
34203 }
34204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34205         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
34206         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
34207         return ret_conv;
34208 }
34209
34210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34211         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
34212         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34213         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
34214         return tag_ptr(ret_conv, true);
34215 }
34216
34217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34218         LDKTxInitRbf o_conv;
34219         o_conv.inner = untag_ptr(o);
34220         o_conv.is_owned = ptr_is_owned(o);
34221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34222         o_conv = TxInitRbf_clone(&o_conv);
34223         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34224         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
34225         return tag_ptr(ret_conv, true);
34226 }
34227
34228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34229         void* e_ptr = untag_ptr(e);
34230         CHECK_ACCESS(e_ptr);
34231         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34232         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34233         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34234         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
34235         return tag_ptr(ret_conv, true);
34236 }
34237
34238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34239         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
34240         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
34241         return ret_conv;
34242 }
34243
34244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34245         if (!ptr_is_owned(_res)) return;
34246         void* _res_ptr = untag_ptr(_res);
34247         CHECK_ACCESS(_res_ptr);
34248         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
34249         FREE(untag_ptr(_res));
34250         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
34251 }
34252
34253 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
34254         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34255         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
34256         return tag_ptr(ret_conv, true);
34257 }
34258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34259         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
34260         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
34261         return ret_conv;
34262 }
34263
34264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34265         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
34266         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34267         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
34268         return tag_ptr(ret_conv, true);
34269 }
34270
34271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34272         LDKTxAckRbf o_conv;
34273         o_conv.inner = untag_ptr(o);
34274         o_conv.is_owned = ptr_is_owned(o);
34275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34276         o_conv = TxAckRbf_clone(&o_conv);
34277         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34278         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
34279         return tag_ptr(ret_conv, true);
34280 }
34281
34282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34283         void* e_ptr = untag_ptr(e);
34284         CHECK_ACCESS(e_ptr);
34285         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34286         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34287         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34288         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
34289         return tag_ptr(ret_conv, true);
34290 }
34291
34292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34293         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
34294         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
34295         return ret_conv;
34296 }
34297
34298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34299         if (!ptr_is_owned(_res)) return;
34300         void* _res_ptr = untag_ptr(_res);
34301         CHECK_ACCESS(_res_ptr);
34302         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
34303         FREE(untag_ptr(_res));
34304         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
34305 }
34306
34307 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
34308         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34309         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
34310         return tag_ptr(ret_conv, true);
34311 }
34312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34313         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
34314         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
34315         return ret_conv;
34316 }
34317
34318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34319         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
34320         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34321         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
34322         return tag_ptr(ret_conv, true);
34323 }
34324
34325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34326         LDKTxAbort o_conv;
34327         o_conv.inner = untag_ptr(o);
34328         o_conv.is_owned = ptr_is_owned(o);
34329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34330         o_conv = TxAbort_clone(&o_conv);
34331         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34332         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
34333         return tag_ptr(ret_conv, true);
34334 }
34335
34336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34337         void* e_ptr = untag_ptr(e);
34338         CHECK_ACCESS(e_ptr);
34339         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34340         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34341         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34342         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
34343         return tag_ptr(ret_conv, true);
34344 }
34345
34346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34347         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
34348         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
34349         return ret_conv;
34350 }
34351
34352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34353         if (!ptr_is_owned(_res)) return;
34354         void* _res_ptr = untag_ptr(_res);
34355         CHECK_ACCESS(_res_ptr);
34356         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
34357         FREE(untag_ptr(_res));
34358         CResult_TxAbortDecodeErrorZ_free(_res_conv);
34359 }
34360
34361 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
34362         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34363         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
34364         return tag_ptr(ret_conv, true);
34365 }
34366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34367         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
34368         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
34369         return ret_conv;
34370 }
34371
34372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34373         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
34374         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34375         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
34376         return tag_ptr(ret_conv, true);
34377 }
34378
34379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34380         LDKAnnouncementSignatures o_conv;
34381         o_conv.inner = untag_ptr(o);
34382         o_conv.is_owned = ptr_is_owned(o);
34383         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34384         o_conv = AnnouncementSignatures_clone(&o_conv);
34385         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34386         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
34387         return tag_ptr(ret_conv, true);
34388 }
34389
34390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34391         void* e_ptr = untag_ptr(e);
34392         CHECK_ACCESS(e_ptr);
34393         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34394         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34395         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34396         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
34397         return tag_ptr(ret_conv, true);
34398 }
34399
34400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34401         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
34402         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
34403         return ret_conv;
34404 }
34405
34406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34407         if (!ptr_is_owned(_res)) return;
34408         void* _res_ptr = untag_ptr(_res);
34409         CHECK_ACCESS(_res_ptr);
34410         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
34411         FREE(untag_ptr(_res));
34412         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
34413 }
34414
34415 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
34416         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34417         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
34418         return tag_ptr(ret_conv, true);
34419 }
34420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34421         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
34422         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
34423         return ret_conv;
34424 }
34425
34426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34427         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
34428         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34429         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
34430         return tag_ptr(ret_conv, true);
34431 }
34432
34433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34434         LDKChannelReestablish o_conv;
34435         o_conv.inner = untag_ptr(o);
34436         o_conv.is_owned = ptr_is_owned(o);
34437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34438         o_conv = ChannelReestablish_clone(&o_conv);
34439         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34440         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
34441         return tag_ptr(ret_conv, true);
34442 }
34443
34444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34445         void* e_ptr = untag_ptr(e);
34446         CHECK_ACCESS(e_ptr);
34447         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34448         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34449         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34450         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
34451         return tag_ptr(ret_conv, true);
34452 }
34453
34454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34455         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
34456         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
34457         return ret_conv;
34458 }
34459
34460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34461         if (!ptr_is_owned(_res)) return;
34462         void* _res_ptr = untag_ptr(_res);
34463         CHECK_ACCESS(_res_ptr);
34464         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
34465         FREE(untag_ptr(_res));
34466         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
34467 }
34468
34469 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
34470         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34471         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
34472         return tag_ptr(ret_conv, true);
34473 }
34474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34475         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
34476         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
34477         return ret_conv;
34478 }
34479
34480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34481         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
34482         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34483         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
34484         return tag_ptr(ret_conv, true);
34485 }
34486
34487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34488         LDKClosingSigned o_conv;
34489         o_conv.inner = untag_ptr(o);
34490         o_conv.is_owned = ptr_is_owned(o);
34491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34492         o_conv = ClosingSigned_clone(&o_conv);
34493         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34494         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
34495         return tag_ptr(ret_conv, true);
34496 }
34497
34498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34499         void* e_ptr = untag_ptr(e);
34500         CHECK_ACCESS(e_ptr);
34501         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34502         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34503         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34504         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
34505         return tag_ptr(ret_conv, true);
34506 }
34507
34508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34509         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
34510         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
34511         return ret_conv;
34512 }
34513
34514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34515         if (!ptr_is_owned(_res)) return;
34516         void* _res_ptr = untag_ptr(_res);
34517         CHECK_ACCESS(_res_ptr);
34518         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
34519         FREE(untag_ptr(_res));
34520         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
34521 }
34522
34523 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
34524         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34525         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
34526         return tag_ptr(ret_conv, true);
34527 }
34528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34529         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
34530         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
34531         return ret_conv;
34532 }
34533
34534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34535         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
34536         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34537         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
34538         return tag_ptr(ret_conv, true);
34539 }
34540
34541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34542         LDKClosingSignedFeeRange o_conv;
34543         o_conv.inner = untag_ptr(o);
34544         o_conv.is_owned = ptr_is_owned(o);
34545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34546         o_conv = ClosingSignedFeeRange_clone(&o_conv);
34547         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34548         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
34549         return tag_ptr(ret_conv, true);
34550 }
34551
34552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34553         void* e_ptr = untag_ptr(e);
34554         CHECK_ACCESS(e_ptr);
34555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34557         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34558         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
34559         return tag_ptr(ret_conv, true);
34560 }
34561
34562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34563         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
34564         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
34565         return ret_conv;
34566 }
34567
34568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34569         if (!ptr_is_owned(_res)) return;
34570         void* _res_ptr = untag_ptr(_res);
34571         CHECK_ACCESS(_res_ptr);
34572         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
34573         FREE(untag_ptr(_res));
34574         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
34575 }
34576
34577 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
34578         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34579         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
34580         return tag_ptr(ret_conv, true);
34581 }
34582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34583         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
34584         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
34585         return ret_conv;
34586 }
34587
34588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34589         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
34590         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34591         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
34592         return tag_ptr(ret_conv, true);
34593 }
34594
34595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34596         LDKCommitmentSigned o_conv;
34597         o_conv.inner = untag_ptr(o);
34598         o_conv.is_owned = ptr_is_owned(o);
34599         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34600         o_conv = CommitmentSigned_clone(&o_conv);
34601         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34602         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
34603         return tag_ptr(ret_conv, true);
34604 }
34605
34606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34607         void* e_ptr = untag_ptr(e);
34608         CHECK_ACCESS(e_ptr);
34609         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34610         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34611         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34612         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
34613         return tag_ptr(ret_conv, true);
34614 }
34615
34616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34617         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
34618         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
34619         return ret_conv;
34620 }
34621
34622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34623         if (!ptr_is_owned(_res)) return;
34624         void* _res_ptr = untag_ptr(_res);
34625         CHECK_ACCESS(_res_ptr);
34626         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
34627         FREE(untag_ptr(_res));
34628         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
34629 }
34630
34631 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
34632         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34633         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
34634         return tag_ptr(ret_conv, true);
34635 }
34636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34637         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
34638         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
34639         return ret_conv;
34640 }
34641
34642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34643         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
34644         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34645         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
34646         return tag_ptr(ret_conv, true);
34647 }
34648
34649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34650         LDKFundingCreated o_conv;
34651         o_conv.inner = untag_ptr(o);
34652         o_conv.is_owned = ptr_is_owned(o);
34653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34654         o_conv = FundingCreated_clone(&o_conv);
34655         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34656         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
34657         return tag_ptr(ret_conv, true);
34658 }
34659
34660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34661         void* e_ptr = untag_ptr(e);
34662         CHECK_ACCESS(e_ptr);
34663         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34664         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34665         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34666         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
34667         return tag_ptr(ret_conv, true);
34668 }
34669
34670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34671         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
34672         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
34673         return ret_conv;
34674 }
34675
34676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34677         if (!ptr_is_owned(_res)) return;
34678         void* _res_ptr = untag_ptr(_res);
34679         CHECK_ACCESS(_res_ptr);
34680         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
34681         FREE(untag_ptr(_res));
34682         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
34683 }
34684
34685 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
34686         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34687         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
34688         return tag_ptr(ret_conv, true);
34689 }
34690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34691         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
34692         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
34693         return ret_conv;
34694 }
34695
34696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34697         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
34698         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34699         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
34700         return tag_ptr(ret_conv, true);
34701 }
34702
34703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34704         LDKFundingSigned o_conv;
34705         o_conv.inner = untag_ptr(o);
34706         o_conv.is_owned = ptr_is_owned(o);
34707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34708         o_conv = FundingSigned_clone(&o_conv);
34709         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34710         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
34711         return tag_ptr(ret_conv, true);
34712 }
34713
34714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34715         void* e_ptr = untag_ptr(e);
34716         CHECK_ACCESS(e_ptr);
34717         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34718         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34719         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34720         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
34721         return tag_ptr(ret_conv, true);
34722 }
34723
34724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34725         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
34726         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
34727         return ret_conv;
34728 }
34729
34730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34731         if (!ptr_is_owned(_res)) return;
34732         void* _res_ptr = untag_ptr(_res);
34733         CHECK_ACCESS(_res_ptr);
34734         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
34735         FREE(untag_ptr(_res));
34736         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
34737 }
34738
34739 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
34740         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34741         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
34742         return tag_ptr(ret_conv, true);
34743 }
34744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34745         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
34746         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
34747         return ret_conv;
34748 }
34749
34750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34751         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
34752         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34753         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
34754         return tag_ptr(ret_conv, true);
34755 }
34756
34757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34758         LDKChannelReady o_conv;
34759         o_conv.inner = untag_ptr(o);
34760         o_conv.is_owned = ptr_is_owned(o);
34761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34762         o_conv = ChannelReady_clone(&o_conv);
34763         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34764         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
34765         return tag_ptr(ret_conv, true);
34766 }
34767
34768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34769         void* e_ptr = untag_ptr(e);
34770         CHECK_ACCESS(e_ptr);
34771         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34772         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34773         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34774         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
34775         return tag_ptr(ret_conv, true);
34776 }
34777
34778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34779         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
34780         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
34781         return ret_conv;
34782 }
34783
34784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34785         if (!ptr_is_owned(_res)) return;
34786         void* _res_ptr = untag_ptr(_res);
34787         CHECK_ACCESS(_res_ptr);
34788         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
34789         FREE(untag_ptr(_res));
34790         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
34791 }
34792
34793 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
34794         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34795         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
34796         return tag_ptr(ret_conv, true);
34797 }
34798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34799         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
34800         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
34801         return ret_conv;
34802 }
34803
34804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34805         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
34806         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34807         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
34808         return tag_ptr(ret_conv, true);
34809 }
34810
34811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34812         LDKInit o_conv;
34813         o_conv.inner = untag_ptr(o);
34814         o_conv.is_owned = ptr_is_owned(o);
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34816         o_conv = Init_clone(&o_conv);
34817         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34818         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
34819         return tag_ptr(ret_conv, true);
34820 }
34821
34822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34823         void* e_ptr = untag_ptr(e);
34824         CHECK_ACCESS(e_ptr);
34825         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34826         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34827         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34828         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
34829         return tag_ptr(ret_conv, true);
34830 }
34831
34832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34833         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
34834         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
34835         return ret_conv;
34836 }
34837
34838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34839         if (!ptr_is_owned(_res)) return;
34840         void* _res_ptr = untag_ptr(_res);
34841         CHECK_ACCESS(_res_ptr);
34842         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
34843         FREE(untag_ptr(_res));
34844         CResult_InitDecodeErrorZ_free(_res_conv);
34845 }
34846
34847 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
34848         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34849         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
34850         return tag_ptr(ret_conv, true);
34851 }
34852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34853         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
34854         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
34855         return ret_conv;
34856 }
34857
34858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34859         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
34860         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34861         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
34862         return tag_ptr(ret_conv, true);
34863 }
34864
34865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34866         LDKOpenChannel o_conv;
34867         o_conv.inner = untag_ptr(o);
34868         o_conv.is_owned = ptr_is_owned(o);
34869         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34870         o_conv = OpenChannel_clone(&o_conv);
34871         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34872         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
34873         return tag_ptr(ret_conv, true);
34874 }
34875
34876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34877         void* e_ptr = untag_ptr(e);
34878         CHECK_ACCESS(e_ptr);
34879         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34880         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34881         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34882         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
34883         return tag_ptr(ret_conv, true);
34884 }
34885
34886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34887         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
34888         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
34889         return ret_conv;
34890 }
34891
34892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34893         if (!ptr_is_owned(_res)) return;
34894         void* _res_ptr = untag_ptr(_res);
34895         CHECK_ACCESS(_res_ptr);
34896         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
34897         FREE(untag_ptr(_res));
34898         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
34899 }
34900
34901 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
34902         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34903         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
34904         return tag_ptr(ret_conv, true);
34905 }
34906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34907         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
34908         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
34909         return ret_conv;
34910 }
34911
34912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34913         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
34914         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34915         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
34916         return tag_ptr(ret_conv, true);
34917 }
34918
34919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34920         LDKOpenChannelV2 o_conv;
34921         o_conv.inner = untag_ptr(o);
34922         o_conv.is_owned = ptr_is_owned(o);
34923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34924         o_conv = OpenChannelV2_clone(&o_conv);
34925         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34926         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
34927         return tag_ptr(ret_conv, true);
34928 }
34929
34930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34931         void* e_ptr = untag_ptr(e);
34932         CHECK_ACCESS(e_ptr);
34933         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34934         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34935         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34936         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
34937         return tag_ptr(ret_conv, true);
34938 }
34939
34940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34941         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
34942         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
34943         return ret_conv;
34944 }
34945
34946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34947         if (!ptr_is_owned(_res)) return;
34948         void* _res_ptr = untag_ptr(_res);
34949         CHECK_ACCESS(_res_ptr);
34950         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
34951         FREE(untag_ptr(_res));
34952         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
34953 }
34954
34955 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
34956         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34957         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
34958         return tag_ptr(ret_conv, true);
34959 }
34960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34961         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
34962         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
34963         return ret_conv;
34964 }
34965
34966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34967         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
34968         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34969         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
34970         return tag_ptr(ret_conv, true);
34971 }
34972
34973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34974         LDKRevokeAndACK o_conv;
34975         o_conv.inner = untag_ptr(o);
34976         o_conv.is_owned = ptr_is_owned(o);
34977         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34978         o_conv = RevokeAndACK_clone(&o_conv);
34979         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34980         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
34981         return tag_ptr(ret_conv, true);
34982 }
34983
34984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34985         void* e_ptr = untag_ptr(e);
34986         CHECK_ACCESS(e_ptr);
34987         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34988         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34989         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34990         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
34991         return tag_ptr(ret_conv, true);
34992 }
34993
34994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34995         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
34996         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
34997         return ret_conv;
34998 }
34999
35000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35001         if (!ptr_is_owned(_res)) return;
35002         void* _res_ptr = untag_ptr(_res);
35003         CHECK_ACCESS(_res_ptr);
35004         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
35005         FREE(untag_ptr(_res));
35006         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
35007 }
35008
35009 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
35010         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35011         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
35012         return tag_ptr(ret_conv, true);
35013 }
35014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35015         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
35016         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
35017         return ret_conv;
35018 }
35019
35020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35021         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
35022         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35023         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
35024         return tag_ptr(ret_conv, true);
35025 }
35026
35027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35028         LDKShutdown o_conv;
35029         o_conv.inner = untag_ptr(o);
35030         o_conv.is_owned = ptr_is_owned(o);
35031         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35032         o_conv = Shutdown_clone(&o_conv);
35033         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35034         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
35035         return tag_ptr(ret_conv, true);
35036 }
35037
35038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35039         void* e_ptr = untag_ptr(e);
35040         CHECK_ACCESS(e_ptr);
35041         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35042         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35043         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35044         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
35045         return tag_ptr(ret_conv, true);
35046 }
35047
35048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35049         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
35050         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
35051         return ret_conv;
35052 }
35053
35054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35055         if (!ptr_is_owned(_res)) return;
35056         void* _res_ptr = untag_ptr(_res);
35057         CHECK_ACCESS(_res_ptr);
35058         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
35059         FREE(untag_ptr(_res));
35060         CResult_ShutdownDecodeErrorZ_free(_res_conv);
35061 }
35062
35063 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
35064         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35065         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
35066         return tag_ptr(ret_conv, true);
35067 }
35068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35069         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
35070         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
35071         return ret_conv;
35072 }
35073
35074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35075         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
35076         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35077         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
35078         return tag_ptr(ret_conv, true);
35079 }
35080
35081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35082         LDKUpdateFailHTLC o_conv;
35083         o_conv.inner = untag_ptr(o);
35084         o_conv.is_owned = ptr_is_owned(o);
35085         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35086         o_conv = UpdateFailHTLC_clone(&o_conv);
35087         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35088         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
35089         return tag_ptr(ret_conv, true);
35090 }
35091
35092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35093         void* e_ptr = untag_ptr(e);
35094         CHECK_ACCESS(e_ptr);
35095         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35096         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35097         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35098         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
35099         return tag_ptr(ret_conv, true);
35100 }
35101
35102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35103         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
35104         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
35105         return ret_conv;
35106 }
35107
35108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35109         if (!ptr_is_owned(_res)) return;
35110         void* _res_ptr = untag_ptr(_res);
35111         CHECK_ACCESS(_res_ptr);
35112         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
35113         FREE(untag_ptr(_res));
35114         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
35115 }
35116
35117 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
35118         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35119         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
35120         return tag_ptr(ret_conv, true);
35121 }
35122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35123         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
35124         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
35125         return ret_conv;
35126 }
35127
35128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35129         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
35130         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35131         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
35132         return tag_ptr(ret_conv, true);
35133 }
35134
35135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35136         LDKUpdateFailMalformedHTLC o_conv;
35137         o_conv.inner = untag_ptr(o);
35138         o_conv.is_owned = ptr_is_owned(o);
35139         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35140         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
35141         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35142         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
35143         return tag_ptr(ret_conv, true);
35144 }
35145
35146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35147         void* e_ptr = untag_ptr(e);
35148         CHECK_ACCESS(e_ptr);
35149         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35150         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35151         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35152         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
35153         return tag_ptr(ret_conv, true);
35154 }
35155
35156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35157         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
35158         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
35159         return ret_conv;
35160 }
35161
35162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35163         if (!ptr_is_owned(_res)) return;
35164         void* _res_ptr = untag_ptr(_res);
35165         CHECK_ACCESS(_res_ptr);
35166         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
35167         FREE(untag_ptr(_res));
35168         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
35169 }
35170
35171 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
35172         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35173         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
35174         return tag_ptr(ret_conv, true);
35175 }
35176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35177         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
35178         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
35179         return ret_conv;
35180 }
35181
35182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35183         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
35184         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35185         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
35186         return tag_ptr(ret_conv, true);
35187 }
35188
35189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35190         LDKUpdateFee o_conv;
35191         o_conv.inner = untag_ptr(o);
35192         o_conv.is_owned = ptr_is_owned(o);
35193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35194         o_conv = UpdateFee_clone(&o_conv);
35195         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35196         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
35197         return tag_ptr(ret_conv, true);
35198 }
35199
35200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35201         void* e_ptr = untag_ptr(e);
35202         CHECK_ACCESS(e_ptr);
35203         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35204         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35205         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35206         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
35207         return tag_ptr(ret_conv, true);
35208 }
35209
35210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35211         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
35212         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
35213         return ret_conv;
35214 }
35215
35216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35217         if (!ptr_is_owned(_res)) return;
35218         void* _res_ptr = untag_ptr(_res);
35219         CHECK_ACCESS(_res_ptr);
35220         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
35221         FREE(untag_ptr(_res));
35222         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
35223 }
35224
35225 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
35226         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35227         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
35228         return tag_ptr(ret_conv, true);
35229 }
35230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35231         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
35232         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
35233         return ret_conv;
35234 }
35235
35236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35237         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
35238         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35239         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
35240         return tag_ptr(ret_conv, true);
35241 }
35242
35243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35244         LDKUpdateFulfillHTLC o_conv;
35245         o_conv.inner = untag_ptr(o);
35246         o_conv.is_owned = ptr_is_owned(o);
35247         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35248         o_conv = UpdateFulfillHTLC_clone(&o_conv);
35249         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35250         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
35251         return tag_ptr(ret_conv, true);
35252 }
35253
35254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35255         void* e_ptr = untag_ptr(e);
35256         CHECK_ACCESS(e_ptr);
35257         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35258         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35259         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35260         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
35261         return tag_ptr(ret_conv, true);
35262 }
35263
35264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35265         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
35266         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
35267         return ret_conv;
35268 }
35269
35270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35271         if (!ptr_is_owned(_res)) return;
35272         void* _res_ptr = untag_ptr(_res);
35273         CHECK_ACCESS(_res_ptr);
35274         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
35275         FREE(untag_ptr(_res));
35276         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
35277 }
35278
35279 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
35280         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35281         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
35282         return tag_ptr(ret_conv, true);
35283 }
35284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35285         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
35286         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
35287         return ret_conv;
35288 }
35289
35290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35291         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
35292         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35293         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
35294         return tag_ptr(ret_conv, true);
35295 }
35296
35297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35298         LDKOnionPacket o_conv;
35299         o_conv.inner = untag_ptr(o);
35300         o_conv.is_owned = ptr_is_owned(o);
35301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35302         o_conv = OnionPacket_clone(&o_conv);
35303         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35304         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
35305         return tag_ptr(ret_conv, true);
35306 }
35307
35308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35309         void* e_ptr = untag_ptr(e);
35310         CHECK_ACCESS(e_ptr);
35311         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35312         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35313         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35314         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
35315         return tag_ptr(ret_conv, true);
35316 }
35317
35318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35319         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
35320         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
35321         return ret_conv;
35322 }
35323
35324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35325         if (!ptr_is_owned(_res)) return;
35326         void* _res_ptr = untag_ptr(_res);
35327         CHECK_ACCESS(_res_ptr);
35328         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
35329         FREE(untag_ptr(_res));
35330         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
35331 }
35332
35333 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
35334         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35335         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
35336         return tag_ptr(ret_conv, true);
35337 }
35338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35339         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
35340         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
35341         return ret_conv;
35342 }
35343
35344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35345         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
35346         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35347         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
35348         return tag_ptr(ret_conv, true);
35349 }
35350
35351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35352         LDKUpdateAddHTLC o_conv;
35353         o_conv.inner = untag_ptr(o);
35354         o_conv.is_owned = ptr_is_owned(o);
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35356         o_conv = UpdateAddHTLC_clone(&o_conv);
35357         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35358         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
35359         return tag_ptr(ret_conv, true);
35360 }
35361
35362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35363         void* e_ptr = untag_ptr(e);
35364         CHECK_ACCESS(e_ptr);
35365         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35366         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35367         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35368         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
35369         return tag_ptr(ret_conv, true);
35370 }
35371
35372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35373         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
35374         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
35375         return ret_conv;
35376 }
35377
35378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35379         if (!ptr_is_owned(_res)) return;
35380         void* _res_ptr = untag_ptr(_res);
35381         CHECK_ACCESS(_res_ptr);
35382         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
35383         FREE(untag_ptr(_res));
35384         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
35385 }
35386
35387 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
35388         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35389         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
35390         return tag_ptr(ret_conv, true);
35391 }
35392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35393         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
35394         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
35395         return ret_conv;
35396 }
35397
35398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35399         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
35400         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35401         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
35402         return tag_ptr(ret_conv, true);
35403 }
35404
35405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35406         LDKOnionMessage o_conv;
35407         o_conv.inner = untag_ptr(o);
35408         o_conv.is_owned = ptr_is_owned(o);
35409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35410         o_conv = OnionMessage_clone(&o_conv);
35411         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35412         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
35413         return tag_ptr(ret_conv, true);
35414 }
35415
35416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35417         void* e_ptr = untag_ptr(e);
35418         CHECK_ACCESS(e_ptr);
35419         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35420         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35421         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35422         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
35423         return tag_ptr(ret_conv, true);
35424 }
35425
35426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35427         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
35428         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
35429         return ret_conv;
35430 }
35431
35432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35433         if (!ptr_is_owned(_res)) return;
35434         void* _res_ptr = untag_ptr(_res);
35435         CHECK_ACCESS(_res_ptr);
35436         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
35437         FREE(untag_ptr(_res));
35438         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
35439 }
35440
35441 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
35442         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35443         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
35444         return tag_ptr(ret_conv, true);
35445 }
35446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35447         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
35448         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
35449         return ret_conv;
35450 }
35451
35452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35453         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
35454         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35455         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
35456         return tag_ptr(ret_conv, true);
35457 }
35458
35459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35460         LDKFinalOnionHopData o_conv;
35461         o_conv.inner = untag_ptr(o);
35462         o_conv.is_owned = ptr_is_owned(o);
35463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35464         o_conv = FinalOnionHopData_clone(&o_conv);
35465         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35466         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
35467         return tag_ptr(ret_conv, true);
35468 }
35469
35470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35471         void* e_ptr = untag_ptr(e);
35472         CHECK_ACCESS(e_ptr);
35473         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35474         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35475         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35476         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
35477         return tag_ptr(ret_conv, true);
35478 }
35479
35480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35481         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
35482         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
35483         return ret_conv;
35484 }
35485
35486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35487         if (!ptr_is_owned(_res)) return;
35488         void* _res_ptr = untag_ptr(_res);
35489         CHECK_ACCESS(_res_ptr);
35490         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
35491         FREE(untag_ptr(_res));
35492         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
35493 }
35494
35495 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
35496         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35497         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
35498         return tag_ptr(ret_conv, true);
35499 }
35500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35501         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
35502         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
35503         return ret_conv;
35504 }
35505
35506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35507         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
35508         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35509         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
35510         return tag_ptr(ret_conv, true);
35511 }
35512
35513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35514         LDKPing o_conv;
35515         o_conv.inner = untag_ptr(o);
35516         o_conv.is_owned = ptr_is_owned(o);
35517         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35518         o_conv = Ping_clone(&o_conv);
35519         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35520         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
35521         return tag_ptr(ret_conv, true);
35522 }
35523
35524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35525         void* e_ptr = untag_ptr(e);
35526         CHECK_ACCESS(e_ptr);
35527         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35528         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35529         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35530         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
35531         return tag_ptr(ret_conv, true);
35532 }
35533
35534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35535         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
35536         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
35537         return ret_conv;
35538 }
35539
35540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35541         if (!ptr_is_owned(_res)) return;
35542         void* _res_ptr = untag_ptr(_res);
35543         CHECK_ACCESS(_res_ptr);
35544         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
35545         FREE(untag_ptr(_res));
35546         CResult_PingDecodeErrorZ_free(_res_conv);
35547 }
35548
35549 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
35550         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35551         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
35552         return tag_ptr(ret_conv, true);
35553 }
35554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35555         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
35556         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
35557         return ret_conv;
35558 }
35559
35560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35561         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
35562         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35563         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
35564         return tag_ptr(ret_conv, true);
35565 }
35566
35567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35568         LDKPong o_conv;
35569         o_conv.inner = untag_ptr(o);
35570         o_conv.is_owned = ptr_is_owned(o);
35571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35572         o_conv = Pong_clone(&o_conv);
35573         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35574         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
35575         return tag_ptr(ret_conv, true);
35576 }
35577
35578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35579         void* e_ptr = untag_ptr(e);
35580         CHECK_ACCESS(e_ptr);
35581         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35582         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35583         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35584         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
35585         return tag_ptr(ret_conv, true);
35586 }
35587
35588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35589         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
35590         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
35591         return ret_conv;
35592 }
35593
35594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35595         if (!ptr_is_owned(_res)) return;
35596         void* _res_ptr = untag_ptr(_res);
35597         CHECK_ACCESS(_res_ptr);
35598         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
35599         FREE(untag_ptr(_res));
35600         CResult_PongDecodeErrorZ_free(_res_conv);
35601 }
35602
35603 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
35604         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35605         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
35606         return tag_ptr(ret_conv, true);
35607 }
35608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35609         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
35610         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
35611         return ret_conv;
35612 }
35613
35614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35615         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
35616         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35617         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
35618         return tag_ptr(ret_conv, true);
35619 }
35620
35621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35622         LDKUnsignedChannelAnnouncement o_conv;
35623         o_conv.inner = untag_ptr(o);
35624         o_conv.is_owned = ptr_is_owned(o);
35625         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35626         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
35627         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35628         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
35629         return tag_ptr(ret_conv, true);
35630 }
35631
35632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35633         void* e_ptr = untag_ptr(e);
35634         CHECK_ACCESS(e_ptr);
35635         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35636         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35637         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35638         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
35639         return tag_ptr(ret_conv, true);
35640 }
35641
35642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35643         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
35644         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
35645         return ret_conv;
35646 }
35647
35648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35649         if (!ptr_is_owned(_res)) return;
35650         void* _res_ptr = untag_ptr(_res);
35651         CHECK_ACCESS(_res_ptr);
35652         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
35653         FREE(untag_ptr(_res));
35654         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
35655 }
35656
35657 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35658         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35659         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
35660         return tag_ptr(ret_conv, true);
35661 }
35662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35663         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
35664         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35665         return ret_conv;
35666 }
35667
35668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35669         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
35670         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35671         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
35672         return tag_ptr(ret_conv, true);
35673 }
35674
35675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35676         LDKChannelAnnouncement o_conv;
35677         o_conv.inner = untag_ptr(o);
35678         o_conv.is_owned = ptr_is_owned(o);
35679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35680         o_conv = ChannelAnnouncement_clone(&o_conv);
35681         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35682         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
35683         return tag_ptr(ret_conv, true);
35684 }
35685
35686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35687         void* e_ptr = untag_ptr(e);
35688         CHECK_ACCESS(e_ptr);
35689         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35690         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35691         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35692         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
35693         return tag_ptr(ret_conv, true);
35694 }
35695
35696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35697         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
35698         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
35699         return ret_conv;
35700 }
35701
35702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35703         if (!ptr_is_owned(_res)) return;
35704         void* _res_ptr = untag_ptr(_res);
35705         CHECK_ACCESS(_res_ptr);
35706         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
35707         FREE(untag_ptr(_res));
35708         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
35709 }
35710
35711 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35712         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35713         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
35714         return tag_ptr(ret_conv, true);
35715 }
35716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35717         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
35718         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35719         return ret_conv;
35720 }
35721
35722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35723         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
35724         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35725         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
35726         return tag_ptr(ret_conv, true);
35727 }
35728
35729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35730         LDKUnsignedChannelUpdate o_conv;
35731         o_conv.inner = untag_ptr(o);
35732         o_conv.is_owned = ptr_is_owned(o);
35733         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35734         o_conv = UnsignedChannelUpdate_clone(&o_conv);
35735         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35736         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
35737         return tag_ptr(ret_conv, true);
35738 }
35739
35740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35741         void* e_ptr = untag_ptr(e);
35742         CHECK_ACCESS(e_ptr);
35743         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35744         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35745         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35746         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
35747         return tag_ptr(ret_conv, true);
35748 }
35749
35750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35751         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
35752         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
35753         return ret_conv;
35754 }
35755
35756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35757         if (!ptr_is_owned(_res)) return;
35758         void* _res_ptr = untag_ptr(_res);
35759         CHECK_ACCESS(_res_ptr);
35760         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
35761         FREE(untag_ptr(_res));
35762         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
35763 }
35764
35765 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
35766         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35767         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
35768         return tag_ptr(ret_conv, true);
35769 }
35770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35771         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
35772         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
35773         return ret_conv;
35774 }
35775
35776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35777         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
35778         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35779         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
35780         return tag_ptr(ret_conv, true);
35781 }
35782
35783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35784         LDKChannelUpdate o_conv;
35785         o_conv.inner = untag_ptr(o);
35786         o_conv.is_owned = ptr_is_owned(o);
35787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35788         o_conv = ChannelUpdate_clone(&o_conv);
35789         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35790         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
35791         return tag_ptr(ret_conv, true);
35792 }
35793
35794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35795         void* e_ptr = untag_ptr(e);
35796         CHECK_ACCESS(e_ptr);
35797         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35798         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35799         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35800         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
35801         return tag_ptr(ret_conv, true);
35802 }
35803
35804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35805         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
35806         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
35807         return ret_conv;
35808 }
35809
35810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35811         if (!ptr_is_owned(_res)) return;
35812         void* _res_ptr = untag_ptr(_res);
35813         CHECK_ACCESS(_res_ptr);
35814         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
35815         FREE(untag_ptr(_res));
35816         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
35817 }
35818
35819 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
35820         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35821         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
35822         return tag_ptr(ret_conv, true);
35823 }
35824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35825         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
35826         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
35827         return ret_conv;
35828 }
35829
35830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35831         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
35832         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35833         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
35834         return tag_ptr(ret_conv, true);
35835 }
35836
35837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35838         LDKErrorMessage o_conv;
35839         o_conv.inner = untag_ptr(o);
35840         o_conv.is_owned = ptr_is_owned(o);
35841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35842         o_conv = ErrorMessage_clone(&o_conv);
35843         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35844         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
35845         return tag_ptr(ret_conv, true);
35846 }
35847
35848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35849         void* e_ptr = untag_ptr(e);
35850         CHECK_ACCESS(e_ptr);
35851         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35852         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35853         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35854         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
35855         return tag_ptr(ret_conv, true);
35856 }
35857
35858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35859         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
35860         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
35861         return ret_conv;
35862 }
35863
35864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35865         if (!ptr_is_owned(_res)) return;
35866         void* _res_ptr = untag_ptr(_res);
35867         CHECK_ACCESS(_res_ptr);
35868         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
35869         FREE(untag_ptr(_res));
35870         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
35871 }
35872
35873 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
35874         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35875         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
35876         return tag_ptr(ret_conv, true);
35877 }
35878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35879         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
35880         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
35881         return ret_conv;
35882 }
35883
35884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35885         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
35886         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35887         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
35888         return tag_ptr(ret_conv, true);
35889 }
35890
35891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35892         LDKWarningMessage o_conv;
35893         o_conv.inner = untag_ptr(o);
35894         o_conv.is_owned = ptr_is_owned(o);
35895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35896         o_conv = WarningMessage_clone(&o_conv);
35897         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35898         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
35899         return tag_ptr(ret_conv, true);
35900 }
35901
35902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35903         void* e_ptr = untag_ptr(e);
35904         CHECK_ACCESS(e_ptr);
35905         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35906         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35907         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35908         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
35909         return tag_ptr(ret_conv, true);
35910 }
35911
35912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35913         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
35914         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
35915         return ret_conv;
35916 }
35917
35918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35919         if (!ptr_is_owned(_res)) return;
35920         void* _res_ptr = untag_ptr(_res);
35921         CHECK_ACCESS(_res_ptr);
35922         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
35923         FREE(untag_ptr(_res));
35924         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
35925 }
35926
35927 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
35928         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35929         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
35930         return tag_ptr(ret_conv, true);
35931 }
35932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35933         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
35934         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
35935         return ret_conv;
35936 }
35937
35938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35939         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
35940         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35941         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
35942         return tag_ptr(ret_conv, true);
35943 }
35944
35945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35946         LDKUnsignedNodeAnnouncement o_conv;
35947         o_conv.inner = untag_ptr(o);
35948         o_conv.is_owned = ptr_is_owned(o);
35949         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35950         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
35951         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35952         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
35953         return tag_ptr(ret_conv, true);
35954 }
35955
35956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35957         void* e_ptr = untag_ptr(e);
35958         CHECK_ACCESS(e_ptr);
35959         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35960         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35961         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35962         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
35963         return tag_ptr(ret_conv, true);
35964 }
35965
35966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35967         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
35968         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
35969         return ret_conv;
35970 }
35971
35972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35973         if (!ptr_is_owned(_res)) return;
35974         void* _res_ptr = untag_ptr(_res);
35975         CHECK_ACCESS(_res_ptr);
35976         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
35977         FREE(untag_ptr(_res));
35978         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
35979 }
35980
35981 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35982         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35983         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
35984         return tag_ptr(ret_conv, true);
35985 }
35986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35987         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
35988         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35989         return ret_conv;
35990 }
35991
35992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35993         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
35994         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35995         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
35996         return tag_ptr(ret_conv, true);
35997 }
35998
35999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36000         LDKNodeAnnouncement o_conv;
36001         o_conv.inner = untag_ptr(o);
36002         o_conv.is_owned = ptr_is_owned(o);
36003         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36004         o_conv = NodeAnnouncement_clone(&o_conv);
36005         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36006         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
36007         return tag_ptr(ret_conv, true);
36008 }
36009
36010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36011         void* e_ptr = untag_ptr(e);
36012         CHECK_ACCESS(e_ptr);
36013         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36014         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36015         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36016         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
36017         return tag_ptr(ret_conv, true);
36018 }
36019
36020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36021         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
36022         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
36023         return ret_conv;
36024 }
36025
36026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36027         if (!ptr_is_owned(_res)) return;
36028         void* _res_ptr = untag_ptr(_res);
36029         CHECK_ACCESS(_res_ptr);
36030         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
36031         FREE(untag_ptr(_res));
36032         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
36033 }
36034
36035 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
36036         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36037         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
36038         return tag_ptr(ret_conv, true);
36039 }
36040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36041         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
36042         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
36043         return ret_conv;
36044 }
36045
36046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36047         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
36048         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36049         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
36050         return tag_ptr(ret_conv, true);
36051 }
36052
36053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36054         LDKQueryShortChannelIds o_conv;
36055         o_conv.inner = untag_ptr(o);
36056         o_conv.is_owned = ptr_is_owned(o);
36057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36058         o_conv = QueryShortChannelIds_clone(&o_conv);
36059         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36060         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
36061         return tag_ptr(ret_conv, true);
36062 }
36063
36064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36065         void* e_ptr = untag_ptr(e);
36066         CHECK_ACCESS(e_ptr);
36067         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36068         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36069         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36070         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
36071         return tag_ptr(ret_conv, true);
36072 }
36073
36074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36075         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
36076         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
36077         return ret_conv;
36078 }
36079
36080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36081         if (!ptr_is_owned(_res)) return;
36082         void* _res_ptr = untag_ptr(_res);
36083         CHECK_ACCESS(_res_ptr);
36084         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
36085         FREE(untag_ptr(_res));
36086         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
36087 }
36088
36089 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
36090         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36091         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
36092         return tag_ptr(ret_conv, true);
36093 }
36094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36095         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
36096         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
36097         return ret_conv;
36098 }
36099
36100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36101         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
36102         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36103         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
36104         return tag_ptr(ret_conv, true);
36105 }
36106
36107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36108         LDKReplyShortChannelIdsEnd o_conv;
36109         o_conv.inner = untag_ptr(o);
36110         o_conv.is_owned = ptr_is_owned(o);
36111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36112         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
36113         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36114         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
36115         return tag_ptr(ret_conv, true);
36116 }
36117
36118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36119         void* e_ptr = untag_ptr(e);
36120         CHECK_ACCESS(e_ptr);
36121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36123         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36124         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
36125         return tag_ptr(ret_conv, true);
36126 }
36127
36128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36129         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
36130         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
36131         return ret_conv;
36132 }
36133
36134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36135         if (!ptr_is_owned(_res)) return;
36136         void* _res_ptr = untag_ptr(_res);
36137         CHECK_ACCESS(_res_ptr);
36138         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
36139         FREE(untag_ptr(_res));
36140         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
36141 }
36142
36143 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
36144         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36145         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
36146         return tag_ptr(ret_conv, true);
36147 }
36148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36149         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
36150         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
36151         return ret_conv;
36152 }
36153
36154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36155         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
36156         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36157         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
36158         return tag_ptr(ret_conv, true);
36159 }
36160
36161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36162         LDKQueryChannelRange o_conv;
36163         o_conv.inner = untag_ptr(o);
36164         o_conv.is_owned = ptr_is_owned(o);
36165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36166         o_conv = QueryChannelRange_clone(&o_conv);
36167         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36168         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
36169         return tag_ptr(ret_conv, true);
36170 }
36171
36172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36173         void* e_ptr = untag_ptr(e);
36174         CHECK_ACCESS(e_ptr);
36175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36177         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36178         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
36179         return tag_ptr(ret_conv, true);
36180 }
36181
36182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36183         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
36184         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
36185         return ret_conv;
36186 }
36187
36188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36189         if (!ptr_is_owned(_res)) return;
36190         void* _res_ptr = untag_ptr(_res);
36191         CHECK_ACCESS(_res_ptr);
36192         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
36193         FREE(untag_ptr(_res));
36194         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
36195 }
36196
36197 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
36198         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36199         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
36200         return tag_ptr(ret_conv, true);
36201 }
36202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36203         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
36204         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
36205         return ret_conv;
36206 }
36207
36208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36209         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
36210         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36211         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
36212         return tag_ptr(ret_conv, true);
36213 }
36214
36215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36216         LDKReplyChannelRange o_conv;
36217         o_conv.inner = untag_ptr(o);
36218         o_conv.is_owned = ptr_is_owned(o);
36219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36220         o_conv = ReplyChannelRange_clone(&o_conv);
36221         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36222         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
36223         return tag_ptr(ret_conv, true);
36224 }
36225
36226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36227         void* e_ptr = untag_ptr(e);
36228         CHECK_ACCESS(e_ptr);
36229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36231         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36232         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
36233         return tag_ptr(ret_conv, true);
36234 }
36235
36236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36237         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
36238         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
36239         return ret_conv;
36240 }
36241
36242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36243         if (!ptr_is_owned(_res)) return;
36244         void* _res_ptr = untag_ptr(_res);
36245         CHECK_ACCESS(_res_ptr);
36246         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
36247         FREE(untag_ptr(_res));
36248         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
36249 }
36250
36251 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
36252         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36253         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
36254         return tag_ptr(ret_conv, true);
36255 }
36256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36257         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
36258         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
36259         return ret_conv;
36260 }
36261
36262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36263         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
36264         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36265         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
36266         return tag_ptr(ret_conv, true);
36267 }
36268
36269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36270         LDKGossipTimestampFilter o_conv;
36271         o_conv.inner = untag_ptr(o);
36272         o_conv.is_owned = ptr_is_owned(o);
36273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36274         o_conv = GossipTimestampFilter_clone(&o_conv);
36275         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36276         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
36277         return tag_ptr(ret_conv, true);
36278 }
36279
36280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36281         void* e_ptr = untag_ptr(e);
36282         CHECK_ACCESS(e_ptr);
36283         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36284         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36285         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36286         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
36287         return tag_ptr(ret_conv, true);
36288 }
36289
36290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36291         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
36292         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
36293         return ret_conv;
36294 }
36295
36296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36297         if (!ptr_is_owned(_res)) return;
36298         void* _res_ptr = untag_ptr(_res);
36299         CHECK_ACCESS(_res_ptr);
36300         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
36301         FREE(untag_ptr(_res));
36302         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
36303 }
36304
36305 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
36306         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36307         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
36308         return tag_ptr(ret_conv, true);
36309 }
36310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36311         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
36312         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
36313         return ret_conv;
36314 }
36315
36316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36317         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
36318         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36319         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
36320         return tag_ptr(ret_conv, true);
36321 }
36322
36323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36324         LDKCVec_PhantomRouteHintsZ _res_constr;
36325         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36326         if (_res_constr.datalen > 0)
36327                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
36328         else
36329                 _res_constr.data = NULL;
36330         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36331         for (size_t t = 0; t < _res_constr.datalen; t++) {
36332                 int64_t _res_conv_19 = _res_vals[t];
36333                 LDKPhantomRouteHints _res_conv_19_conv;
36334                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
36335                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
36336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
36337                 _res_constr.data[t] = _res_conv_19_conv;
36338         }
36339         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36340         CVec_PhantomRouteHintsZ_free(_res_constr);
36341 }
36342
36343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36344         LDKBolt11Invoice o_conv;
36345         o_conv.inner = untag_ptr(o);
36346         o_conv.is_owned = ptr_is_owned(o);
36347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36348         o_conv = Bolt11Invoice_clone(&o_conv);
36349         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36350         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
36351         return tag_ptr(ret_conv, true);
36352 }
36353
36354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36355         void* e_ptr = untag_ptr(e);
36356         CHECK_ACCESS(e_ptr);
36357         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
36358         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
36359         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36360         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
36361         return tag_ptr(ret_conv, true);
36362 }
36363
36364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36365         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
36366         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
36367         return ret_conv;
36368 }
36369
36370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36371         if (!ptr_is_owned(_res)) return;
36372         void* _res_ptr = untag_ptr(_res);
36373         CHECK_ACCESS(_res_ptr);
36374         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
36375         FREE(untag_ptr(_res));
36376         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
36377 }
36378
36379 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
36380         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36381         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
36382         return tag_ptr(ret_conv, true);
36383 }
36384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36385         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
36386         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
36387         return ret_conv;
36388 }
36389
36390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36391         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
36392         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36393         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
36394         return tag_ptr(ret_conv, true);
36395 }
36396
36397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1InboundHTLCStateDetailsZ_1some(JNIEnv *env, jclass clz, jclass o) {
36398         LDKInboundHTLCStateDetails o_conv = LDKInboundHTLCStateDetails_from_java(env, o);
36399         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
36400         *ret_copy = COption_InboundHTLCStateDetailsZ_some(o_conv);
36401         int64_t ret_ref = tag_ptr(ret_copy, true);
36402         return ret_ref;
36403 }
36404
36405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1InboundHTLCStateDetailsZ_1none(JNIEnv *env, jclass clz) {
36406         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
36407         *ret_copy = COption_InboundHTLCStateDetailsZ_none();
36408         int64_t ret_ref = tag_ptr(ret_copy, true);
36409         return ret_ref;
36410 }
36411
36412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1InboundHTLCStateDetailsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36413         if (!ptr_is_owned(_res)) return;
36414         void* _res_ptr = untag_ptr(_res);
36415         CHECK_ACCESS(_res_ptr);
36416         LDKCOption_InboundHTLCStateDetailsZ _res_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(_res_ptr);
36417         FREE(untag_ptr(_res));
36418         COption_InboundHTLCStateDetailsZ_free(_res_conv);
36419 }
36420
36421 static inline uint64_t COption_InboundHTLCStateDetailsZ_clone_ptr(LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR arg) {
36422         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
36423         *ret_copy = COption_InboundHTLCStateDetailsZ_clone(arg);
36424         int64_t ret_ref = tag_ptr(ret_copy, true);
36425         return ret_ref;
36426 }
36427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1InboundHTLCStateDetailsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36428         LDKCOption_InboundHTLCStateDetailsZ* arg_conv = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(arg);
36429         int64_t ret_conv = COption_InboundHTLCStateDetailsZ_clone_ptr(arg_conv);
36430         return ret_conv;
36431 }
36432
36433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1InboundHTLCStateDetailsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36434         LDKCOption_InboundHTLCStateDetailsZ* orig_conv = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(orig);
36435         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
36436         *ret_copy = COption_InboundHTLCStateDetailsZ_clone(orig_conv);
36437         int64_t ret_ref = tag_ptr(ret_copy, true);
36438         return ret_ref;
36439 }
36440
36441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36442         void* o_ptr = untag_ptr(o);
36443         CHECK_ACCESS(o_ptr);
36444         LDKCOption_InboundHTLCStateDetailsZ o_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(o_ptr);
36445         o_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(o));
36446         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
36447         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o_conv);
36448         return tag_ptr(ret_conv, true);
36449 }
36450
36451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36452         void* e_ptr = untag_ptr(e);
36453         CHECK_ACCESS(e_ptr);
36454         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36455         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36456         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
36457         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e_conv);
36458         return tag_ptr(ret_conv, true);
36459 }
36460
36461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36462         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* o_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(o);
36463         jboolean ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o_conv);
36464         return ret_conv;
36465 }
36466
36467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36468         if (!ptr_is_owned(_res)) return;
36469         void* _res_ptr = untag_ptr(_res);
36470         CHECK_ACCESS(_res_ptr);
36471         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res_conv = *(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)(_res_ptr);
36472         FREE(untag_ptr(_res));
36473         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res_conv);
36474 }
36475
36476 static inline uint64_t CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR arg) {
36477         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
36478         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(arg);
36479         return tag_ptr(ret_conv, true);
36480 }
36481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36482         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* arg_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(arg);
36483         int64_t ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(arg_conv);
36484         return ret_conv;
36485 }
36486
36487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1InboundHTLCStateDetailsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36488         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* orig_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(orig);
36489         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
36490         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig_conv);
36491         return tag_ptr(ret_conv, true);
36492 }
36493
36494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36495         LDKInboundHTLCDetails o_conv;
36496         o_conv.inner = untag_ptr(o);
36497         o_conv.is_owned = ptr_is_owned(o);
36498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36499         o_conv = InboundHTLCDetails_clone(&o_conv);
36500         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
36501         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_ok(o_conv);
36502         return tag_ptr(ret_conv, true);
36503 }
36504
36505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36506         void* e_ptr = untag_ptr(e);
36507         CHECK_ACCESS(e_ptr);
36508         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36509         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36510         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
36511         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_err(e_conv);
36512         return tag_ptr(ret_conv, true);
36513 }
36514
36515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36516         LDKCResult_InboundHTLCDetailsDecodeErrorZ* o_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(o);
36517         jboolean ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o_conv);
36518         return ret_conv;
36519 }
36520
36521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36522         if (!ptr_is_owned(_res)) return;
36523         void* _res_ptr = untag_ptr(_res);
36524         CHECK_ACCESS(_res_ptr);
36525         LDKCResult_InboundHTLCDetailsDecodeErrorZ _res_conv = *(LDKCResult_InboundHTLCDetailsDecodeErrorZ*)(_res_ptr);
36526         FREE(untag_ptr(_res));
36527         CResult_InboundHTLCDetailsDecodeErrorZ_free(_res_conv);
36528 }
36529
36530 static inline uint64_t CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR arg) {
36531         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
36532         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone(arg);
36533         return tag_ptr(ret_conv, true);
36534 }
36535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36536         LDKCResult_InboundHTLCDetailsDecodeErrorZ* arg_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(arg);
36537         int64_t ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(arg_conv);
36538         return ret_conv;
36539 }
36540
36541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InboundHTLCDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36542         LDKCResult_InboundHTLCDetailsDecodeErrorZ* orig_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(orig);
36543         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
36544         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig_conv);
36545         return tag_ptr(ret_conv, true);
36546 }
36547
36548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OutboundHTLCStateDetailsZ_1some(JNIEnv *env, jclass clz, jclass o) {
36549         LDKOutboundHTLCStateDetails o_conv = LDKOutboundHTLCStateDetails_from_java(env, o);
36550         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
36551         *ret_copy = COption_OutboundHTLCStateDetailsZ_some(o_conv);
36552         int64_t ret_ref = tag_ptr(ret_copy, true);
36553         return ret_ref;
36554 }
36555
36556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OutboundHTLCStateDetailsZ_1none(JNIEnv *env, jclass clz) {
36557         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
36558         *ret_copy = COption_OutboundHTLCStateDetailsZ_none();
36559         int64_t ret_ref = tag_ptr(ret_copy, true);
36560         return ret_ref;
36561 }
36562
36563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OutboundHTLCStateDetailsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36564         if (!ptr_is_owned(_res)) return;
36565         void* _res_ptr = untag_ptr(_res);
36566         CHECK_ACCESS(_res_ptr);
36567         LDKCOption_OutboundHTLCStateDetailsZ _res_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(_res_ptr);
36568         FREE(untag_ptr(_res));
36569         COption_OutboundHTLCStateDetailsZ_free(_res_conv);
36570 }
36571
36572 static inline uint64_t COption_OutboundHTLCStateDetailsZ_clone_ptr(LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR arg) {
36573         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
36574         *ret_copy = COption_OutboundHTLCStateDetailsZ_clone(arg);
36575         int64_t ret_ref = tag_ptr(ret_copy, true);
36576         return ret_ref;
36577 }
36578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OutboundHTLCStateDetailsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36579         LDKCOption_OutboundHTLCStateDetailsZ* arg_conv = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(arg);
36580         int64_t ret_conv = COption_OutboundHTLCStateDetailsZ_clone_ptr(arg_conv);
36581         return ret_conv;
36582 }
36583
36584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OutboundHTLCStateDetailsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36585         LDKCOption_OutboundHTLCStateDetailsZ* orig_conv = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(orig);
36586         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
36587         *ret_copy = COption_OutboundHTLCStateDetailsZ_clone(orig_conv);
36588         int64_t ret_ref = tag_ptr(ret_copy, true);
36589         return ret_ref;
36590 }
36591
36592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36593         void* o_ptr = untag_ptr(o);
36594         CHECK_ACCESS(o_ptr);
36595         LDKCOption_OutboundHTLCStateDetailsZ o_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(o_ptr);
36596         o_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(o));
36597         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
36598         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o_conv);
36599         return tag_ptr(ret_conv, true);
36600 }
36601
36602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36603         void* e_ptr = untag_ptr(e);
36604         CHECK_ACCESS(e_ptr);
36605         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36606         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36607         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
36608         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e_conv);
36609         return tag_ptr(ret_conv, true);
36610 }
36611
36612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36613         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* o_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(o);
36614         jboolean ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o_conv);
36615         return ret_conv;
36616 }
36617
36618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36619         if (!ptr_is_owned(_res)) return;
36620         void* _res_ptr = untag_ptr(_res);
36621         CHECK_ACCESS(_res_ptr);
36622         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)(_res_ptr);
36623         FREE(untag_ptr(_res));
36624         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res_conv);
36625 }
36626
36627 static inline uint64_t CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR arg) {
36628         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
36629         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(arg);
36630         return tag_ptr(ret_conv, true);
36631 }
36632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36633         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(arg);
36634         int64_t ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(arg_conv);
36635         return ret_conv;
36636 }
36637
36638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OutboundHTLCStateDetailsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36639         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(orig);
36640         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
36641         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig_conv);
36642         return tag_ptr(ret_conv, true);
36643 }
36644
36645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36646         LDKOutboundHTLCDetails o_conv;
36647         o_conv.inner = untag_ptr(o);
36648         o_conv.is_owned = ptr_is_owned(o);
36649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36650         o_conv = OutboundHTLCDetails_clone(&o_conv);
36651         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
36652         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o_conv);
36653         return tag_ptr(ret_conv, true);
36654 }
36655
36656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36657         void* e_ptr = untag_ptr(e);
36658         CHECK_ACCESS(e_ptr);
36659         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36660         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36661         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
36662         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_err(e_conv);
36663         return tag_ptr(ret_conv, true);
36664 }
36665
36666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36667         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* o_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(o);
36668         jboolean ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o_conv);
36669         return ret_conv;
36670 }
36671
36672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36673         if (!ptr_is_owned(_res)) return;
36674         void* _res_ptr = untag_ptr(_res);
36675         CHECK_ACCESS(_res_ptr);
36676         LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res_conv = *(LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)(_res_ptr);
36677         FREE(untag_ptr(_res));
36678         CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res_conv);
36679 }
36680
36681 static inline uint64_t CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR arg) {
36682         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
36683         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone(arg);
36684         return tag_ptr(ret_conv, true);
36685 }
36686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36687         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* arg_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(arg);
36688         int64_t ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(arg_conv);
36689         return ret_conv;
36690 }
36691
36692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutboundHTLCDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36693         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* orig_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(orig);
36694         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
36695         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig_conv);
36696         return tag_ptr(ret_conv, true);
36697 }
36698
36699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36700         LDKCounterpartyForwardingInfo o_conv;
36701         o_conv.inner = untag_ptr(o);
36702         o_conv.is_owned = ptr_is_owned(o);
36703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36704         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
36705         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
36706         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
36707         return tag_ptr(ret_conv, true);
36708 }
36709
36710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36711         void* e_ptr = untag_ptr(e);
36712         CHECK_ACCESS(e_ptr);
36713         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36714         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36715         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
36716         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
36717         return tag_ptr(ret_conv, true);
36718 }
36719
36720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36721         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
36722         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
36723         return ret_conv;
36724 }
36725
36726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36727         if (!ptr_is_owned(_res)) return;
36728         void* _res_ptr = untag_ptr(_res);
36729         CHECK_ACCESS(_res_ptr);
36730         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
36731         FREE(untag_ptr(_res));
36732         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
36733 }
36734
36735 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
36736         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
36737         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
36738         return tag_ptr(ret_conv, true);
36739 }
36740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36741         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
36742         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
36743         return ret_conv;
36744 }
36745
36746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36747         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
36748         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
36749         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
36750         return tag_ptr(ret_conv, true);
36751 }
36752
36753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36754         LDKChannelCounterparty o_conv;
36755         o_conv.inner = untag_ptr(o);
36756         o_conv.is_owned = ptr_is_owned(o);
36757         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36758         o_conv = ChannelCounterparty_clone(&o_conv);
36759         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
36760         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
36761         return tag_ptr(ret_conv, true);
36762 }
36763
36764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36765         void* e_ptr = untag_ptr(e);
36766         CHECK_ACCESS(e_ptr);
36767         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36768         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36769         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
36770         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
36771         return tag_ptr(ret_conv, true);
36772 }
36773
36774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36775         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
36776         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
36777         return ret_conv;
36778 }
36779
36780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36781         if (!ptr_is_owned(_res)) return;
36782         void* _res_ptr = untag_ptr(_res);
36783         CHECK_ACCESS(_res_ptr);
36784         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
36785         FREE(untag_ptr(_res));
36786         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
36787 }
36788
36789 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
36790         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
36791         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
36792         return tag_ptr(ret_conv, true);
36793 }
36794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36795         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
36796         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
36797         return ret_conv;
36798 }
36799
36800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36801         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
36802         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
36803         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
36804         return tag_ptr(ret_conv, true);
36805 }
36806
36807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
36808         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
36809         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
36810         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
36811         int64_t ret_ref = tag_ptr(ret_copy, true);
36812         return ret_ref;
36813 }
36814
36815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
36816         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
36817         *ret_copy = COption_ChannelShutdownStateZ_none();
36818         int64_t ret_ref = tag_ptr(ret_copy, true);
36819         return ret_ref;
36820 }
36821
36822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36823         if (!ptr_is_owned(_res)) return;
36824         void* _res_ptr = untag_ptr(_res);
36825         CHECK_ACCESS(_res_ptr);
36826         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
36827         FREE(untag_ptr(_res));
36828         COption_ChannelShutdownStateZ_free(_res_conv);
36829 }
36830
36831 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
36832         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
36833         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
36834         int64_t ret_ref = tag_ptr(ret_copy, true);
36835         return ret_ref;
36836 }
36837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36838         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
36839         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
36840         return ret_conv;
36841 }
36842
36843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36844         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
36845         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
36846         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
36847         int64_t ret_ref = tag_ptr(ret_copy, true);
36848         return ret_ref;
36849 }
36850
36851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InboundHTLCDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36852         LDKCVec_InboundHTLCDetailsZ _res_constr;
36853         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36854         if (_res_constr.datalen > 0)
36855                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
36856         else
36857                 _res_constr.data = NULL;
36858         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36859         for (size_t u = 0; u < _res_constr.datalen; u++) {
36860                 int64_t _res_conv_20 = _res_vals[u];
36861                 LDKInboundHTLCDetails _res_conv_20_conv;
36862                 _res_conv_20_conv.inner = untag_ptr(_res_conv_20);
36863                 _res_conv_20_conv.is_owned = ptr_is_owned(_res_conv_20);
36864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_20_conv);
36865                 _res_constr.data[u] = _res_conv_20_conv;
36866         }
36867         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36868         CVec_InboundHTLCDetailsZ_free(_res_constr);
36869 }
36870
36871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutboundHTLCDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36872         LDKCVec_OutboundHTLCDetailsZ _res_constr;
36873         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36874         if (_res_constr.datalen > 0)
36875                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
36876         else
36877                 _res_constr.data = NULL;
36878         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36879         for (size_t v = 0; v < _res_constr.datalen; v++) {
36880                 int64_t _res_conv_21 = _res_vals[v];
36881                 LDKOutboundHTLCDetails _res_conv_21_conv;
36882                 _res_conv_21_conv.inner = untag_ptr(_res_conv_21);
36883                 _res_conv_21_conv.is_owned = ptr_is_owned(_res_conv_21);
36884                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_21_conv);
36885                 _res_constr.data[v] = _res_conv_21_conv;
36886         }
36887         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36888         CVec_OutboundHTLCDetailsZ_free(_res_constr);
36889 }
36890
36891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36892         LDKChannelDetails o_conv;
36893         o_conv.inner = untag_ptr(o);
36894         o_conv.is_owned = ptr_is_owned(o);
36895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36896         o_conv = ChannelDetails_clone(&o_conv);
36897         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
36898         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
36899         return tag_ptr(ret_conv, true);
36900 }
36901
36902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36903         void* e_ptr = untag_ptr(e);
36904         CHECK_ACCESS(e_ptr);
36905         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36906         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36907         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
36908         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
36909         return tag_ptr(ret_conv, true);
36910 }
36911
36912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36913         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
36914         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
36915         return ret_conv;
36916 }
36917
36918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36919         if (!ptr_is_owned(_res)) return;
36920         void* _res_ptr = untag_ptr(_res);
36921         CHECK_ACCESS(_res_ptr);
36922         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
36923         FREE(untag_ptr(_res));
36924         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
36925 }
36926
36927 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
36928         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
36929         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
36930         return tag_ptr(ret_conv, true);
36931 }
36932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36933         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
36934         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
36935         return ret_conv;
36936 }
36937
36938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36939         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
36940         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
36941         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
36942         return tag_ptr(ret_conv, true);
36943 }
36944
36945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
36946         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
36947         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
36948         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
36949         return tag_ptr(ret_conv, true);
36950 }
36951
36952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36953         void* e_ptr = untag_ptr(e);
36954         CHECK_ACCESS(e_ptr);
36955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36957         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
36958         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
36959         return tag_ptr(ret_conv, true);
36960 }
36961
36962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36963         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
36964         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
36965         return ret_conv;
36966 }
36967
36968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36969         if (!ptr_is_owned(_res)) return;
36970         void* _res_ptr = untag_ptr(_res);
36971         CHECK_ACCESS(_res_ptr);
36972         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
36973         FREE(untag_ptr(_res));
36974         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
36975 }
36976
36977 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
36978         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
36979         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
36980         return tag_ptr(ret_conv, true);
36981 }
36982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36983         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
36984         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
36985         return ret_conv;
36986 }
36987
36988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36989         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
36990         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
36991         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
36992         return tag_ptr(ret_conv, true);
36993 }
36994
36995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36996         LDKCVec_FutureZ _res_constr;
36997         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36998         if (_res_constr.datalen > 0)
36999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
37000         else
37001                 _res_constr.data = NULL;
37002         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37003         for (size_t i = 0; i < _res_constr.datalen; i++) {
37004                 int64_t _res_conv_8 = _res_vals[i];
37005                 LDKFuture _res_conv_8_conv;
37006                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
37007                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
37008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
37009                 _res_constr.data[i] = _res_conv_8_conv;
37010         }
37011         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37012         CVec_FutureZ_free(_res_constr);
37013 }
37014
37015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37016         void* o_ptr = untag_ptr(o);
37017         CHECK_ACCESS(o_ptr);
37018         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
37019         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
37020         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
37021         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
37022         return tag_ptr(ret_conv, true);
37023 }
37024
37025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37026         void* e_ptr = untag_ptr(e);
37027         CHECK_ACCESS(e_ptr);
37028         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37029         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37030         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
37031         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
37032         return tag_ptr(ret_conv, true);
37033 }
37034
37035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37036         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
37037         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
37038         return ret_conv;
37039 }
37040
37041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37042         if (!ptr_is_owned(_res)) return;
37043         void* _res_ptr = untag_ptr(_res);
37044         CHECK_ACCESS(_res_ptr);
37045         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
37046         FREE(untag_ptr(_res));
37047         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
37048 }
37049
37050 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
37051         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
37052         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
37053         return tag_ptr(ret_conv, true);
37054 }
37055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37056         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
37057         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
37058         return ret_conv;
37059 }
37060
37061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37062         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
37063         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
37064         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
37065         return tag_ptr(ret_conv, true);
37066 }
37067
37068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
37069         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
37070         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37071         *ret_copy = COption_HTLCClaimZ_some(o_conv);
37072         int64_t ret_ref = tag_ptr(ret_copy, true);
37073         return ret_ref;
37074 }
37075
37076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
37077         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37078         *ret_copy = COption_HTLCClaimZ_none();
37079         int64_t ret_ref = tag_ptr(ret_copy, true);
37080         return ret_ref;
37081 }
37082
37083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37084         if (!ptr_is_owned(_res)) return;
37085         void* _res_ptr = untag_ptr(_res);
37086         CHECK_ACCESS(_res_ptr);
37087         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
37088         FREE(untag_ptr(_res));
37089         COption_HTLCClaimZ_free(_res_conv);
37090 }
37091
37092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37093         LDKCounterpartyCommitmentSecrets o_conv;
37094         o_conv.inner = untag_ptr(o);
37095         o_conv.is_owned = ptr_is_owned(o);
37096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37097         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
37098         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37099         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
37100         return tag_ptr(ret_conv, true);
37101 }
37102
37103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37104         void* e_ptr = untag_ptr(e);
37105         CHECK_ACCESS(e_ptr);
37106         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37107         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37108         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37109         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
37110         return tag_ptr(ret_conv, true);
37111 }
37112
37113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37114         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
37115         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
37116         return ret_conv;
37117 }
37118
37119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37120         if (!ptr_is_owned(_res)) return;
37121         void* _res_ptr = untag_ptr(_res);
37122         CHECK_ACCESS(_res_ptr);
37123         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
37124         FREE(untag_ptr(_res));
37125         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
37126 }
37127
37128 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
37129         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37130         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
37131         return tag_ptr(ret_conv, true);
37132 }
37133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37134         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
37135         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
37136         return ret_conv;
37137 }
37138
37139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37140         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
37141         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37142         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
37143         return tag_ptr(ret_conv, true);
37144 }
37145
37146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37147         LDKTxCreationKeys o_conv;
37148         o_conv.inner = untag_ptr(o);
37149         o_conv.is_owned = ptr_is_owned(o);
37150         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37151         o_conv = TxCreationKeys_clone(&o_conv);
37152         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37153         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
37154         return tag_ptr(ret_conv, true);
37155 }
37156
37157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37158         void* e_ptr = untag_ptr(e);
37159         CHECK_ACCESS(e_ptr);
37160         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37161         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37162         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37163         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
37164         return tag_ptr(ret_conv, true);
37165 }
37166
37167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37168         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
37169         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
37170         return ret_conv;
37171 }
37172
37173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37174         if (!ptr_is_owned(_res)) return;
37175         void* _res_ptr = untag_ptr(_res);
37176         CHECK_ACCESS(_res_ptr);
37177         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
37178         FREE(untag_ptr(_res));
37179         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
37180 }
37181
37182 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
37183         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37184         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
37185         return tag_ptr(ret_conv, true);
37186 }
37187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37188         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
37189         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
37190         return ret_conv;
37191 }
37192
37193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37194         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
37195         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37196         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
37197         return tag_ptr(ret_conv, true);
37198 }
37199
37200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37201         LDKChannelPublicKeys o_conv;
37202         o_conv.inner = untag_ptr(o);
37203         o_conv.is_owned = ptr_is_owned(o);
37204         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37205         o_conv = ChannelPublicKeys_clone(&o_conv);
37206         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37207         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
37208         return tag_ptr(ret_conv, true);
37209 }
37210
37211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37212         void* e_ptr = untag_ptr(e);
37213         CHECK_ACCESS(e_ptr);
37214         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37215         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37216         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37217         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
37218         return tag_ptr(ret_conv, true);
37219 }
37220
37221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37222         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
37223         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
37224         return ret_conv;
37225 }
37226
37227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37228         if (!ptr_is_owned(_res)) return;
37229         void* _res_ptr = untag_ptr(_res);
37230         CHECK_ACCESS(_res_ptr);
37231         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
37232         FREE(untag_ptr(_res));
37233         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
37234 }
37235
37236 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
37237         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37238         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
37239         return tag_ptr(ret_conv, true);
37240 }
37241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37242         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
37243         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
37244         return ret_conv;
37245 }
37246
37247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37248         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
37249         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37250         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
37251         return tag_ptr(ret_conv, true);
37252 }
37253
37254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37255         LDKHTLCOutputInCommitment o_conv;
37256         o_conv.inner = untag_ptr(o);
37257         o_conv.is_owned = ptr_is_owned(o);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37259         o_conv = HTLCOutputInCommitment_clone(&o_conv);
37260         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37261         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
37262         return tag_ptr(ret_conv, true);
37263 }
37264
37265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37266         void* e_ptr = untag_ptr(e);
37267         CHECK_ACCESS(e_ptr);
37268         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37269         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37270         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37271         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
37272         return tag_ptr(ret_conv, true);
37273 }
37274
37275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37276         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
37277         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
37278         return ret_conv;
37279 }
37280
37281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37282         if (!ptr_is_owned(_res)) return;
37283         void* _res_ptr = untag_ptr(_res);
37284         CHECK_ACCESS(_res_ptr);
37285         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
37286         FREE(untag_ptr(_res));
37287         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
37288 }
37289
37290 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
37291         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37292         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
37293         return tag_ptr(ret_conv, true);
37294 }
37295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37296         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
37297         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
37298         return ret_conv;
37299 }
37300
37301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37302         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
37303         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37304         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
37305         return tag_ptr(ret_conv, true);
37306 }
37307
37308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37309         LDKCounterpartyChannelTransactionParameters o_conv;
37310         o_conv.inner = untag_ptr(o);
37311         o_conv.is_owned = ptr_is_owned(o);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37313         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
37314         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37315         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
37316         return tag_ptr(ret_conv, true);
37317 }
37318
37319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37320         void* e_ptr = untag_ptr(e);
37321         CHECK_ACCESS(e_ptr);
37322         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37323         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37324         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37325         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
37326         return tag_ptr(ret_conv, true);
37327 }
37328
37329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37330         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
37331         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
37332         return ret_conv;
37333 }
37334
37335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37336         if (!ptr_is_owned(_res)) return;
37337         void* _res_ptr = untag_ptr(_res);
37338         CHECK_ACCESS(_res_ptr);
37339         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
37340         FREE(untag_ptr(_res));
37341         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
37342 }
37343
37344 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
37345         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37346         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
37347         return tag_ptr(ret_conv, true);
37348 }
37349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37350         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
37351         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
37352         return ret_conv;
37353 }
37354
37355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37356         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
37357         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37358         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
37359         return tag_ptr(ret_conv, true);
37360 }
37361
37362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37363         LDKChannelTransactionParameters o_conv;
37364         o_conv.inner = untag_ptr(o);
37365         o_conv.is_owned = ptr_is_owned(o);
37366         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37367         o_conv = ChannelTransactionParameters_clone(&o_conv);
37368         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37369         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
37370         return tag_ptr(ret_conv, true);
37371 }
37372
37373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37374         void* e_ptr = untag_ptr(e);
37375         CHECK_ACCESS(e_ptr);
37376         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37377         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37378         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37379         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
37380         return tag_ptr(ret_conv, true);
37381 }
37382
37383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37384         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
37385         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
37386         return ret_conv;
37387 }
37388
37389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37390         if (!ptr_is_owned(_res)) return;
37391         void* _res_ptr = untag_ptr(_res);
37392         CHECK_ACCESS(_res_ptr);
37393         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
37394         FREE(untag_ptr(_res));
37395         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
37396 }
37397
37398 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
37399         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37400         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
37401         return tag_ptr(ret_conv, true);
37402 }
37403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37404         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
37405         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
37406         return ret_conv;
37407 }
37408
37409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37410         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
37411         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37412         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
37413         return tag_ptr(ret_conv, true);
37414 }
37415
37416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37417         LDKHolderCommitmentTransaction o_conv;
37418         o_conv.inner = untag_ptr(o);
37419         o_conv.is_owned = ptr_is_owned(o);
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37421         o_conv = HolderCommitmentTransaction_clone(&o_conv);
37422         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37423         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
37424         return tag_ptr(ret_conv, true);
37425 }
37426
37427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37428         void* e_ptr = untag_ptr(e);
37429         CHECK_ACCESS(e_ptr);
37430         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37431         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37432         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37433         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
37434         return tag_ptr(ret_conv, true);
37435 }
37436
37437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37438         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
37439         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
37440         return ret_conv;
37441 }
37442
37443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37444         if (!ptr_is_owned(_res)) return;
37445         void* _res_ptr = untag_ptr(_res);
37446         CHECK_ACCESS(_res_ptr);
37447         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
37448         FREE(untag_ptr(_res));
37449         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
37450 }
37451
37452 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
37453         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37454         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
37455         return tag_ptr(ret_conv, true);
37456 }
37457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37458         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
37459         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
37460         return ret_conv;
37461 }
37462
37463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37464         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
37465         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37466         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
37467         return tag_ptr(ret_conv, true);
37468 }
37469
37470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37471         LDKBuiltCommitmentTransaction o_conv;
37472         o_conv.inner = untag_ptr(o);
37473         o_conv.is_owned = ptr_is_owned(o);
37474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37475         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
37476         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37477         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
37478         return tag_ptr(ret_conv, true);
37479 }
37480
37481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37482         void* e_ptr = untag_ptr(e);
37483         CHECK_ACCESS(e_ptr);
37484         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37485         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37486         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37487         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
37488         return tag_ptr(ret_conv, true);
37489 }
37490
37491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37492         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
37493         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
37494         return ret_conv;
37495 }
37496
37497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37498         if (!ptr_is_owned(_res)) return;
37499         void* _res_ptr = untag_ptr(_res);
37500         CHECK_ACCESS(_res_ptr);
37501         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
37502         FREE(untag_ptr(_res));
37503         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
37504 }
37505
37506 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
37507         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37508         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
37509         return tag_ptr(ret_conv, true);
37510 }
37511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37512         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
37513         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
37514         return ret_conv;
37515 }
37516
37517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37518         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
37519         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37520         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
37521         return tag_ptr(ret_conv, true);
37522 }
37523
37524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37525         LDKTrustedClosingTransaction o_conv;
37526         o_conv.inner = untag_ptr(o);
37527         o_conv.is_owned = ptr_is_owned(o);
37528         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37529         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
37530         
37531         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
37532         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
37533         return tag_ptr(ret_conv, true);
37534 }
37535
37536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
37537         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
37538         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
37539         return tag_ptr(ret_conv, true);
37540 }
37541
37542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37543         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
37544         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
37545         return ret_conv;
37546 }
37547
37548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37549         if (!ptr_is_owned(_res)) return;
37550         void* _res_ptr = untag_ptr(_res);
37551         CHECK_ACCESS(_res_ptr);
37552         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
37553         FREE(untag_ptr(_res));
37554         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
37555 }
37556
37557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37558         LDKCommitmentTransaction o_conv;
37559         o_conv.inner = untag_ptr(o);
37560         o_conv.is_owned = ptr_is_owned(o);
37561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37562         o_conv = CommitmentTransaction_clone(&o_conv);
37563         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37564         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
37565         return tag_ptr(ret_conv, true);
37566 }
37567
37568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37569         void* e_ptr = untag_ptr(e);
37570         CHECK_ACCESS(e_ptr);
37571         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37572         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37573         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37574         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
37575         return tag_ptr(ret_conv, true);
37576 }
37577
37578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37579         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
37580         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
37581         return ret_conv;
37582 }
37583
37584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37585         if (!ptr_is_owned(_res)) return;
37586         void* _res_ptr = untag_ptr(_res);
37587         CHECK_ACCESS(_res_ptr);
37588         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
37589         FREE(untag_ptr(_res));
37590         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
37591 }
37592
37593 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
37594         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37595         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
37596         return tag_ptr(ret_conv, true);
37597 }
37598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37599         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
37600         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
37601         return ret_conv;
37602 }
37603
37604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37605         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
37606         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37607         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
37608         return tag_ptr(ret_conv, true);
37609 }
37610
37611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37612         LDKTrustedCommitmentTransaction o_conv;
37613         o_conv.inner = untag_ptr(o);
37614         o_conv.is_owned = ptr_is_owned(o);
37615         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37616         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
37617         
37618         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37619         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
37620         return tag_ptr(ret_conv, true);
37621 }
37622
37623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
37624         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37625         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
37626         return tag_ptr(ret_conv, true);
37627 }
37628
37629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37630         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
37631         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
37632         return ret_conv;
37633 }
37634
37635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37636         if (!ptr_is_owned(_res)) return;
37637         void* _res_ptr = untag_ptr(_res);
37638         CHECK_ACCESS(_res_ptr);
37639         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
37640         FREE(untag_ptr(_res));
37641         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
37642 }
37643
37644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
37645         LDKCVec_ECDSASignatureZ o_constr;
37646         o_constr.datalen = (*env)->GetArrayLength(env, o);
37647         if (o_constr.datalen > 0)
37648                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
37649         else
37650                 o_constr.data = NULL;
37651         for (size_t i = 0; i < o_constr.datalen; i++) {
37652                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
37653                 LDKECDSASignature o_conv_8_ref;
37654                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
37655                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
37656                 o_constr.data[i] = o_conv_8_ref;
37657         }
37658         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37659         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
37660         return tag_ptr(ret_conv, true);
37661 }
37662
37663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
37664         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37665         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
37666         return tag_ptr(ret_conv, true);
37667 }
37668
37669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37670         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
37671         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
37672         return ret_conv;
37673 }
37674
37675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37676         if (!ptr_is_owned(_res)) return;
37677         void* _res_ptr = untag_ptr(_res);
37678         CHECK_ACCESS(_res_ptr);
37679         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
37680         FREE(untag_ptr(_res));
37681         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
37682 }
37683
37684 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
37685         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37686         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
37687         return tag_ptr(ret_conv, true);
37688 }
37689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37690         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
37691         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
37692         return ret_conv;
37693 }
37694
37695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37696         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
37697         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37698         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
37699         return tag_ptr(ret_conv, true);
37700 }
37701
37702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37703         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37704         *ret_copy = COption_usizeZ_some(o);
37705         int64_t ret_ref = tag_ptr(ret_copy, true);
37706         return ret_ref;
37707 }
37708
37709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
37710         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37711         *ret_copy = COption_usizeZ_none();
37712         int64_t ret_ref = tag_ptr(ret_copy, true);
37713         return ret_ref;
37714 }
37715
37716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37717         if (!ptr_is_owned(_res)) return;
37718         void* _res_ptr = untag_ptr(_res);
37719         CHECK_ACCESS(_res_ptr);
37720         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
37721         FREE(untag_ptr(_res));
37722         COption_usizeZ_free(_res_conv);
37723 }
37724
37725 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
37726         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37727         *ret_copy = COption_usizeZ_clone(arg);
37728         int64_t ret_ref = tag_ptr(ret_copy, true);
37729         return ret_ref;
37730 }
37731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37732         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
37733         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
37734         return ret_conv;
37735 }
37736
37737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37738         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
37739         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37740         *ret_copy = COption_usizeZ_clone(orig_conv);
37741         int64_t ret_ref = tag_ptr(ret_copy, true);
37742         return ret_ref;
37743 }
37744
37745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37746         LDKShutdownScript o_conv;
37747         o_conv.inner = untag_ptr(o);
37748         o_conv.is_owned = ptr_is_owned(o);
37749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37750         o_conv = ShutdownScript_clone(&o_conv);
37751         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37752         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
37753         return tag_ptr(ret_conv, true);
37754 }
37755
37756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37757         void* e_ptr = untag_ptr(e);
37758         CHECK_ACCESS(e_ptr);
37759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37761         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37762         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
37763         return tag_ptr(ret_conv, true);
37764 }
37765
37766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37767         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
37768         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
37769         return ret_conv;
37770 }
37771
37772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37773         if (!ptr_is_owned(_res)) return;
37774         void* _res_ptr = untag_ptr(_res);
37775         CHECK_ACCESS(_res_ptr);
37776         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
37777         FREE(untag_ptr(_res));
37778         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
37779 }
37780
37781 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
37782         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37783         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
37784         return tag_ptr(ret_conv, true);
37785 }
37786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37787         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
37788         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
37789         return ret_conv;
37790 }
37791
37792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37793         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
37794         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37795         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
37796         return tag_ptr(ret_conv, true);
37797 }
37798
37799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37800         LDKShutdownScript o_conv;
37801         o_conv.inner = untag_ptr(o);
37802         o_conv.is_owned = ptr_is_owned(o);
37803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37804         o_conv = ShutdownScript_clone(&o_conv);
37805         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37806         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
37807         return tag_ptr(ret_conv, true);
37808 }
37809
37810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37811         LDKInvalidShutdownScript e_conv;
37812         e_conv.inner = untag_ptr(e);
37813         e_conv.is_owned = ptr_is_owned(e);
37814         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
37815         e_conv = InvalidShutdownScript_clone(&e_conv);
37816         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37817         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
37818         return tag_ptr(ret_conv, true);
37819 }
37820
37821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37822         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
37823         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
37824         return ret_conv;
37825 }
37826
37827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37828         if (!ptr_is_owned(_res)) return;
37829         void* _res_ptr = untag_ptr(_res);
37830         CHECK_ACCESS(_res_ptr);
37831         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
37832         FREE(untag_ptr(_res));
37833         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
37834 }
37835
37836 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
37837         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37838         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
37839         return tag_ptr(ret_conv, true);
37840 }
37841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37842         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
37843         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
37844         return ret_conv;
37845 }
37846
37847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37848         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
37849         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37850         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
37851         return tag_ptr(ret_conv, true);
37852 }
37853
37854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
37855         LDKCVec_TransactionZ _res_constr;
37856         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37857         if (_res_constr.datalen > 0)
37858                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
37859         else
37860                 _res_constr.data = NULL;
37861         for (size_t i = 0; i < _res_constr.datalen; i++) {
37862                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
37863                 LDKTransaction _res_conv_8_ref;
37864                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
37865                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
37866                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
37867                 _res_conv_8_ref.data_is_owned = true;
37868                 _res_constr.data[i] = _res_conv_8_ref;
37869         }
37870         CVec_TransactionZ_free(_res_constr);
37871 }
37872
37873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37874         void* o_ptr = untag_ptr(o);
37875         CHECK_ACCESS(o_ptr);
37876         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
37877         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
37878         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37879         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
37880         return tag_ptr(ret_conv, true);
37881 }
37882
37883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37884         void* e_ptr = untag_ptr(e);
37885         CHECK_ACCESS(e_ptr);
37886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37888         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37889         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
37890         return tag_ptr(ret_conv, true);
37891 }
37892
37893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37894         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
37895         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
37896         return ret_conv;
37897 }
37898
37899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37900         if (!ptr_is_owned(_res)) return;
37901         void* _res_ptr = untag_ptr(_res);
37902         CHECK_ACCESS(_res_ptr);
37903         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
37904         FREE(untag_ptr(_res));
37905         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
37906 }
37907
37908 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
37909         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37910         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
37911         return tag_ptr(ret_conv, true);
37912 }
37913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37914         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
37915         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
37916         return ret_conv;
37917 }
37918
37919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37920         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
37921         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37922         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
37923         return tag_ptr(ret_conv, true);
37924 }
37925
37926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37927         LDKClaimedHTLC o_conv;
37928         o_conv.inner = untag_ptr(o);
37929         o_conv.is_owned = ptr_is_owned(o);
37930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37931         o_conv = ClaimedHTLC_clone(&o_conv);
37932         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37933         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
37934         return tag_ptr(ret_conv, true);
37935 }
37936
37937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37938         void* e_ptr = untag_ptr(e);
37939         CHECK_ACCESS(e_ptr);
37940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37942         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37943         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
37944         return tag_ptr(ret_conv, true);
37945 }
37946
37947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37948         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
37949         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
37950         return ret_conv;
37951 }
37952
37953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37954         if (!ptr_is_owned(_res)) return;
37955         void* _res_ptr = untag_ptr(_res);
37956         CHECK_ACCESS(_res_ptr);
37957         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
37958         FREE(untag_ptr(_res));
37959         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
37960 }
37961
37962 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
37963         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37964         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
37965         return tag_ptr(ret_conv, true);
37966 }
37967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37968         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
37969         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
37970         return ret_conv;
37971 }
37972
37973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37974         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
37975         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37976         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
37977         return tag_ptr(ret_conv, true);
37978 }
37979
37980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37981         void* o_ptr = untag_ptr(o);
37982         CHECK_ACCESS(o_ptr);
37983         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
37984         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
37985         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37986         *ret_copy = COption_PathFailureZ_some(o_conv);
37987         int64_t ret_ref = tag_ptr(ret_copy, true);
37988         return ret_ref;
37989 }
37990
37991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
37992         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37993         *ret_copy = COption_PathFailureZ_none();
37994         int64_t ret_ref = tag_ptr(ret_copy, true);
37995         return ret_ref;
37996 }
37997
37998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37999         if (!ptr_is_owned(_res)) return;
38000         void* _res_ptr = untag_ptr(_res);
38001         CHECK_ACCESS(_res_ptr);
38002         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
38003         FREE(untag_ptr(_res));
38004         COption_PathFailureZ_free(_res_conv);
38005 }
38006
38007 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
38008         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
38009         *ret_copy = COption_PathFailureZ_clone(arg);
38010         int64_t ret_ref = tag_ptr(ret_copy, true);
38011         return ret_ref;
38012 }
38013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38014         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
38015         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
38016         return ret_conv;
38017 }
38018
38019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38020         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
38021         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
38022         *ret_copy = COption_PathFailureZ_clone(orig_conv);
38023         int64_t ret_ref = tag_ptr(ret_copy, true);
38024         return ret_ref;
38025 }
38026
38027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38028         void* o_ptr = untag_ptr(o);
38029         CHECK_ACCESS(o_ptr);
38030         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
38031         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
38032         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
38033         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
38034         return tag_ptr(ret_conv, true);
38035 }
38036
38037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38038         void* e_ptr = untag_ptr(e);
38039         CHECK_ACCESS(e_ptr);
38040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38042         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
38043         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
38044         return tag_ptr(ret_conv, true);
38045 }
38046
38047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38048         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
38049         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
38050         return ret_conv;
38051 }
38052
38053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38054         if (!ptr_is_owned(_res)) return;
38055         void* _res_ptr = untag_ptr(_res);
38056         CHECK_ACCESS(_res_ptr);
38057         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
38058         FREE(untag_ptr(_res));
38059         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
38060 }
38061
38062 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
38063         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
38064         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
38065         return tag_ptr(ret_conv, true);
38066 }
38067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38068         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
38069         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
38070         return ret_conv;
38071 }
38072
38073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38074         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
38075         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
38076         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
38077         return tag_ptr(ret_conv, true);
38078 }
38079
38080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
38081         void* o_ptr = untag_ptr(o);
38082         CHECK_ACCESS(o_ptr);
38083         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
38084         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
38085         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
38086         *ret_copy = COption_ClosureReasonZ_some(o_conv);
38087         int64_t ret_ref = tag_ptr(ret_copy, true);
38088         return ret_ref;
38089 }
38090
38091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
38092         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
38093         *ret_copy = COption_ClosureReasonZ_none();
38094         int64_t ret_ref = tag_ptr(ret_copy, true);
38095         return ret_ref;
38096 }
38097
38098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38099         if (!ptr_is_owned(_res)) return;
38100         void* _res_ptr = untag_ptr(_res);
38101         CHECK_ACCESS(_res_ptr);
38102         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
38103         FREE(untag_ptr(_res));
38104         COption_ClosureReasonZ_free(_res_conv);
38105 }
38106
38107 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
38108         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
38109         *ret_copy = COption_ClosureReasonZ_clone(arg);
38110         int64_t ret_ref = tag_ptr(ret_copy, true);
38111         return ret_ref;
38112 }
38113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38114         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
38115         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
38116         return ret_conv;
38117 }
38118
38119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38120         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
38121         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
38122         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
38123         int64_t ret_ref = tag_ptr(ret_copy, true);
38124         return ret_ref;
38125 }
38126
38127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38128         void* o_ptr = untag_ptr(o);
38129         CHECK_ACCESS(o_ptr);
38130         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
38131         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
38132         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
38133         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
38134         return tag_ptr(ret_conv, true);
38135 }
38136
38137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38138         void* e_ptr = untag_ptr(e);
38139         CHECK_ACCESS(e_ptr);
38140         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38141         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38142         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
38143         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
38144         return tag_ptr(ret_conv, true);
38145 }
38146
38147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38148         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
38149         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
38150         return ret_conv;
38151 }
38152
38153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38154         if (!ptr_is_owned(_res)) return;
38155         void* _res_ptr = untag_ptr(_res);
38156         CHECK_ACCESS(_res_ptr);
38157         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
38158         FREE(untag_ptr(_res));
38159         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
38160 }
38161
38162 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
38163         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
38164         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
38165         return tag_ptr(ret_conv, true);
38166 }
38167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38168         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
38169         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
38170         return ret_conv;
38171 }
38172
38173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38174         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
38175         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
38176         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
38177         return tag_ptr(ret_conv, true);
38178 }
38179
38180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
38181         void* o_ptr = untag_ptr(o);
38182         CHECK_ACCESS(o_ptr);
38183         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
38184         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
38185         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
38186         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
38187         int64_t ret_ref = tag_ptr(ret_copy, true);
38188         return ret_ref;
38189 }
38190
38191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
38192         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
38193         *ret_copy = COption_HTLCDestinationZ_none();
38194         int64_t ret_ref = tag_ptr(ret_copy, true);
38195         return ret_ref;
38196 }
38197
38198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38199         if (!ptr_is_owned(_res)) return;
38200         void* _res_ptr = untag_ptr(_res);
38201         CHECK_ACCESS(_res_ptr);
38202         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
38203         FREE(untag_ptr(_res));
38204         COption_HTLCDestinationZ_free(_res_conv);
38205 }
38206
38207 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
38208         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
38209         *ret_copy = COption_HTLCDestinationZ_clone(arg);
38210         int64_t ret_ref = tag_ptr(ret_copy, true);
38211         return ret_ref;
38212 }
38213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38214         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
38215         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
38216         return ret_conv;
38217 }
38218
38219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38220         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
38221         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
38222         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
38223         int64_t ret_ref = tag_ptr(ret_copy, true);
38224         return ret_ref;
38225 }
38226
38227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38228         void* o_ptr = untag_ptr(o);
38229         CHECK_ACCESS(o_ptr);
38230         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
38231         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
38232         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
38233         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
38234         return tag_ptr(ret_conv, true);
38235 }
38236
38237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38238         void* e_ptr = untag_ptr(e);
38239         CHECK_ACCESS(e_ptr);
38240         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38241         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38242         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
38243         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
38244         return tag_ptr(ret_conv, true);
38245 }
38246
38247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38248         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
38249         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
38250         return ret_conv;
38251 }
38252
38253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38254         if (!ptr_is_owned(_res)) return;
38255         void* _res_ptr = untag_ptr(_res);
38256         CHECK_ACCESS(_res_ptr);
38257         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
38258         FREE(untag_ptr(_res));
38259         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
38260 }
38261
38262 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
38263         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
38264         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
38265         return tag_ptr(ret_conv, true);
38266 }
38267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38268         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
38269         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
38270         return ret_conv;
38271 }
38272
38273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38274         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
38275         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
38276         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
38277         return tag_ptr(ret_conv, true);
38278 }
38279
38280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
38281         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
38282         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
38283         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
38284         return tag_ptr(ret_conv, true);
38285 }
38286
38287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38288         void* e_ptr = untag_ptr(e);
38289         CHECK_ACCESS(e_ptr);
38290         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38291         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38292         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
38293         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
38294         return tag_ptr(ret_conv, true);
38295 }
38296
38297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38298         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
38299         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
38300         return ret_conv;
38301 }
38302
38303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38304         if (!ptr_is_owned(_res)) return;
38305         void* _res_ptr = untag_ptr(_res);
38306         CHECK_ACCESS(_res_ptr);
38307         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
38308         FREE(untag_ptr(_res));
38309         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
38310 }
38311
38312 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
38313         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
38314         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
38315         return tag_ptr(ret_conv, true);
38316 }
38317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38318         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
38319         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
38320         return ret_conv;
38321 }
38322
38323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38324         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
38325         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
38326         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
38327         return tag_ptr(ret_conv, true);
38328 }
38329
38330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
38331         LDKU128 o_ref;
38332         CHECK((*env)->GetArrayLength(env, o) == 16);
38333         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
38334         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
38335         *ret_copy = COption_U128Z_some(o_ref);
38336         int64_t ret_ref = tag_ptr(ret_copy, true);
38337         return ret_ref;
38338 }
38339
38340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
38341         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
38342         *ret_copy = COption_U128Z_none();
38343         int64_t ret_ref = tag_ptr(ret_copy, true);
38344         return ret_ref;
38345 }
38346
38347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
38348         if (!ptr_is_owned(_res)) return;
38349         void* _res_ptr = untag_ptr(_res);
38350         CHECK_ACCESS(_res_ptr);
38351         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
38352         FREE(untag_ptr(_res));
38353         COption_U128Z_free(_res_conv);
38354 }
38355
38356 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
38357         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
38358         *ret_copy = COption_U128Z_clone(arg);
38359         int64_t ret_ref = tag_ptr(ret_copy, true);
38360         return ret_ref;
38361 }
38362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38363         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
38364         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
38365         return ret_conv;
38366 }
38367
38368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38369         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
38370         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
38371         *ret_copy = COption_U128Z_clone(orig_conv);
38372         int64_t ret_ref = tag_ptr(ret_copy, true);
38373         return ret_ref;
38374 }
38375
38376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
38377         LDKCVec_ClaimedHTLCZ _res_constr;
38378         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
38379         if (_res_constr.datalen > 0)
38380                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
38381         else
38382                 _res_constr.data = NULL;
38383         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
38384         for (size_t n = 0; n < _res_constr.datalen; n++) {
38385                 int64_t _res_conv_13 = _res_vals[n];
38386                 LDKClaimedHTLC _res_conv_13_conv;
38387                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
38388                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
38389                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
38390                 _res_constr.data[n] = _res_conv_13_conv;
38391         }
38392         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
38393         CVec_ClaimedHTLCZ_free(_res_constr);
38394 }
38395
38396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
38397         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
38398         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
38399         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
38400         int64_t ret_ref = tag_ptr(ret_copy, true);
38401         return ret_ref;
38402 }
38403
38404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
38405         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
38406         *ret_copy = COption_PaymentFailureReasonZ_none();
38407         int64_t ret_ref = tag_ptr(ret_copy, true);
38408         return ret_ref;
38409 }
38410
38411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38412         if (!ptr_is_owned(_res)) return;
38413         void* _res_ptr = untag_ptr(_res);
38414         CHECK_ACCESS(_res_ptr);
38415         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
38416         FREE(untag_ptr(_res));
38417         COption_PaymentFailureReasonZ_free(_res_conv);
38418 }
38419
38420 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
38421         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
38422         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
38423         int64_t ret_ref = tag_ptr(ret_copy, true);
38424         return ret_ref;
38425 }
38426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38427         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
38428         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
38429         return ret_conv;
38430 }
38431
38432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38433         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
38434         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
38435         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
38436         int64_t ret_ref = tag_ptr(ret_copy, true);
38437         return ret_ref;
38438 }
38439
38440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
38441         void* o_ptr = untag_ptr(o);
38442         CHECK_ACCESS(o_ptr);
38443         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
38444         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
38445         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
38446         *ret_copy = COption_EventZ_some(o_conv);
38447         int64_t ret_ref = tag_ptr(ret_copy, true);
38448         return ret_ref;
38449 }
38450
38451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
38452         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
38453         *ret_copy = COption_EventZ_none();
38454         int64_t ret_ref = tag_ptr(ret_copy, true);
38455         return ret_ref;
38456 }
38457
38458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38459         if (!ptr_is_owned(_res)) return;
38460         void* _res_ptr = untag_ptr(_res);
38461         CHECK_ACCESS(_res_ptr);
38462         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
38463         FREE(untag_ptr(_res));
38464         COption_EventZ_free(_res_conv);
38465 }
38466
38467 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
38468         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
38469         *ret_copy = COption_EventZ_clone(arg);
38470         int64_t ret_ref = tag_ptr(ret_copy, true);
38471         return ret_ref;
38472 }
38473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38474         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
38475         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
38476         return ret_conv;
38477 }
38478
38479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38480         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
38481         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
38482         *ret_copy = COption_EventZ_clone(orig_conv);
38483         int64_t ret_ref = tag_ptr(ret_copy, true);
38484         return ret_ref;
38485 }
38486
38487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38488         void* o_ptr = untag_ptr(o);
38489         CHECK_ACCESS(o_ptr);
38490         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
38491         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
38492         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
38493         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
38494         return tag_ptr(ret_conv, true);
38495 }
38496
38497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38498         void* e_ptr = untag_ptr(e);
38499         CHECK_ACCESS(e_ptr);
38500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38502         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
38503         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
38504         return tag_ptr(ret_conv, true);
38505 }
38506
38507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38508         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
38509         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
38510         return ret_conv;
38511 }
38512
38513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38514         if (!ptr_is_owned(_res)) return;
38515         void* _res_ptr = untag_ptr(_res);
38516         CHECK_ACCESS(_res_ptr);
38517         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
38518         FREE(untag_ptr(_res));
38519         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
38520 }
38521
38522 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
38523         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
38524         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
38525         return tag_ptr(ret_conv, true);
38526 }
38527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38528         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
38529         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
38530         return ret_conv;
38531 }
38532
38533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38534         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
38535         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
38536         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
38537         return tag_ptr(ret_conv, true);
38538 }
38539
38540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
38541         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
38542         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
38543         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
38544         return tag_ptr(ret_conv, true);
38545 }
38546
38547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38548         void* e_ptr = untag_ptr(e);
38549         CHECK_ACCESS(e_ptr);
38550         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
38551         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
38552         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
38553         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
38554         return tag_ptr(ret_conv, true);
38555 }
38556
38557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38558         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
38559         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
38560         return ret_conv;
38561 }
38562
38563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38564         if (!ptr_is_owned(_res)) return;
38565         void* _res_ptr = untag_ptr(_res);
38566         CHECK_ACCESS(_res_ptr);
38567         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
38568         FREE(untag_ptr(_res));
38569         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
38570 }
38571
38572 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
38573         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
38574         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
38575         return tag_ptr(ret_conv, true);
38576 }
38577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38578         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
38579         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
38580         return ret_conv;
38581 }
38582
38583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38584         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
38585         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
38586         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
38587         return tag_ptr(ret_conv, true);
38588 }
38589
38590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38591         LDKBolt11Invoice o_conv;
38592         o_conv.inner = untag_ptr(o);
38593         o_conv.is_owned = ptr_is_owned(o);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38595         o_conv = Bolt11Invoice_clone(&o_conv);
38596         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38597         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
38598         return tag_ptr(ret_conv, true);
38599 }
38600
38601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38602         void* e_ptr = untag_ptr(e);
38603         CHECK_ACCESS(e_ptr);
38604         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
38605         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
38606         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38607         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
38608         return tag_ptr(ret_conv, true);
38609 }
38610
38611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38612         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
38613         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
38614         return ret_conv;
38615 }
38616
38617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38618         if (!ptr_is_owned(_res)) return;
38619         void* _res_ptr = untag_ptr(_res);
38620         CHECK_ACCESS(_res_ptr);
38621         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
38622         FREE(untag_ptr(_res));
38623         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
38624 }
38625
38626 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
38627         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38628         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
38629         return tag_ptr(ret_conv, true);
38630 }
38631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38632         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
38633         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
38634         return ret_conv;
38635 }
38636
38637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38638         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
38639         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38640         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
38641         return tag_ptr(ret_conv, true);
38642 }
38643
38644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38645         LDKSignedRawBolt11Invoice o_conv;
38646         o_conv.inner = untag_ptr(o);
38647         o_conv.is_owned = ptr_is_owned(o);
38648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38649         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
38650         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38651         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
38652         return tag_ptr(ret_conv, true);
38653 }
38654
38655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38656         void* e_ptr = untag_ptr(e);
38657         CHECK_ACCESS(e_ptr);
38658         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
38659         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
38660         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38661         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
38662         return tag_ptr(ret_conv, true);
38663 }
38664
38665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38666         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
38667         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
38668         return ret_conv;
38669 }
38670
38671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38672         if (!ptr_is_owned(_res)) return;
38673         void* _res_ptr = untag_ptr(_res);
38674         CHECK_ACCESS(_res_ptr);
38675         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
38676         FREE(untag_ptr(_res));
38677         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
38678 }
38679
38680 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
38681         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38682         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
38683         return tag_ptr(ret_conv, true);
38684 }
38685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38686         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
38687         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
38688         return ret_conv;
38689 }
38690
38691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38692         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
38693         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38694         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
38695         return tag_ptr(ret_conv, true);
38696 }
38697
38698 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
38699         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38700         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
38701         return tag_ptr(ret_conv, true);
38702 }
38703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38704         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
38705         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
38706         return ret_conv;
38707 }
38708
38709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38710         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
38711         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38712         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
38713         return tag_ptr(ret_conv, true);
38714 }
38715
38716 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) {
38717         LDKRawBolt11Invoice a_conv;
38718         a_conv.inner = untag_ptr(a);
38719         a_conv.is_owned = ptr_is_owned(a);
38720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38721         a_conv = RawBolt11Invoice_clone(&a_conv);
38722         LDKThirtyTwoBytes b_ref;
38723         CHECK((*env)->GetArrayLength(env, b) == 32);
38724         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
38725         LDKBolt11InvoiceSignature c_conv;
38726         c_conv.inner = untag_ptr(c);
38727         c_conv.is_owned = ptr_is_owned(c);
38728         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
38729         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
38730         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38731         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
38732         return tag_ptr(ret_conv, true);
38733 }
38734
38735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38736         if (!ptr_is_owned(_res)) return;
38737         void* _res_ptr = untag_ptr(_res);
38738         CHECK_ACCESS(_res_ptr);
38739         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
38740         FREE(untag_ptr(_res));
38741         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
38742 }
38743
38744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38745         LDKPayeePubKey o_conv;
38746         o_conv.inner = untag_ptr(o);
38747         o_conv.is_owned = ptr_is_owned(o);
38748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38749         o_conv = PayeePubKey_clone(&o_conv);
38750         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38751         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
38752         return tag_ptr(ret_conv, true);
38753 }
38754
38755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38756         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
38757         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38758         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
38759         return tag_ptr(ret_conv, true);
38760 }
38761
38762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38763         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
38764         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
38765         return ret_conv;
38766 }
38767
38768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38769         if (!ptr_is_owned(_res)) return;
38770         void* _res_ptr = untag_ptr(_res);
38771         CHECK_ACCESS(_res_ptr);
38772         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
38773         FREE(untag_ptr(_res));
38774         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
38775 }
38776
38777 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
38778         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38779         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
38780         return tag_ptr(ret_conv, true);
38781 }
38782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38783         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
38784         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
38785         return ret_conv;
38786 }
38787
38788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38789         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
38790         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38791         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
38792         return tag_ptr(ret_conv, true);
38793 }
38794
38795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
38796         LDKCVec_PrivateRouteZ _res_constr;
38797         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
38798         if (_res_constr.datalen > 0)
38799                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
38800         else
38801                 _res_constr.data = NULL;
38802         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
38803         for (size_t o = 0; o < _res_constr.datalen; o++) {
38804                 int64_t _res_conv_14 = _res_vals[o];
38805                 LDKPrivateRoute _res_conv_14_conv;
38806                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
38807                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
38808                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
38809                 _res_constr.data[o] = _res_conv_14_conv;
38810         }
38811         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
38812         CVec_PrivateRouteZ_free(_res_constr);
38813 }
38814
38815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38816         LDKPositiveTimestamp o_conv;
38817         o_conv.inner = untag_ptr(o);
38818         o_conv.is_owned = ptr_is_owned(o);
38819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38820         o_conv = PositiveTimestamp_clone(&o_conv);
38821         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38822         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
38823         return tag_ptr(ret_conv, true);
38824 }
38825
38826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38827         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38828         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38829         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
38830         return tag_ptr(ret_conv, true);
38831 }
38832
38833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38834         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
38835         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
38836         return ret_conv;
38837 }
38838
38839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38840         if (!ptr_is_owned(_res)) return;
38841         void* _res_ptr = untag_ptr(_res);
38842         CHECK_ACCESS(_res_ptr);
38843         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
38844         FREE(untag_ptr(_res));
38845         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
38846 }
38847
38848 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
38849         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38850         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
38851         return tag_ptr(ret_conv, true);
38852 }
38853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38854         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
38855         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
38856         return ret_conv;
38857 }
38858
38859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38860         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
38861         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38862         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
38863         return tag_ptr(ret_conv, true);
38864 }
38865
38866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
38867         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38868         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
38869         return tag_ptr(ret_conv, true);
38870 }
38871
38872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38873         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
38874         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38875         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
38876         return tag_ptr(ret_conv, true);
38877 }
38878
38879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38880         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
38881         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
38882         return ret_conv;
38883 }
38884
38885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38886         if (!ptr_is_owned(_res)) return;
38887         void* _res_ptr = untag_ptr(_res);
38888         CHECK_ACCESS(_res_ptr);
38889         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
38890         FREE(untag_ptr(_res));
38891         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
38892 }
38893
38894 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
38895         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38896         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
38897         return tag_ptr(ret_conv, true);
38898 }
38899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38900         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
38901         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
38902         return ret_conv;
38903 }
38904
38905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38906         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
38907         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38908         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
38909         return tag_ptr(ret_conv, true);
38910 }
38911
38912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38913         LDKBolt11Invoice o_conv;
38914         o_conv.inner = untag_ptr(o);
38915         o_conv.is_owned = ptr_is_owned(o);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38917         o_conv = Bolt11Invoice_clone(&o_conv);
38918         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38919         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
38920         return tag_ptr(ret_conv, true);
38921 }
38922
38923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38924         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
38925         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38926         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
38927         return tag_ptr(ret_conv, true);
38928 }
38929
38930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38931         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
38932         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
38933         return ret_conv;
38934 }
38935
38936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38937         if (!ptr_is_owned(_res)) return;
38938         void* _res_ptr = untag_ptr(_res);
38939         CHECK_ACCESS(_res_ptr);
38940         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
38941         FREE(untag_ptr(_res));
38942         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
38943 }
38944
38945 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
38946         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38947         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
38948         return tag_ptr(ret_conv, true);
38949 }
38950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38951         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
38952         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
38953         return ret_conv;
38954 }
38955
38956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38957         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
38958         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38959         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
38960         return tag_ptr(ret_conv, true);
38961 }
38962
38963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38964         LDKDescription o_conv;
38965         o_conv.inner = untag_ptr(o);
38966         o_conv.is_owned = ptr_is_owned(o);
38967         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38968         o_conv = Description_clone(&o_conv);
38969         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38970         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
38971         return tag_ptr(ret_conv, true);
38972 }
38973
38974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38975         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38976         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38977         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
38978         return tag_ptr(ret_conv, true);
38979 }
38980
38981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38982         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
38983         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
38984         return ret_conv;
38985 }
38986
38987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38988         if (!ptr_is_owned(_res)) return;
38989         void* _res_ptr = untag_ptr(_res);
38990         CHECK_ACCESS(_res_ptr);
38991         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
38992         FREE(untag_ptr(_res));
38993         CResult_DescriptionCreationErrorZ_free(_res_conv);
38994 }
38995
38996 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
38997         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38998         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
38999         return tag_ptr(ret_conv, true);
39000 }
39001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39002         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
39003         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
39004         return ret_conv;
39005 }
39006
39007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39008         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
39009         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
39010         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
39011         return tag_ptr(ret_conv, true);
39012 }
39013
39014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39015         LDKPrivateRoute o_conv;
39016         o_conv.inner = untag_ptr(o);
39017         o_conv.is_owned = ptr_is_owned(o);
39018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39019         o_conv = PrivateRoute_clone(&o_conv);
39020         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
39021         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
39022         return tag_ptr(ret_conv, true);
39023 }
39024
39025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39026         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
39027         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
39028         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
39029         return tag_ptr(ret_conv, true);
39030 }
39031
39032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39033         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
39034         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
39035         return ret_conv;
39036 }
39037
39038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39039         if (!ptr_is_owned(_res)) return;
39040         void* _res_ptr = untag_ptr(_res);
39041         CHECK_ACCESS(_res_ptr);
39042         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
39043         FREE(untag_ptr(_res));
39044         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
39045 }
39046
39047 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
39048         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
39049         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
39050         return tag_ptr(ret_conv, true);
39051 }
39052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39053         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
39054         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
39055         return ret_conv;
39056 }
39057
39058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39059         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
39060         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
39061         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
39062         return tag_ptr(ret_conv, true);
39063 }
39064
39065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39066         LDKOutPoint o_conv;
39067         o_conv.inner = untag_ptr(o);
39068         o_conv.is_owned = ptr_is_owned(o);
39069         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39070         o_conv = OutPoint_clone(&o_conv);
39071         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39072         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
39073         return tag_ptr(ret_conv, true);
39074 }
39075
39076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39077         void* e_ptr = untag_ptr(e);
39078         CHECK_ACCESS(e_ptr);
39079         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39080         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39081         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39082         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
39083         return tag_ptr(ret_conv, true);
39084 }
39085
39086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39087         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
39088         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
39089         return ret_conv;
39090 }
39091
39092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39093         if (!ptr_is_owned(_res)) return;
39094         void* _res_ptr = untag_ptr(_res);
39095         CHECK_ACCESS(_res_ptr);
39096         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
39097         FREE(untag_ptr(_res));
39098         CResult_OutPointDecodeErrorZ_free(_res_conv);
39099 }
39100
39101 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
39102         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39103         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
39104         return tag_ptr(ret_conv, true);
39105 }
39106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39107         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
39108         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
39109         return ret_conv;
39110 }
39111
39112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39113         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
39114         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39115         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
39116         return tag_ptr(ret_conv, true);
39117 }
39118
39119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39120         LDKBigSize o_conv;
39121         o_conv.inner = untag_ptr(o);
39122         o_conv.is_owned = ptr_is_owned(o);
39123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39124         o_conv = BigSize_clone(&o_conv);
39125         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
39126         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
39127         return tag_ptr(ret_conv, true);
39128 }
39129
39130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39131         void* e_ptr = untag_ptr(e);
39132         CHECK_ACCESS(e_ptr);
39133         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39134         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39135         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
39136         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
39137         return tag_ptr(ret_conv, true);
39138 }
39139
39140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39141         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
39142         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
39143         return ret_conv;
39144 }
39145
39146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39147         if (!ptr_is_owned(_res)) return;
39148         void* _res_ptr = untag_ptr(_res);
39149         CHECK_ACCESS(_res_ptr);
39150         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
39151         FREE(untag_ptr(_res));
39152         CResult_BigSizeDecodeErrorZ_free(_res_conv);
39153 }
39154
39155 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
39156         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
39157         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
39158         return tag_ptr(ret_conv, true);
39159 }
39160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39161         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
39162         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
39163         return ret_conv;
39164 }
39165
39166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39167         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
39168         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
39169         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
39170         return tag_ptr(ret_conv, true);
39171 }
39172
39173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39174         LDKHostname o_conv;
39175         o_conv.inner = untag_ptr(o);
39176         o_conv.is_owned = ptr_is_owned(o);
39177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39178         o_conv = Hostname_clone(&o_conv);
39179         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
39180         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
39181         return tag_ptr(ret_conv, true);
39182 }
39183
39184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39185         void* e_ptr = untag_ptr(e);
39186         CHECK_ACCESS(e_ptr);
39187         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39188         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39189         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
39190         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
39191         return tag_ptr(ret_conv, true);
39192 }
39193
39194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39195         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
39196         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
39197         return ret_conv;
39198 }
39199
39200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39201         if (!ptr_is_owned(_res)) return;
39202         void* _res_ptr = untag_ptr(_res);
39203         CHECK_ACCESS(_res_ptr);
39204         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
39205         FREE(untag_ptr(_res));
39206         CResult_HostnameDecodeErrorZ_free(_res_conv);
39207 }
39208
39209 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
39210         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
39211         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
39212         return tag_ptr(ret_conv, true);
39213 }
39214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39215         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
39216         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
39217         return ret_conv;
39218 }
39219
39220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39221         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
39222         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
39223         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
39224         return tag_ptr(ret_conv, true);
39225 }
39226
39227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39228         LDKTransactionU16LenLimited o_conv;
39229         o_conv.inner = untag_ptr(o);
39230         o_conv.is_owned = ptr_is_owned(o);
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39232         o_conv = TransactionU16LenLimited_clone(&o_conv);
39233         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
39234         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
39235         return tag_ptr(ret_conv, true);
39236 }
39237
39238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
39239         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
39240         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
39241         return tag_ptr(ret_conv, true);
39242 }
39243
39244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39245         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
39246         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
39247         return ret_conv;
39248 }
39249
39250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39251         if (!ptr_is_owned(_res)) return;
39252         void* _res_ptr = untag_ptr(_res);
39253         CHECK_ACCESS(_res_ptr);
39254         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
39255         FREE(untag_ptr(_res));
39256         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
39257 }
39258
39259 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
39260         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
39261         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
39262         return tag_ptr(ret_conv, true);
39263 }
39264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39265         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
39266         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
39267         return ret_conv;
39268 }
39269
39270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39271         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
39272         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
39273         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
39274         return tag_ptr(ret_conv, true);
39275 }
39276
39277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39278         LDKTransactionU16LenLimited o_conv;
39279         o_conv.inner = untag_ptr(o);
39280         o_conv.is_owned = ptr_is_owned(o);
39281         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39282         o_conv = TransactionU16LenLimited_clone(&o_conv);
39283         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
39284         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
39285         return tag_ptr(ret_conv, true);
39286 }
39287
39288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39289         void* e_ptr = untag_ptr(e);
39290         CHECK_ACCESS(e_ptr);
39291         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39292         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39293         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
39294         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
39295         return tag_ptr(ret_conv, true);
39296 }
39297
39298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39299         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
39300         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
39301         return ret_conv;
39302 }
39303
39304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39305         if (!ptr_is_owned(_res)) return;
39306         void* _res_ptr = untag_ptr(_res);
39307         CHECK_ACCESS(_res_ptr);
39308         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
39309         FREE(untag_ptr(_res));
39310         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
39311 }
39312
39313 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
39314         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
39315         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
39316         return tag_ptr(ret_conv, true);
39317 }
39318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39319         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
39320         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
39321         return ret_conv;
39322 }
39323
39324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39325         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
39326         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
39327         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
39328         return tag_ptr(ret_conv, true);
39329 }
39330
39331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39332         LDKUntrustedString o_conv;
39333         o_conv.inner = untag_ptr(o);
39334         o_conv.is_owned = ptr_is_owned(o);
39335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39336         o_conv = UntrustedString_clone(&o_conv);
39337         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
39338         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
39339         return tag_ptr(ret_conv, true);
39340 }
39341
39342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39343         void* e_ptr = untag_ptr(e);
39344         CHECK_ACCESS(e_ptr);
39345         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39346         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39347         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
39348         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
39349         return tag_ptr(ret_conv, true);
39350 }
39351
39352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39353         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
39354         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
39355         return ret_conv;
39356 }
39357
39358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39359         if (!ptr_is_owned(_res)) return;
39360         void* _res_ptr = untag_ptr(_res);
39361         CHECK_ACCESS(_res_ptr);
39362         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
39363         FREE(untag_ptr(_res));
39364         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
39365 }
39366
39367 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
39368         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
39369         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
39370         return tag_ptr(ret_conv, true);
39371 }
39372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39373         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
39374         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
39375         return ret_conv;
39376 }
39377
39378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39379         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
39380         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
39381         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
39382         return tag_ptr(ret_conv, true);
39383 }
39384
39385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39386         LDKChannelId o_conv;
39387         o_conv.inner = untag_ptr(o);
39388         o_conv.is_owned = ptr_is_owned(o);
39389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39390         o_conv = ChannelId_clone(&o_conv);
39391         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
39392         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
39393         return tag_ptr(ret_conv, true);
39394 }
39395
39396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39397         void* e_ptr = untag_ptr(e);
39398         CHECK_ACCESS(e_ptr);
39399         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39400         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39401         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
39402         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
39403         return tag_ptr(ret_conv, true);
39404 }
39405
39406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39407         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
39408         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
39409         return ret_conv;
39410 }
39411
39412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39413         if (!ptr_is_owned(_res)) return;
39414         void* _res_ptr = untag_ptr(_res);
39415         CHECK_ACCESS(_res_ptr);
39416         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
39417         FREE(untag_ptr(_res));
39418         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
39419 }
39420
39421 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
39422         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
39423         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
39424         return tag_ptr(ret_conv, true);
39425 }
39426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39427         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
39428         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
39429         return ret_conv;
39430 }
39431
39432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39433         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
39434         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
39435         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
39436         return tag_ptr(ret_conv, true);
39437 }
39438
39439 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
39440         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
39441         *ret_conv = C2Tuple__u832u16Z_clone(arg);
39442         return tag_ptr(ret_conv, true);
39443 }
39444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39445         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
39446         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
39447         return ret_conv;
39448 }
39449
39450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39451         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
39452         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
39453         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
39454         return tag_ptr(ret_conv, true);
39455 }
39456
39457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int16_t b) {
39458         LDKThirtyTwoBytes a_ref;
39459         CHECK((*env)->GetArrayLength(env, a) == 32);
39460         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
39461         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
39462         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
39463         return tag_ptr(ret_conv, true);
39464 }
39465
39466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
39467         if (!ptr_is_owned(_res)) return;
39468         void* _res_ptr = untag_ptr(_res);
39469         CHECK_ACCESS(_res_ptr);
39470         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
39471         FREE(untag_ptr(_res));
39472         C2Tuple__u832u16Z_free(_res_conv);
39473 }
39474
39475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39476         LDKPaymentRelay o_conv;
39477         o_conv.inner = untag_ptr(o);
39478         o_conv.is_owned = ptr_is_owned(o);
39479         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39480         o_conv = PaymentRelay_clone(&o_conv);
39481         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
39482         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
39483         return tag_ptr(ret_conv, true);
39484 }
39485
39486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39487         void* e_ptr = untag_ptr(e);
39488         CHECK_ACCESS(e_ptr);
39489         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39490         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39491         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
39492         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
39493         return tag_ptr(ret_conv, true);
39494 }
39495
39496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39497         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
39498         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
39499         return ret_conv;
39500 }
39501
39502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39503         if (!ptr_is_owned(_res)) return;
39504         void* _res_ptr = untag_ptr(_res);
39505         CHECK_ACCESS(_res_ptr);
39506         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
39507         FREE(untag_ptr(_res));
39508         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
39509 }
39510
39511 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
39512         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
39513         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
39514         return tag_ptr(ret_conv, true);
39515 }
39516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39517         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
39518         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
39519         return ret_conv;
39520 }
39521
39522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39523         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
39524         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
39525         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
39526         return tag_ptr(ret_conv, true);
39527 }
39528
39529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39530         LDKPaymentConstraints o_conv;
39531         o_conv.inner = untag_ptr(o);
39532         o_conv.is_owned = ptr_is_owned(o);
39533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39534         o_conv = PaymentConstraints_clone(&o_conv);
39535         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
39536         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
39537         return tag_ptr(ret_conv, true);
39538 }
39539
39540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39541         void* e_ptr = untag_ptr(e);
39542         CHECK_ACCESS(e_ptr);
39543         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39544         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39545         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
39546         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
39547         return tag_ptr(ret_conv, true);
39548 }
39549
39550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39551         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
39552         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
39553         return ret_conv;
39554 }
39555
39556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39557         if (!ptr_is_owned(_res)) return;
39558         void* _res_ptr = untag_ptr(_res);
39559         CHECK_ACCESS(_res_ptr);
39560         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
39561         FREE(untag_ptr(_res));
39562         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
39563 }
39564
39565 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
39566         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
39567         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
39568         return tag_ptr(ret_conv, true);
39569 }
39570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39571         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
39572         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
39573         return ret_conv;
39574 }
39575
39576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39577         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
39578         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
39579         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
39580         return tag_ptr(ret_conv, true);
39581 }
39582
39583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39584         void* o_ptr = untag_ptr(o);
39585         CHECK_ACCESS(o_ptr);
39586         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
39587         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
39588         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39589         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
39590         return tag_ptr(ret_conv, true);
39591 }
39592
39593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39594         void* e_ptr = untag_ptr(e);
39595         CHECK_ACCESS(e_ptr);
39596         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39597         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39598         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39599         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
39600         return tag_ptr(ret_conv, true);
39601 }
39602
39603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39604         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
39605         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
39606         return ret_conv;
39607 }
39608
39609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39610         if (!ptr_is_owned(_res)) return;
39611         void* _res_ptr = untag_ptr(_res);
39612         CHECK_ACCESS(_res_ptr);
39613         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
39614         FREE(untag_ptr(_res));
39615         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
39616 }
39617
39618 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
39619         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39620         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
39621         return tag_ptr(ret_conv, true);
39622 }
39623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39624         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
39625         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
39626         return ret_conv;
39627 }
39628
39629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39630         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
39631         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39632         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
39633         return tag_ptr(ret_conv, true);
39634 }
39635
39636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39637         LDKUnknownPaymentContext o_conv;
39638         o_conv.inner = untag_ptr(o);
39639         o_conv.is_owned = ptr_is_owned(o);
39640         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39641         o_conv = UnknownPaymentContext_clone(&o_conv);
39642         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39643         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
39644         return tag_ptr(ret_conv, true);
39645 }
39646
39647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39648         void* e_ptr = untag_ptr(e);
39649         CHECK_ACCESS(e_ptr);
39650         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39651         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39652         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39653         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
39654         return tag_ptr(ret_conv, true);
39655 }
39656
39657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39658         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
39659         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
39660         return ret_conv;
39661 }
39662
39663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39664         if (!ptr_is_owned(_res)) return;
39665         void* _res_ptr = untag_ptr(_res);
39666         CHECK_ACCESS(_res_ptr);
39667         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
39668         FREE(untag_ptr(_res));
39669         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
39670 }
39671
39672 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
39673         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39674         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
39675         return tag_ptr(ret_conv, true);
39676 }
39677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39678         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
39679         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
39680         return ret_conv;
39681 }
39682
39683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39684         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
39685         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39686         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
39687         return tag_ptr(ret_conv, true);
39688 }
39689
39690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39691         LDKBolt12OfferContext o_conv;
39692         o_conv.inner = untag_ptr(o);
39693         o_conv.is_owned = ptr_is_owned(o);
39694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39695         o_conv = Bolt12OfferContext_clone(&o_conv);
39696         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39697         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
39698         return tag_ptr(ret_conv, true);
39699 }
39700
39701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39702         void* e_ptr = untag_ptr(e);
39703         CHECK_ACCESS(e_ptr);
39704         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39705         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39706         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39707         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
39708         return tag_ptr(ret_conv, true);
39709 }
39710
39711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39712         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
39713         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
39714         return ret_conv;
39715 }
39716
39717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39718         if (!ptr_is_owned(_res)) return;
39719         void* _res_ptr = untag_ptr(_res);
39720         CHECK_ACCESS(_res_ptr);
39721         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
39722         FREE(untag_ptr(_res));
39723         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
39724 }
39725
39726 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
39727         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39728         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
39729         return tag_ptr(ret_conv, true);
39730 }
39731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39732         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
39733         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
39734         return ret_conv;
39735 }
39736
39737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39738         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
39739         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39740         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
39741         return tag_ptr(ret_conv, true);
39742 }
39743
39744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39745         LDKBolt12RefundContext o_conv;
39746         o_conv.inner = untag_ptr(o);
39747         o_conv.is_owned = ptr_is_owned(o);
39748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39749         o_conv = Bolt12RefundContext_clone(&o_conv);
39750         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39751         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
39752         return tag_ptr(ret_conv, true);
39753 }
39754
39755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39756         void* e_ptr = untag_ptr(e);
39757         CHECK_ACCESS(e_ptr);
39758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39760         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39761         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
39762         return tag_ptr(ret_conv, true);
39763 }
39764
39765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39766         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
39767         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
39768         return ret_conv;
39769 }
39770
39771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39772         if (!ptr_is_owned(_res)) return;
39773         void* _res_ptr = untag_ptr(_res);
39774         CHECK_ACCESS(_res_ptr);
39775         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
39776         FREE(untag_ptr(_res));
39777         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
39778 }
39779
39780 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
39781         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39782         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
39783         return tag_ptr(ret_conv, true);
39784 }
39785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39786         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
39787         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
39788         return ret_conv;
39789 }
39790
39791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39792         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
39793         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39794         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
39795         return tag_ptr(ret_conv, true);
39796 }
39797
39798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
39799         LDKStr o_conv = java_to_owned_str(env, o);
39800         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39801         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
39802         return tag_ptr(ret_conv, true);
39803 }
39804
39805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39806         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
39807         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39808         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
39809         return tag_ptr(ret_conv, true);
39810 }
39811
39812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39813         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
39814         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
39815         return ret_conv;
39816 }
39817
39818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39819         if (!ptr_is_owned(_res)) return;
39820         void* _res_ptr = untag_ptr(_res);
39821         CHECK_ACCESS(_res_ptr);
39822         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
39823         FREE(untag_ptr(_res));
39824         CResult_StrSecp256k1ErrorZ_free(_res_conv);
39825 }
39826
39827 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
39828         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39829         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
39830         return tag_ptr(ret_conv, true);
39831 }
39832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39833         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
39834         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
39835         return ret_conv;
39836 }
39837
39838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39839         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
39840         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39841         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
39842         return tag_ptr(ret_conv, true);
39843 }
39844
39845 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
39846         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39847         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
39848         return tag_ptr(ret_conv, true);
39849 }
39850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39851         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
39852         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
39853         return ret_conv;
39854 }
39855
39856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39857         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
39858         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39859         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
39860         return tag_ptr(ret_conv, true);
39861 }
39862
39863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b, int64_t c) {
39864         LDKThirtyTwoBytes a_ref;
39865         CHECK((*env)->GetArrayLength(env, a) == 32);
39866         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
39867         LDKRecipientOnionFields b_conv;
39868         b_conv.inner = untag_ptr(b);
39869         b_conv.is_owned = ptr_is_owned(b);
39870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39871         b_conv = RecipientOnionFields_clone(&b_conv);
39872         LDKRouteParameters c_conv;
39873         c_conv.inner = untag_ptr(c);
39874         c_conv.is_owned = ptr_is_owned(c);
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
39876         c_conv = RouteParameters_clone(&c_conv);
39877         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39878         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
39879         return tag_ptr(ret_conv, true);
39880 }
39881
39882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39883         if (!ptr_is_owned(_res)) return;
39884         void* _res_ptr = untag_ptr(_res);
39885         CHECK_ACCESS(_res_ptr);
39886         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
39887         FREE(untag_ptr(_res));
39888         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
39889 }
39890
39891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39892         void* o_ptr = untag_ptr(o);
39893         CHECK_ACCESS(o_ptr);
39894         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
39895         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
39896         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39897         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
39898         return tag_ptr(ret_conv, true);
39899 }
39900
39901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1err(JNIEnv *env, jclass clz) {
39902         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39903         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
39904         return tag_ptr(ret_conv, true);
39905 }
39906
39907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39908         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
39909         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
39910         return ret_conv;
39911 }
39912
39913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39914         if (!ptr_is_owned(_res)) return;
39915         void* _res_ptr = untag_ptr(_res);
39916         CHECK_ACCESS(_res_ptr);
39917         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
39918         FREE(untag_ptr(_res));
39919         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
39920 }
39921
39922 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
39923         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39924         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
39925         return tag_ptr(ret_conv, true);
39926 }
39927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39928         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
39929         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
39930         return ret_conv;
39931 }
39932
39933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39934         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
39935         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39936         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
39937         return tag_ptr(ret_conv, true);
39938 }
39939
39940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39941         void* o_ptr = untag_ptr(o);
39942         CHECK_ACCESS(o_ptr);
39943         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
39944         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
39945         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39946         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
39947         return tag_ptr(ret_conv, true);
39948 }
39949
39950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39951         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
39952         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39953         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
39954         return tag_ptr(ret_conv, true);
39955 }
39956
39957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39958         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
39959         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
39960         return ret_conv;
39961 }
39962
39963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39964         if (!ptr_is_owned(_res)) return;
39965         void* _res_ptr = untag_ptr(_res);
39966         CHECK_ACCESS(_res_ptr);
39967         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
39968         FREE(untag_ptr(_res));
39969         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
39970 }
39971
39972 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
39973         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39974         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
39975         return tag_ptr(ret_conv, true);
39976 }
39977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39978         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
39979         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
39980         return ret_conv;
39981 }
39982
39983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39984         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
39985         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39986         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
39987         return tag_ptr(ret_conv, true);
39988 }
39989
39990 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
39991         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39992         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
39993         return tag_ptr(ret_conv, true);
39994 }
39995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39996         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
39997         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
39998         return ret_conv;
39999 }
40000
40001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40002         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
40003         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
40004         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
40005         return tag_ptr(ret_conv, true);
40006 }
40007
40008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b, int64_t c) {
40009         LDKPublicKey a_ref;
40010         CHECK((*env)->GetArrayLength(env, a) == 33);
40011         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
40012         LDKOnionMessage b_conv;
40013         b_conv.inner = untag_ptr(b);
40014         b_conv.is_owned = ptr_is_owned(b);
40015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40016         b_conv = OnionMessage_clone(&b_conv);
40017         void* c_ptr = untag_ptr(c);
40018         CHECK_ACCESS(c_ptr);
40019         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
40020         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
40021         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
40022         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
40023         return tag_ptr(ret_conv, true);
40024 }
40025
40026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40027         if (!ptr_is_owned(_res)) return;
40028         void* _res_ptr = untag_ptr(_res);
40029         CHECK_ACCESS(_res_ptr);
40030         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
40031         FREE(untag_ptr(_res));
40032         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
40033 }
40034
40035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40036         void* o_ptr = untag_ptr(o);
40037         CHECK_ACCESS(o_ptr);
40038         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
40039         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
40040         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
40041         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
40042         return tag_ptr(ret_conv, true);
40043 }
40044
40045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40046         void* e_ptr = untag_ptr(e);
40047         CHECK_ACCESS(e_ptr);
40048         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
40049         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
40050         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
40051         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
40052         return tag_ptr(ret_conv, true);
40053 }
40054
40055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40056         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
40057         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
40058         return ret_conv;
40059 }
40060
40061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40062         if (!ptr_is_owned(_res)) return;
40063         void* _res_ptr = untag_ptr(_res);
40064         CHECK_ACCESS(_res_ptr);
40065         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
40066         FREE(untag_ptr(_res));
40067         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
40068 }
40069
40070 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
40071         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
40072         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
40073         return tag_ptr(ret_conv, true);
40074 }
40075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40076         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
40077         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
40078         return ret_conv;
40079 }
40080
40081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40082         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
40083         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
40084         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
40085         return tag_ptr(ret_conv, true);
40086 }
40087
40088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40089         void* o_ptr = untag_ptr(o);
40090         CHECK_ACCESS(o_ptr);
40091         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
40092         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
40093         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
40094         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
40095         return tag_ptr(ret_conv, true);
40096 }
40097
40098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
40099         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
40100         *ret_conv = CResult_PeeledOnionNoneZ_err();
40101         return tag_ptr(ret_conv, true);
40102 }
40103
40104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40105         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
40106         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
40107         return ret_conv;
40108 }
40109
40110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40111         if (!ptr_is_owned(_res)) return;
40112         void* _res_ptr = untag_ptr(_res);
40113         CHECK_ACCESS(_res_ptr);
40114         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
40115         FREE(untag_ptr(_res));
40116         CResult_PeeledOnionNoneZ_free(_res_conv);
40117 }
40118
40119 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
40120         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
40121         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
40122         return tag_ptr(ret_conv, true);
40123 }
40124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40125         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
40126         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
40127         return ret_conv;
40128 }
40129
40130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40131         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
40132         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
40133         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
40134         return tag_ptr(ret_conv, true);
40135 }
40136
40137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40138         void* o_ptr = untag_ptr(o);
40139         CHECK_ACCESS(o_ptr);
40140         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
40141         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
40142         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
40143         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
40144         return tag_ptr(ret_conv, true);
40145 }
40146
40147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40148         void* e_ptr = untag_ptr(e);
40149         CHECK_ACCESS(e_ptr);
40150         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
40151         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
40152         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
40153         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
40154         return tag_ptr(ret_conv, true);
40155 }
40156
40157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40158         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
40159         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
40160         return ret_conv;
40161 }
40162
40163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40164         if (!ptr_is_owned(_res)) return;
40165         void* _res_ptr = untag_ptr(_res);
40166         CHECK_ACCESS(_res_ptr);
40167         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
40168         FREE(untag_ptr(_res));
40169         CResult_SendSuccessSendErrorZ_free(_res_conv);
40170 }
40171
40172 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
40173         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
40174         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
40175         return tag_ptr(ret_conv, true);
40176 }
40177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40178         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
40179         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
40180         return ret_conv;
40181 }
40182
40183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40184         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
40185         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
40186         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
40187         return tag_ptr(ret_conv, true);
40188 }
40189
40190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40191         LDKBlindedPath o_conv;
40192         o_conv.inner = untag_ptr(o);
40193         o_conv.is_owned = ptr_is_owned(o);
40194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40195         o_conv = BlindedPath_clone(&o_conv);
40196         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
40197         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
40198         return tag_ptr(ret_conv, true);
40199 }
40200
40201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
40202         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
40203         *ret_conv = CResult_BlindedPathNoneZ_err();
40204         return tag_ptr(ret_conv, true);
40205 }
40206
40207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40208         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
40209         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
40210         return ret_conv;
40211 }
40212
40213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40214         if (!ptr_is_owned(_res)) return;
40215         void* _res_ptr = untag_ptr(_res);
40216         CHECK_ACCESS(_res_ptr);
40217         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
40218         FREE(untag_ptr(_res));
40219         CResult_BlindedPathNoneZ_free(_res_conv);
40220 }
40221
40222 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
40223         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
40224         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
40225         return tag_ptr(ret_conv, true);
40226 }
40227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40228         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
40229         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
40230         return ret_conv;
40231 }
40232
40233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40234         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
40235         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
40236         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
40237         return tag_ptr(ret_conv, true);
40238 }
40239
40240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40241         void* o_ptr = untag_ptr(o);
40242         CHECK_ACCESS(o_ptr);
40243         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
40244         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
40245         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
40246         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
40247         return tag_ptr(ret_conv, true);
40248 }
40249
40250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
40251         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
40252         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
40253         return tag_ptr(ret_conv, true);
40254 }
40255
40256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40257         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
40258         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
40259         return ret_conv;
40260 }
40261
40262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40263         if (!ptr_is_owned(_res)) return;
40264         void* _res_ptr = untag_ptr(_res);
40265         CHECK_ACCESS(_res_ptr);
40266         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
40267         FREE(untag_ptr(_res));
40268         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
40269 }
40270
40271 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
40272         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
40273         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
40274         return tag_ptr(ret_conv, true);
40275 }
40276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40277         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
40278         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
40279         return ret_conv;
40280 }
40281
40282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40283         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
40284         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
40285         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
40286         return tag_ptr(ret_conv, true);
40287 }
40288
40289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ForwardNodeZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40290         LDKCVec_ForwardNodeZ _res_constr;
40291         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40292         if (_res_constr.datalen > 0)
40293                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
40294         else
40295                 _res_constr.data = NULL;
40296         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40297         for (size_t n = 0; n < _res_constr.datalen; n++) {
40298                 int64_t _res_conv_13 = _res_vals[n];
40299                 LDKForwardNode _res_conv_13_conv;
40300                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
40301                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
40302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
40303                 _res_constr.data[n] = _res_conv_13_conv;
40304         }
40305         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40306         CVec_ForwardNodeZ_free(_res_constr);
40307 }
40308
40309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40310         LDKBlindedPath o_conv;
40311         o_conv.inner = untag_ptr(o);
40312         o_conv.is_owned = ptr_is_owned(o);
40313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40314         o_conv = BlindedPath_clone(&o_conv);
40315         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
40316         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
40317         return tag_ptr(ret_conv, true);
40318 }
40319
40320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40321         void* e_ptr = untag_ptr(e);
40322         CHECK_ACCESS(e_ptr);
40323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40325         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
40326         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
40327         return tag_ptr(ret_conv, true);
40328 }
40329
40330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40331         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
40332         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
40333         return ret_conv;
40334 }
40335
40336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40337         if (!ptr_is_owned(_res)) return;
40338         void* _res_ptr = untag_ptr(_res);
40339         CHECK_ACCESS(_res_ptr);
40340         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
40341         FREE(untag_ptr(_res));
40342         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
40343 }
40344
40345 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
40346         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
40347         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
40348         return tag_ptr(ret_conv, true);
40349 }
40350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40351         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
40352         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
40353         return ret_conv;
40354 }
40355
40356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40357         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
40358         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
40359         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
40360         return tag_ptr(ret_conv, true);
40361 }
40362
40363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40364         LDKBlindedHop o_conv;
40365         o_conv.inner = untag_ptr(o);
40366         o_conv.is_owned = ptr_is_owned(o);
40367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40368         o_conv = BlindedHop_clone(&o_conv);
40369         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
40370         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
40371         return tag_ptr(ret_conv, true);
40372 }
40373
40374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40375         void* e_ptr = untag_ptr(e);
40376         CHECK_ACCESS(e_ptr);
40377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40379         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
40380         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
40381         return tag_ptr(ret_conv, true);
40382 }
40383
40384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40385         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
40386         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
40387         return ret_conv;
40388 }
40389
40390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40391         if (!ptr_is_owned(_res)) return;
40392         void* _res_ptr = untag_ptr(_res);
40393         CHECK_ACCESS(_res_ptr);
40394         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
40395         FREE(untag_ptr(_res));
40396         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
40397 }
40398
40399 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
40400         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
40401         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
40402         return tag_ptr(ret_conv, true);
40403 }
40404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40405         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
40406         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
40407         return ret_conv;
40408 }
40409
40410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40411         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
40412         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
40413         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
40414         return tag_ptr(ret_conv, true);
40415 }
40416
40417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40418         LDKInvoiceError o_conv;
40419         o_conv.inner = untag_ptr(o);
40420         o_conv.is_owned = ptr_is_owned(o);
40421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40422         o_conv = InvoiceError_clone(&o_conv);
40423         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
40424         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
40425         return tag_ptr(ret_conv, true);
40426 }
40427
40428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40429         void* e_ptr = untag_ptr(e);
40430         CHECK_ACCESS(e_ptr);
40431         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40432         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40433         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
40434         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
40435         return tag_ptr(ret_conv, true);
40436 }
40437
40438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40439         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
40440         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
40441         return ret_conv;
40442 }
40443
40444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40445         if (!ptr_is_owned(_res)) return;
40446         void* _res_ptr = untag_ptr(_res);
40447         CHECK_ACCESS(_res_ptr);
40448         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
40449         FREE(untag_ptr(_res));
40450         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
40451 }
40452
40453 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
40454         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
40455         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
40456         return tag_ptr(ret_conv, true);
40457 }
40458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40459         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
40460         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
40461         return ret_conv;
40462 }
40463
40464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40465         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
40466         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
40467         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
40468         return tag_ptr(ret_conv, true);
40469 }
40470
40471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40472         LDKTrackedSpendableOutput o_conv;
40473         o_conv.inner = untag_ptr(o);
40474         o_conv.is_owned = ptr_is_owned(o);
40475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40476         o_conv = TrackedSpendableOutput_clone(&o_conv);
40477         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
40478         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
40479         return tag_ptr(ret_conv, true);
40480 }
40481
40482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40483         void* e_ptr = untag_ptr(e);
40484         CHECK_ACCESS(e_ptr);
40485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40487         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
40488         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
40489         return tag_ptr(ret_conv, true);
40490 }
40491
40492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40493         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
40494         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
40495         return ret_conv;
40496 }
40497
40498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40499         if (!ptr_is_owned(_res)) return;
40500         void* _res_ptr = untag_ptr(_res);
40501         CHECK_ACCESS(_res_ptr);
40502         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
40503         FREE(untag_ptr(_res));
40504         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
40505 }
40506
40507 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
40508         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
40509         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
40510         return tag_ptr(ret_conv, true);
40511 }
40512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40513         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
40514         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
40515         return ret_conv;
40516 }
40517
40518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40519         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
40520         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
40521         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
40522         return tag_ptr(ret_conv, true);
40523 }
40524
40525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40526         void* o_ptr = untag_ptr(o);
40527         CHECK_ACCESS(o_ptr);
40528         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
40529         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
40530         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
40531         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
40532         return tag_ptr(ret_conv, true);
40533 }
40534
40535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40536         void* e_ptr = untag_ptr(e);
40537         CHECK_ACCESS(e_ptr);
40538         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40539         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40540         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
40541         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
40542         return tag_ptr(ret_conv, true);
40543 }
40544
40545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40546         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
40547         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
40548         return ret_conv;
40549 }
40550
40551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40552         if (!ptr_is_owned(_res)) return;
40553         void* _res_ptr = untag_ptr(_res);
40554         CHECK_ACCESS(_res_ptr);
40555         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
40556         FREE(untag_ptr(_res));
40557         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
40558 }
40559
40560 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
40561         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
40562         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
40563         return tag_ptr(ret_conv, true);
40564 }
40565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40566         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
40567         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
40568         return ret_conv;
40569 }
40570
40571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40572         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
40573         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
40574         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
40575         return tag_ptr(ret_conv, true);
40576 }
40577
40578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
40579         void* o_ptr = untag_ptr(o);
40580         CHECK_ACCESS(o_ptr);
40581         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
40582         if (o_conv.free == LDKFilter_JCalls_free) {
40583                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40584                 LDKFilter_JCalls_cloned(&o_conv);
40585         }
40586         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
40587         *ret_copy = COption_FilterZ_some(o_conv);
40588         int64_t ret_ref = tag_ptr(ret_copy, true);
40589         return ret_ref;
40590 }
40591
40592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
40593         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
40594         *ret_copy = COption_FilterZ_none();
40595         int64_t ret_ref = tag_ptr(ret_copy, true);
40596         return ret_ref;
40597 }
40598
40599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40600         if (!ptr_is_owned(_res)) return;
40601         void* _res_ptr = untag_ptr(_res);
40602         CHECK_ACCESS(_res_ptr);
40603         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
40604         FREE(untag_ptr(_res));
40605         COption_FilterZ_free(_res_conv);
40606 }
40607
40608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TrackedSpendableOutputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40609         LDKCVec_TrackedSpendableOutputZ _res_constr;
40610         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40611         if (_res_constr.datalen > 0)
40612                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
40613         else
40614                 _res_constr.data = NULL;
40615         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40616         for (size_t y = 0; y < _res_constr.datalen; y++) {
40617                 int64_t _res_conv_24 = _res_vals[y];
40618                 LDKTrackedSpendableOutput _res_conv_24_conv;
40619                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
40620                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
40621                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
40622                 _res_constr.data[y] = _res_conv_24_conv;
40623         }
40624         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40625         CVec_TrackedSpendableOutputZ_free(_res_constr);
40626 }
40627
40628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40629         LDKOutputSweeper o_conv;
40630         o_conv.inner = untag_ptr(o);
40631         o_conv.is_owned = ptr_is_owned(o);
40632         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40633         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
40634         
40635         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
40636         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
40637         return tag_ptr(ret_conv, true);
40638 }
40639
40640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40641         void* e_ptr = untag_ptr(e);
40642         CHECK_ACCESS(e_ptr);
40643         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40644         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40645         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
40646         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
40647         return tag_ptr(ret_conv, true);
40648 }
40649
40650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40651         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
40652         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
40653         return ret_conv;
40654 }
40655
40656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40657         if (!ptr_is_owned(_res)) return;
40658         void* _res_ptr = untag_ptr(_res);
40659         CHECK_ACCESS(_res_ptr);
40660         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
40661         FREE(untag_ptr(_res));
40662         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
40663 }
40664
40665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40666         LDKBestBlock a_conv;
40667         a_conv.inner = untag_ptr(a);
40668         a_conv.is_owned = ptr_is_owned(a);
40669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40670         a_conv = BestBlock_clone(&a_conv);
40671         LDKOutputSweeper b_conv;
40672         b_conv.inner = untag_ptr(b);
40673         b_conv.is_owned = ptr_is_owned(b);
40674         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40675         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
40676         
40677         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
40678         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
40679         return tag_ptr(ret_conv, true);
40680 }
40681
40682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40683         if (!ptr_is_owned(_res)) return;
40684         void* _res_ptr = untag_ptr(_res);
40685         CHECK_ACCESS(_res_ptr);
40686         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
40687         FREE(untag_ptr(_res));
40688         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
40689 }
40690
40691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40692         void* o_ptr = untag_ptr(o);
40693         CHECK_ACCESS(o_ptr);
40694         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
40695         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
40696         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
40697         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
40698         return tag_ptr(ret_conv, true);
40699 }
40700
40701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40702         void* e_ptr = untag_ptr(e);
40703         CHECK_ACCESS(e_ptr);
40704         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40705         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40706         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
40707         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
40708         return tag_ptr(ret_conv, true);
40709 }
40710
40711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40712         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
40713         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
40714         return ret_conv;
40715 }
40716
40717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40718         if (!ptr_is_owned(_res)) return;
40719         void* _res_ptr = untag_ptr(_res);
40720         CHECK_ACCESS(_res_ptr);
40721         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
40722         FREE(untag_ptr(_res));
40723         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
40724 }
40725
40726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40727         LDKDelayedPaymentBasepoint o_conv;
40728         o_conv.inner = untag_ptr(o);
40729         o_conv.is_owned = ptr_is_owned(o);
40730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40731         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
40732         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40733         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
40734         return tag_ptr(ret_conv, true);
40735 }
40736
40737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40738         void* e_ptr = untag_ptr(e);
40739         CHECK_ACCESS(e_ptr);
40740         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40741         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40742         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40743         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
40744         return tag_ptr(ret_conv, true);
40745 }
40746
40747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40748         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
40749         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
40750         return ret_conv;
40751 }
40752
40753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40754         if (!ptr_is_owned(_res)) return;
40755         void* _res_ptr = untag_ptr(_res);
40756         CHECK_ACCESS(_res_ptr);
40757         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
40758         FREE(untag_ptr(_res));
40759         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
40760 }
40761
40762 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
40763         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40764         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
40765         return tag_ptr(ret_conv, true);
40766 }
40767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40768         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
40769         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
40770         return ret_conv;
40771 }
40772
40773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40774         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
40775         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40776         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
40777         return tag_ptr(ret_conv, true);
40778 }
40779
40780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40781         LDKDelayedPaymentKey o_conv;
40782         o_conv.inner = untag_ptr(o);
40783         o_conv.is_owned = ptr_is_owned(o);
40784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40785         o_conv = DelayedPaymentKey_clone(&o_conv);
40786         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40787         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
40788         return tag_ptr(ret_conv, true);
40789 }
40790
40791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40792         void* e_ptr = untag_ptr(e);
40793         CHECK_ACCESS(e_ptr);
40794         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40795         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40796         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40797         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
40798         return tag_ptr(ret_conv, true);
40799 }
40800
40801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40802         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
40803         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
40804         return ret_conv;
40805 }
40806
40807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40808         if (!ptr_is_owned(_res)) return;
40809         void* _res_ptr = untag_ptr(_res);
40810         CHECK_ACCESS(_res_ptr);
40811         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
40812         FREE(untag_ptr(_res));
40813         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
40814 }
40815
40816 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
40817         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40818         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
40819         return tag_ptr(ret_conv, true);
40820 }
40821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40822         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
40823         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
40824         return ret_conv;
40825 }
40826
40827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40828         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
40829         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40830         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
40831         return tag_ptr(ret_conv, true);
40832 }
40833
40834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40835         LDKHtlcBasepoint o_conv;
40836         o_conv.inner = untag_ptr(o);
40837         o_conv.is_owned = ptr_is_owned(o);
40838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40839         o_conv = HtlcBasepoint_clone(&o_conv);
40840         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40841         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
40842         return tag_ptr(ret_conv, true);
40843 }
40844
40845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40846         void* e_ptr = untag_ptr(e);
40847         CHECK_ACCESS(e_ptr);
40848         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40849         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40850         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40851         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
40852         return tag_ptr(ret_conv, true);
40853 }
40854
40855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40856         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
40857         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
40858         return ret_conv;
40859 }
40860
40861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40862         if (!ptr_is_owned(_res)) return;
40863         void* _res_ptr = untag_ptr(_res);
40864         CHECK_ACCESS(_res_ptr);
40865         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
40866         FREE(untag_ptr(_res));
40867         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
40868 }
40869
40870 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
40871         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40872         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
40873         return tag_ptr(ret_conv, true);
40874 }
40875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40876         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
40877         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
40878         return ret_conv;
40879 }
40880
40881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40882         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
40883         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40884         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
40885         return tag_ptr(ret_conv, true);
40886 }
40887
40888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40889         LDKHtlcKey o_conv;
40890         o_conv.inner = untag_ptr(o);
40891         o_conv.is_owned = ptr_is_owned(o);
40892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40893         o_conv = HtlcKey_clone(&o_conv);
40894         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40895         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
40896         return tag_ptr(ret_conv, true);
40897 }
40898
40899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40900         void* e_ptr = untag_ptr(e);
40901         CHECK_ACCESS(e_ptr);
40902         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40903         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40904         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40905         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
40906         return tag_ptr(ret_conv, true);
40907 }
40908
40909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40910         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
40911         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
40912         return ret_conv;
40913 }
40914
40915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40916         if (!ptr_is_owned(_res)) return;
40917         void* _res_ptr = untag_ptr(_res);
40918         CHECK_ACCESS(_res_ptr);
40919         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
40920         FREE(untag_ptr(_res));
40921         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
40922 }
40923
40924 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
40925         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40926         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
40927         return tag_ptr(ret_conv, true);
40928 }
40929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40930         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
40931         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
40932         return ret_conv;
40933 }
40934
40935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40936         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
40937         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40938         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
40939         return tag_ptr(ret_conv, true);
40940 }
40941
40942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40943         LDKRevocationBasepoint o_conv;
40944         o_conv.inner = untag_ptr(o);
40945         o_conv.is_owned = ptr_is_owned(o);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40947         o_conv = RevocationBasepoint_clone(&o_conv);
40948         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40949         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
40950         return tag_ptr(ret_conv, true);
40951 }
40952
40953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40954         void* e_ptr = untag_ptr(e);
40955         CHECK_ACCESS(e_ptr);
40956         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40957         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40958         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40959         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
40960         return tag_ptr(ret_conv, true);
40961 }
40962
40963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40964         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
40965         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
40966         return ret_conv;
40967 }
40968
40969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40970         if (!ptr_is_owned(_res)) return;
40971         void* _res_ptr = untag_ptr(_res);
40972         CHECK_ACCESS(_res_ptr);
40973         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
40974         FREE(untag_ptr(_res));
40975         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
40976 }
40977
40978 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
40979         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40980         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
40981         return tag_ptr(ret_conv, true);
40982 }
40983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40984         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
40985         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
40986         return ret_conv;
40987 }
40988
40989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40990         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
40991         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40992         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
40993         return tag_ptr(ret_conv, true);
40994 }
40995
40996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40997         LDKRevocationKey o_conv;
40998         o_conv.inner = untag_ptr(o);
40999         o_conv.is_owned = ptr_is_owned(o);
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41001         o_conv = RevocationKey_clone(&o_conv);
41002         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
41003         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
41004         return tag_ptr(ret_conv, true);
41005 }
41006
41007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
41008         void* e_ptr = untag_ptr(e);
41009         CHECK_ACCESS(e_ptr);
41010         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
41011         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
41012         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
41013         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
41014         return tag_ptr(ret_conv, true);
41015 }
41016
41017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
41018         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
41019         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
41020         return ret_conv;
41021 }
41022
41023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
41024         if (!ptr_is_owned(_res)) return;
41025         void* _res_ptr = untag_ptr(_res);
41026         CHECK_ACCESS(_res_ptr);
41027         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
41028         FREE(untag_ptr(_res));
41029         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
41030 }
41031
41032 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
41033         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
41034         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
41035         return tag_ptr(ret_conv, true);
41036 }
41037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41038         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
41039         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
41040         return ret_conv;
41041 }
41042
41043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41044         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
41045         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
41046         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
41047         return tag_ptr(ret_conv, true);
41048 }
41049
41050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
41051         LDKLockedChannelMonitor o_conv;
41052         o_conv.inner = untag_ptr(o);
41053         o_conv.is_owned = ptr_is_owned(o);
41054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41055         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
41056         
41057         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
41058         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
41059         return tag_ptr(ret_conv, true);
41060 }
41061
41062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
41063         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
41064         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
41065         return tag_ptr(ret_conv, true);
41066 }
41067
41068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
41069         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
41070         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
41071         return ret_conv;
41072 }
41073
41074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
41075         if (!ptr_is_owned(_res)) return;
41076         void* _res_ptr = untag_ptr(_res);
41077         CHECK_ACCESS(_res_ptr);
41078         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
41079         FREE(untag_ptr(_res));
41080         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
41081 }
41082
41083 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
41084         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
41085         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
41086         return tag_ptr(ret_conv, true);
41087 }
41088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41089         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
41090         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
41091         return ret_conv;
41092 }
41093
41094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41095         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
41096         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
41097         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
41098         return tag_ptr(ret_conv, true);
41099 }
41100
41101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41102         LDKOutPoint a_conv;
41103         a_conv.inner = untag_ptr(a);
41104         a_conv.is_owned = ptr_is_owned(a);
41105         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41106         a_conv = OutPoint_clone(&a_conv);
41107         LDKChannelId b_conv;
41108         b_conv.inner = untag_ptr(b);
41109         b_conv.is_owned = ptr_is_owned(b);
41110         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41111         b_conv = ChannelId_clone(&b_conv);
41112         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
41113         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
41114         return tag_ptr(ret_conv, true);
41115 }
41116
41117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
41118         if (!ptr_is_owned(_res)) return;
41119         void* _res_ptr = untag_ptr(_res);
41120         CHECK_ACCESS(_res_ptr);
41121         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
41122         FREE(untag_ptr(_res));
41123         C2Tuple_OutPointChannelIdZ_free(_res_conv);
41124 }
41125
41126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointChannelIdZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
41127         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
41128         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
41129         if (_res_constr.datalen > 0)
41130                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
41131         else
41132                 _res_constr.data = NULL;
41133         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
41134         for (size_t d = 0; d < _res_constr.datalen; d++) {
41135                 int64_t _res_conv_29 = _res_vals[d];
41136                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
41137                 CHECK_ACCESS(_res_conv_29_ptr);
41138                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
41139                 FREE(untag_ptr(_res_conv_29));
41140                 _res_constr.data[d] = _res_conv_29_conv;
41141         }
41142         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
41143         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
41144 }
41145
41146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
41147         LDKCVec_MonitorUpdateIdZ _res_constr;
41148         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
41149         if (_res_constr.datalen > 0)
41150                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
41151         else
41152                 _res_constr.data = NULL;
41153         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
41154         for (size_t r = 0; r < _res_constr.datalen; r++) {
41155                 int64_t _res_conv_17 = _res_vals[r];
41156                 LDKMonitorUpdateId _res_conv_17_conv;
41157                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
41158                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
41159                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
41160                 _res_constr.data[r] = _res_conv_17_conv;
41161         }
41162         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
41163         CVec_MonitorUpdateIdZ_free(_res_constr);
41164 }
41165
41166 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
41167         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
41168         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
41169         return tag_ptr(ret_conv, true);
41170 }
41171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41172         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
41173         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
41174         return ret_conv;
41175 }
41176
41177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41178         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
41179         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
41180         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
41181         return tag_ptr(ret_conv, true);
41182 }
41183
41184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
41185         LDKOutPoint a_conv;
41186         a_conv.inner = untag_ptr(a);
41187         a_conv.is_owned = ptr_is_owned(a);
41188         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41189         a_conv = OutPoint_clone(&a_conv);
41190         LDKCVec_MonitorUpdateIdZ b_constr;
41191         b_constr.datalen = (*env)->GetArrayLength(env, b);
41192         if (b_constr.datalen > 0)
41193                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
41194         else
41195                 b_constr.data = NULL;
41196         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
41197         for (size_t r = 0; r < b_constr.datalen; r++) {
41198                 int64_t b_conv_17 = b_vals[r];
41199                 LDKMonitorUpdateId b_conv_17_conv;
41200                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
41201                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
41202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
41203                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
41204                 b_constr.data[r] = b_conv_17_conv;
41205         }
41206         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
41207         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
41208         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
41209         return tag_ptr(ret_conv, true);
41210 }
41211
41212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
41213         if (!ptr_is_owned(_res)) return;
41214         void* _res_ptr = untag_ptr(_res);
41215         CHECK_ACCESS(_res_ptr);
41216         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
41217         FREE(untag_ptr(_res));
41218         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
41219 }
41220
41221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
41222         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
41223         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
41224         if (_res_constr.datalen > 0)
41225                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
41226         else
41227                 _res_constr.data = NULL;
41228         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
41229         for (size_t p = 0; p < _res_constr.datalen; p++) {
41230                 int64_t _res_conv_41 = _res_vals[p];
41231                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
41232                 CHECK_ACCESS(_res_conv_41_ptr);
41233                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
41234                 FREE(untag_ptr(_res_conv_41));
41235                 _res_constr.data[p] = _res_conv_41_conv;
41236         }
41237         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
41238         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
41239 }
41240
41241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41242         if (!ptr_is_owned(this_ptr)) return;
41243         void* this_ptr_ptr = untag_ptr(this_ptr);
41244         CHECK_ACCESS(this_ptr_ptr);
41245         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
41246         FREE(untag_ptr(this_ptr));
41247         APIError_free(this_ptr_conv);
41248 }
41249
41250 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
41251         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41252         *ret_copy = APIError_clone(arg);
41253         int64_t ret_ref = tag_ptr(ret_copy, true);
41254         return ret_ref;
41255 }
41256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41257         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
41258         int64_t ret_conv = APIError_clone_ptr(arg_conv);
41259         return ret_conv;
41260 }
41261
41262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41263         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
41264         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41265         *ret_copy = APIError_clone(orig_conv);
41266         int64_t ret_ref = tag_ptr(ret_copy, true);
41267         return ret_ref;
41268 }
41269
41270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
41271         LDKStr err_conv = java_to_owned_str(env, err);
41272         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41273         *ret_copy = APIError_apimisuse_error(err_conv);
41274         int64_t ret_ref = tag_ptr(ret_copy, true);
41275         return ret_ref;
41276 }
41277
41278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
41279         LDKStr err_conv = java_to_owned_str(env, err);
41280         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41281         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
41282         int64_t ret_ref = tag_ptr(ret_copy, true);
41283         return ret_ref;
41284 }
41285
41286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
41287         LDKStr err_conv = java_to_owned_str(env, err);
41288         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41289         *ret_copy = APIError_invalid_route(err_conv);
41290         int64_t ret_ref = tag_ptr(ret_copy, true);
41291         return ret_ref;
41292 }
41293
41294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
41295         LDKStr err_conv = java_to_owned_str(env, err);
41296         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41297         *ret_copy = APIError_channel_unavailable(err_conv);
41298         int64_t ret_ref = tag_ptr(ret_copy, true);
41299         return ret_ref;
41300 }
41301
41302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
41303         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41304         *ret_copy = APIError_monitor_update_in_progress();
41305         int64_t ret_ref = tag_ptr(ret_copy, true);
41306         return ret_ref;
41307 }
41308
41309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
41310         LDKShutdownScript script_conv;
41311         script_conv.inner = untag_ptr(script);
41312         script_conv.is_owned = ptr_is_owned(script);
41313         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
41314         script_conv = ShutdownScript_clone(&script_conv);
41315         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
41316         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
41317         int64_t ret_ref = tag_ptr(ret_copy, true);
41318         return ret_ref;
41319 }
41320
41321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41322         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
41323         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
41324         jboolean ret_conv = APIError_eq(a_conv, b_conv);
41325         return ret_conv;
41326 }
41327
41328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
41329         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
41330         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
41331         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41332         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41333         CVec_u8Z_free(ret_var);
41334         return ret_arr;
41335 }
41336
41337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41338         LDKu8slice ser_ref;
41339         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41340         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41341         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
41342         *ret_conv = APIError_read(ser_ref);
41343         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41344         return tag_ptr(ret_conv, true);
41345 }
41346
41347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41348         LDKBigSize this_obj_conv;
41349         this_obj_conv.inner = untag_ptr(this_obj);
41350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41352         BigSize_free(this_obj_conv);
41353 }
41354
41355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41356         LDKBigSize this_ptr_conv;
41357         this_ptr_conv.inner = untag_ptr(this_ptr);
41358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41360         this_ptr_conv.is_owned = false;
41361         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
41362         return ret_conv;
41363 }
41364
41365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41366         LDKBigSize this_ptr_conv;
41367         this_ptr_conv.inner = untag_ptr(this_ptr);
41368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41370         this_ptr_conv.is_owned = false;
41371         BigSize_set_a(&this_ptr_conv, val);
41372 }
41373
41374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
41375         LDKBigSize ret_var = BigSize_new(a_arg);
41376         int64_t ret_ref = 0;
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41379         return ret_ref;
41380 }
41381
41382 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
41383         LDKBigSize ret_var = BigSize_clone(arg);
41384         int64_t ret_ref = 0;
41385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41387         return ret_ref;
41388 }
41389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41390         LDKBigSize arg_conv;
41391         arg_conv.inner = untag_ptr(arg);
41392         arg_conv.is_owned = ptr_is_owned(arg);
41393         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41394         arg_conv.is_owned = false;
41395         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
41396         return ret_conv;
41397 }
41398
41399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41400         LDKBigSize orig_conv;
41401         orig_conv.inner = untag_ptr(orig);
41402         orig_conv.is_owned = ptr_is_owned(orig);
41403         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41404         orig_conv.is_owned = false;
41405         LDKBigSize ret_var = BigSize_clone(&orig_conv);
41406         int64_t ret_ref = 0;
41407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41409         return ret_ref;
41410 }
41411
41412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
41413         LDKBigSize o_conv;
41414         o_conv.inner = untag_ptr(o);
41415         o_conv.is_owned = ptr_is_owned(o);
41416         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41417         o_conv.is_owned = false;
41418         int64_t ret_conv = BigSize_hash(&o_conv);
41419         return ret_conv;
41420 }
41421
41422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41423         LDKBigSize a_conv;
41424         a_conv.inner = untag_ptr(a);
41425         a_conv.is_owned = ptr_is_owned(a);
41426         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41427         a_conv.is_owned = false;
41428         LDKBigSize b_conv;
41429         b_conv.inner = untag_ptr(b);
41430         b_conv.is_owned = ptr_is_owned(b);
41431         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41432         b_conv.is_owned = false;
41433         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
41434         return ret_conv;
41435 }
41436
41437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
41438         LDKBigSize obj_conv;
41439         obj_conv.inner = untag_ptr(obj);
41440         obj_conv.is_owned = ptr_is_owned(obj);
41441         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41442         obj_conv.is_owned = false;
41443         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
41444         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41445         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41446         CVec_u8Z_free(ret_var);
41447         return ret_arr;
41448 }
41449
41450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41451         LDKu8slice ser_ref;
41452         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41453         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41454         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
41455         *ret_conv = BigSize_read(ser_ref);
41456         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41457         return tag_ptr(ret_conv, true);
41458 }
41459
41460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41461         LDKHostname this_obj_conv;
41462         this_obj_conv.inner = untag_ptr(this_obj);
41463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41465         Hostname_free(this_obj_conv);
41466 }
41467
41468 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
41469         LDKHostname ret_var = Hostname_clone(arg);
41470         int64_t ret_ref = 0;
41471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41473         return ret_ref;
41474 }
41475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41476         LDKHostname arg_conv;
41477         arg_conv.inner = untag_ptr(arg);
41478         arg_conv.is_owned = ptr_is_owned(arg);
41479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41480         arg_conv.is_owned = false;
41481         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
41482         return ret_conv;
41483 }
41484
41485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41486         LDKHostname orig_conv;
41487         orig_conv.inner = untag_ptr(orig);
41488         orig_conv.is_owned = ptr_is_owned(orig);
41489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41490         orig_conv.is_owned = false;
41491         LDKHostname ret_var = Hostname_clone(&orig_conv);
41492         int64_t ret_ref = 0;
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41495         return ret_ref;
41496 }
41497
41498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1hash(JNIEnv *env, jclass clz, int64_t o) {
41499         LDKHostname o_conv;
41500         o_conv.inner = untag_ptr(o);
41501         o_conv.is_owned = ptr_is_owned(o);
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41503         o_conv.is_owned = false;
41504         int64_t ret_conv = Hostname_hash(&o_conv);
41505         return ret_conv;
41506 }
41507
41508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41509         LDKHostname a_conv;
41510         a_conv.inner = untag_ptr(a);
41511         a_conv.is_owned = ptr_is_owned(a);
41512         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41513         a_conv.is_owned = false;
41514         LDKHostname b_conv;
41515         b_conv.inner = untag_ptr(b);
41516         b_conv.is_owned = ptr_is_owned(b);
41517         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41518         b_conv.is_owned = false;
41519         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
41520         return ret_conv;
41521 }
41522
41523 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
41524         LDKHostname this_arg_conv;
41525         this_arg_conv.inner = untag_ptr(this_arg);
41526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41528         this_arg_conv.is_owned = false;
41529         int8_t ret_conv = Hostname_len(&this_arg_conv);
41530         return ret_conv;
41531 }
41532
41533 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Hostname_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
41534         LDKHostname o_conv;
41535         o_conv.inner = untag_ptr(o);
41536         o_conv.is_owned = ptr_is_owned(o);
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41538         o_conv.is_owned = false;
41539         LDKStr ret_str = Hostname_to_str(&o_conv);
41540         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41541         Str_free(ret_str);
41542         return ret_conv;
41543 }
41544
41545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
41546         LDKHostname obj_conv;
41547         obj_conv.inner = untag_ptr(obj);
41548         obj_conv.is_owned = ptr_is_owned(obj);
41549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41550         obj_conv.is_owned = false;
41551         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
41552         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41553         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41554         CVec_u8Z_free(ret_var);
41555         return ret_arr;
41556 }
41557
41558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41559         LDKu8slice ser_ref;
41560         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41561         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41562         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
41563         *ret_conv = Hostname_read(ser_ref);
41564         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41565         return tag_ptr(ret_conv, true);
41566 }
41567
41568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41569         LDKTransactionU16LenLimited this_obj_conv;
41570         this_obj_conv.inner = untag_ptr(this_obj);
41571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41573         TransactionU16LenLimited_free(this_obj_conv);
41574 }
41575
41576 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
41577         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
41578         int64_t ret_ref = 0;
41579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41581         return ret_ref;
41582 }
41583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41584         LDKTransactionU16LenLimited arg_conv;
41585         arg_conv.inner = untag_ptr(arg);
41586         arg_conv.is_owned = ptr_is_owned(arg);
41587         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41588         arg_conv.is_owned = false;
41589         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
41590         return ret_conv;
41591 }
41592
41593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41594         LDKTransactionU16LenLimited orig_conv;
41595         orig_conv.inner = untag_ptr(orig);
41596         orig_conv.is_owned = ptr_is_owned(orig);
41597         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41598         orig_conv.is_owned = false;
41599         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
41600         int64_t ret_ref = 0;
41601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41603         return ret_ref;
41604 }
41605
41606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1hash(JNIEnv *env, jclass clz, int64_t o) {
41607         LDKTransactionU16LenLimited o_conv;
41608         o_conv.inner = untag_ptr(o);
41609         o_conv.is_owned = ptr_is_owned(o);
41610         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41611         o_conv.is_owned = false;
41612         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
41613         return ret_conv;
41614 }
41615
41616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41617         LDKTransactionU16LenLimited a_conv;
41618         a_conv.inner = untag_ptr(a);
41619         a_conv.is_owned = ptr_is_owned(a);
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41621         a_conv.is_owned = false;
41622         LDKTransactionU16LenLimited b_conv;
41623         b_conv.inner = untag_ptr(b);
41624         b_conv.is_owned = ptr_is_owned(b);
41625         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41626         b_conv.is_owned = false;
41627         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
41628         return ret_conv;
41629 }
41630
41631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
41632         LDKTransaction transaction_ref;
41633         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
41634         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
41635         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
41636         transaction_ref.data_is_owned = true;
41637         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
41638         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
41639         return tag_ptr(ret_conv, true);
41640 }
41641
41642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41643         LDKTransactionU16LenLimited this_arg_conv;
41644         this_arg_conv.inner = untag_ptr(this_arg);
41645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41647         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
41648         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
41649         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41650         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41651         Transaction_free(ret_var);
41652         return ret_arr;
41653 }
41654
41655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1as_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41656         LDKTransactionU16LenLimited this_arg_conv;
41657         this_arg_conv.inner = untag_ptr(this_arg);
41658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41660         this_arg_conv.is_owned = false;
41661         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
41662         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41663         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41664         Transaction_free(ret_var);
41665         return ret_arr;
41666 }
41667
41668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
41669         LDKTransactionU16LenLimited obj_conv;
41670         obj_conv.inner = untag_ptr(obj);
41671         obj_conv.is_owned = ptr_is_owned(obj);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41673         obj_conv.is_owned = false;
41674         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
41675         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41676         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41677         CVec_u8Z_free(ret_var);
41678         return ret_arr;
41679 }
41680
41681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41682         LDKu8slice ser_ref;
41683         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41684         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41685         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
41686         *ret_conv = TransactionU16LenLimited_read(ser_ref);
41687         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41688         return tag_ptr(ret_conv, true);
41689 }
41690
41691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
41692         LDKu8slice msg_ref;
41693         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41694         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41695         uint8_t sk_arr[32];
41696         CHECK((*env)->GetArrayLength(env, sk) == 32);
41697         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
41698         uint8_t (*sk_ref)[32] = &sk_arr;
41699         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
41700         *ret_conv = sign(msg_ref, sk_ref);
41701         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41702         return tag_ptr(ret_conv, true);
41703 }
41704
41705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
41706         LDKu8slice msg_ref;
41707         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41708         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41709         LDKStr sig_conv = java_to_owned_str(env, sig);
41710         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
41711         *ret_conv = recover_pk(msg_ref, sig_conv);
41712         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41713         return tag_ptr(ret_conv, true);
41714 }
41715
41716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
41717         LDKu8slice msg_ref;
41718         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41719         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41720         LDKStr sig_conv = java_to_owned_str(env, sig);
41721         LDKPublicKey pk_ref;
41722         CHECK((*env)->GetArrayLength(env, pk) == 33);
41723         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
41724         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
41725         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41726         return ret_conv;
41727 }
41728
41729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
41730         LDKu8slice hrp_bytes_ref;
41731         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
41732         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
41733         LDKCVec_U5Z data_without_signature_constr;
41734         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
41735         if (data_without_signature_constr.datalen > 0)
41736                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
41737         else
41738                 data_without_signature_constr.data = NULL;
41739         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
41740         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
41741                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
41742                 
41743                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
41744         }
41745         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
41746         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
41747         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41748         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41749         CVec_u8Z_free(ret_var);
41750         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
41751         return ret_arr;
41752 }
41753
41754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41755         if (!ptr_is_owned(this_ptr)) return;
41756         void* this_ptr_ptr = untag_ptr(this_ptr);
41757         CHECK_ACCESS(this_ptr_ptr);
41758         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
41759         FREE(untag_ptr(this_ptr));
41760         KVStore_free(this_ptr_conv);
41761 }
41762
41763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41764         if (!ptr_is_owned(this_ptr)) return;
41765         void* this_ptr_ptr = untag_ptr(this_ptr);
41766         CHECK_ACCESS(this_ptr_ptr);
41767         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
41768         FREE(untag_ptr(this_ptr));
41769         Persister_free(this_ptr_conv);
41770 }
41771
41772 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) {
41773         void* kv_store_ptr = untag_ptr(kv_store);
41774         CHECK_ACCESS(kv_store_ptr);
41775         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41776         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41777                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41778                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41779         }
41780         void* entropy_source_ptr = untag_ptr(entropy_source);
41781         CHECK_ACCESS(entropy_source_ptr);
41782         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41783         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41784                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41785                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41786         }
41787         void* signer_provider_ptr = untag_ptr(signer_provider);
41788         CHECK_ACCESS(signer_provider_ptr);
41789         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41790         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41791                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41792                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41793         }
41794         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
41795         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
41796         return tag_ptr(ret_conv, true);
41797 }
41798
41799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41800         LDKMonitorUpdatingPersister this_obj_conv;
41801         this_obj_conv.inner = untag_ptr(this_obj);
41802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41804         MonitorUpdatingPersister_free(this_obj_conv);
41805 }
41806
41807 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) {
41808         void* kv_store_ptr = untag_ptr(kv_store);
41809         CHECK_ACCESS(kv_store_ptr);
41810         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41811         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41812                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41813                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41814         }
41815         void* logger_ptr = untag_ptr(logger);
41816         CHECK_ACCESS(logger_ptr);
41817         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41818         if (logger_conv.free == LDKLogger_JCalls_free) {
41819                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41820                 LDKLogger_JCalls_cloned(&logger_conv);
41821         }
41822         void* entropy_source_ptr = untag_ptr(entropy_source);
41823         CHECK_ACCESS(entropy_source_ptr);
41824         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41825         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41826                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41827                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41828         }
41829         void* signer_provider_ptr = untag_ptr(signer_provider);
41830         CHECK_ACCESS(signer_provider_ptr);
41831         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41832         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41833                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41834                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41835         }
41836         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
41837         int64_t ret_ref = 0;
41838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41840         return ret_ref;
41841 }
41842
41843 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) {
41844         LDKMonitorUpdatingPersister this_arg_conv;
41845         this_arg_conv.inner = untag_ptr(this_arg);
41846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41848         this_arg_conv.is_owned = false;
41849         void* broadcaster_ptr = untag_ptr(broadcaster);
41850         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
41851         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
41852         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41853         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
41854         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
41855         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
41856         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
41857         return tag_ptr(ret_conv, true);
41858 }
41859
41860 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) {
41861         LDKMonitorUpdatingPersister this_arg_conv;
41862         this_arg_conv.inner = untag_ptr(this_arg);
41863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41865         this_arg_conv.is_owned = false;
41866         void* broadcaster_ptr = untag_ptr(broadcaster);
41867         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
41868         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
41869         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41870         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
41871         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
41872         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
41873         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
41874         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
41875         return tag_ptr(ret_conv, true);
41876 }
41877
41878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
41879         LDKMonitorUpdatingPersister this_arg_conv;
41880         this_arg_conv.inner = untag_ptr(this_arg);
41881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41883         this_arg_conv.is_owned = false;
41884         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
41885         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
41886         return tag_ptr(ret_conv, true);
41887 }
41888
41889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
41890         LDKMonitorUpdatingPersister this_arg_conv;
41891         this_arg_conv.inner = untag_ptr(this_arg);
41892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41894         this_arg_conv.is_owned = false;
41895         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
41896         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
41897         return tag_ptr(ret_ret, true);
41898 }
41899
41900 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41901         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
41902         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_clone(orig_conv));
41903         return ret_conv;
41904 }
41905
41906 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1block_1overflow(JNIEnv *env, jclass clz) {
41907         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_block_overflow());
41908         return ret_conv;
41909 }
41910
41911 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1tx_1index_1overflow(JNIEnv *env, jclass clz) {
41912         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_tx_index_overflow());
41913         return ret_conv;
41914 }
41915
41916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1vout_1index_1overflow(JNIEnv *env, jclass clz) {
41917         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_vout_index_overflow());
41918         return ret_conv;
41919 }
41920
41921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41922         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
41923         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
41924         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
41925         return ret_conv;
41926 }
41927
41928 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_block_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41929         int32_t ret_conv = block_from_scid(short_channel_id);
41930         return ret_conv;
41931 }
41932
41933 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_tx_1index_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41934         int32_t ret_conv = tx_index_from_scid(short_channel_id);
41935         return ret_conv;
41936 }
41937
41938 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_vout_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41939         int16_t ret_conv = vout_from_scid(short_channel_id);
41940         return ret_conv;
41941 }
41942
41943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_scid_1from_1parts(JNIEnv *env, jclass clz, int64_t block, int64_t tx_index, int64_t vout_index) {
41944         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
41945         *ret_conv = scid_from_parts(block, tx_index, vout_index);
41946         return tag_ptr(ret_conv, true);
41947 }
41948
41949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41950         LDKUntrustedString this_obj_conv;
41951         this_obj_conv.inner = untag_ptr(this_obj);
41952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41954         UntrustedString_free(this_obj_conv);
41955 }
41956
41957 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41958         LDKUntrustedString this_ptr_conv;
41959         this_ptr_conv.inner = untag_ptr(this_ptr);
41960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41962         this_ptr_conv.is_owned = false;
41963         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
41964         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41965         Str_free(ret_str);
41966         return ret_conv;
41967 }
41968
41969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41970         LDKUntrustedString this_ptr_conv;
41971         this_ptr_conv.inner = untag_ptr(this_ptr);
41972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41974         this_ptr_conv.is_owned = false;
41975         LDKStr val_conv = java_to_owned_str(env, val);
41976         UntrustedString_set_a(&this_ptr_conv, val_conv);
41977 }
41978
41979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
41980         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
41981         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
41982         int64_t ret_ref = 0;
41983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41985         return ret_ref;
41986 }
41987
41988 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
41989         LDKUntrustedString ret_var = UntrustedString_clone(arg);
41990         int64_t ret_ref = 0;
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41993         return ret_ref;
41994 }
41995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41996         LDKUntrustedString arg_conv;
41997         arg_conv.inner = untag_ptr(arg);
41998         arg_conv.is_owned = ptr_is_owned(arg);
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42000         arg_conv.is_owned = false;
42001         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
42002         return ret_conv;
42003 }
42004
42005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42006         LDKUntrustedString orig_conv;
42007         orig_conv.inner = untag_ptr(orig);
42008         orig_conv.is_owned = ptr_is_owned(orig);
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42010         orig_conv.is_owned = false;
42011         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
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
42018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42019         LDKUntrustedString a_conv;
42020         a_conv.inner = untag_ptr(a);
42021         a_conv.is_owned = ptr_is_owned(a);
42022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42023         a_conv.is_owned = false;
42024         LDKUntrustedString b_conv;
42025         b_conv.inner = untag_ptr(b);
42026         b_conv.is_owned = ptr_is_owned(b);
42027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42028         b_conv.is_owned = false;
42029         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
42030         return ret_conv;
42031 }
42032
42033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1hash(JNIEnv *env, jclass clz, int64_t o) {
42034         LDKUntrustedString o_conv;
42035         o_conv.inner = untag_ptr(o);
42036         o_conv.is_owned = ptr_is_owned(o);
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42038         o_conv.is_owned = false;
42039         int64_t ret_conv = UntrustedString_hash(&o_conv);
42040         return ret_conv;
42041 }
42042
42043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
42044         LDKUntrustedString obj_conv;
42045         obj_conv.inner = untag_ptr(obj);
42046         obj_conv.is_owned = ptr_is_owned(obj);
42047         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42048         obj_conv.is_owned = false;
42049         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
42050         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42051         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42052         CVec_u8Z_free(ret_var);
42053         return ret_arr;
42054 }
42055
42056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42057         LDKu8slice ser_ref;
42058         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42059         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42060         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
42061         *ret_conv = UntrustedString_read(ser_ref);
42062         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42063         return tag_ptr(ret_conv, true);
42064 }
42065
42066 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42067         LDKUntrustedString o_conv;
42068         o_conv.inner = untag_ptr(o);
42069         o_conv.is_owned = ptr_is_owned(o);
42070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42071         o_conv.is_owned = false;
42072         LDKStr ret_str = UntrustedString_to_str(&o_conv);
42073         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42074         Str_free(ret_str);
42075         return ret_conv;
42076 }
42077
42078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42079         LDKPrintableString this_obj_conv;
42080         this_obj_conv.inner = untag_ptr(this_obj);
42081         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42083         PrintableString_free(this_obj_conv);
42084 }
42085
42086 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42087         LDKPrintableString this_ptr_conv;
42088         this_ptr_conv.inner = untag_ptr(this_ptr);
42089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42091         this_ptr_conv.is_owned = false;
42092         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
42093         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42094         Str_free(ret_str);
42095         return ret_conv;
42096 }
42097
42098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42099         LDKPrintableString this_ptr_conv;
42100         this_ptr_conv.inner = untag_ptr(this_ptr);
42101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42103         this_ptr_conv.is_owned = false;
42104         LDKStr val_conv = java_to_owned_str(env, val);
42105         PrintableString_set_a(&this_ptr_conv, val_conv);
42106 }
42107
42108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
42109         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
42110         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
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
42117 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42118         LDKPrintableString o_conv;
42119         o_conv.inner = untag_ptr(o);
42120         o_conv.is_owned = ptr_is_owned(o);
42121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42122         o_conv.is_owned = false;
42123         LDKStr ret_str = PrintableString_to_str(&o_conv);
42124         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42125         Str_free(ret_str);
42126         return ret_conv;
42127 }
42128
42129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42130         LDKTrackedSpendableOutput this_obj_conv;
42131         this_obj_conv.inner = untag_ptr(this_obj);
42132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42134         TrackedSpendableOutput_free(this_obj_conv);
42135 }
42136
42137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1descriptor(JNIEnv *env, jclass clz, int64_t this_ptr) {
42138         LDKTrackedSpendableOutput this_ptr_conv;
42139         this_ptr_conv.inner = untag_ptr(this_ptr);
42140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42142         this_ptr_conv.is_owned = false;
42143         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
42144         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
42145         int64_t ret_ref = tag_ptr(ret_copy, true);
42146         return ret_ref;
42147 }
42148
42149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1descriptor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42150         LDKTrackedSpendableOutput this_ptr_conv;
42151         this_ptr_conv.inner = untag_ptr(this_ptr);
42152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42154         this_ptr_conv.is_owned = false;
42155         void* val_ptr = untag_ptr(val);
42156         CHECK_ACCESS(val_ptr);
42157         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
42158         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
42159         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
42160 }
42161
42162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42163         LDKTrackedSpendableOutput 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         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
42169         int64_t ret_ref = 0;
42170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42172         return ret_ref;
42173 }
42174
42175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42176         LDKTrackedSpendableOutput this_ptr_conv;
42177         this_ptr_conv.inner = untag_ptr(this_ptr);
42178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42180         this_ptr_conv.is_owned = false;
42181         LDKChannelId val_conv;
42182         val_conv.inner = untag_ptr(val);
42183         val_conv.is_owned = ptr_is_owned(val);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42185         val_conv = ChannelId_clone(&val_conv);
42186         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
42187 }
42188
42189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1status(JNIEnv *env, jclass clz, int64_t this_ptr) {
42190         LDKTrackedSpendableOutput this_ptr_conv;
42191         this_ptr_conv.inner = untag_ptr(this_ptr);
42192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42194         this_ptr_conv.is_owned = false;
42195         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
42196         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
42197         int64_t ret_ref = tag_ptr(ret_copy, true);
42198         return ret_ref;
42199 }
42200
42201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1status(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42202         LDKTrackedSpendableOutput this_ptr_conv;
42203         this_ptr_conv.inner = untag_ptr(this_ptr);
42204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42206         this_ptr_conv.is_owned = false;
42207         void* val_ptr = untag_ptr(val);
42208         CHECK_ACCESS(val_ptr);
42209         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
42210         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
42211         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
42212 }
42213
42214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1new(JNIEnv *env, jclass clz, int64_t descriptor_arg, int64_t channel_id_arg, int64_t status_arg) {
42215         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
42216         CHECK_ACCESS(descriptor_arg_ptr);
42217         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
42218         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
42219         LDKChannelId channel_id_arg_conv;
42220         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
42221         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
42222         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
42223         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
42224         void* status_arg_ptr = untag_ptr(status_arg);
42225         CHECK_ACCESS(status_arg_ptr);
42226         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
42227         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
42228         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
42229         int64_t ret_ref = 0;
42230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42232         return ret_ref;
42233 }
42234
42235 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
42236         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
42237         int64_t ret_ref = 0;
42238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42240         return ret_ref;
42241 }
42242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42243         LDKTrackedSpendableOutput arg_conv;
42244         arg_conv.inner = untag_ptr(arg);
42245         arg_conv.is_owned = ptr_is_owned(arg);
42246         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42247         arg_conv.is_owned = false;
42248         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
42249         return ret_conv;
42250 }
42251
42252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42253         LDKTrackedSpendableOutput orig_conv;
42254         orig_conv.inner = untag_ptr(orig);
42255         orig_conv.is_owned = ptr_is_owned(orig);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42257         orig_conv.is_owned = false;
42258         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
42259         int64_t ret_ref = 0;
42260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42262         return ret_ref;
42263 }
42264
42265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42266         LDKTrackedSpendableOutput a_conv;
42267         a_conv.inner = untag_ptr(a);
42268         a_conv.is_owned = ptr_is_owned(a);
42269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42270         a_conv.is_owned = false;
42271         LDKTrackedSpendableOutput b_conv;
42272         b_conv.inner = untag_ptr(b);
42273         b_conv.is_owned = ptr_is_owned(b);
42274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42275         b_conv.is_owned = false;
42276         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
42277         return ret_conv;
42278 }
42279
42280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1is_1spent_1in(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
42281         LDKTrackedSpendableOutput this_arg_conv;
42282         this_arg_conv.inner = untag_ptr(this_arg);
42283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42285         this_arg_conv.is_owned = false;
42286         LDKTransaction tx_ref;
42287         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
42288         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
42289         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
42290         tx_ref.data_is_owned = true;
42291         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
42292         return ret_conv;
42293 }
42294
42295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
42296         LDKTrackedSpendableOutput obj_conv;
42297         obj_conv.inner = untag_ptr(obj);
42298         obj_conv.is_owned = ptr_is_owned(obj);
42299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42300         obj_conv.is_owned = false;
42301         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
42302         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42303         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42304         CVec_u8Z_free(ret_var);
42305         return ret_arr;
42306 }
42307
42308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42309         LDKu8slice ser_ref;
42310         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42311         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42312         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
42313         *ret_conv = TrackedSpendableOutput_read(ser_ref);
42314         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42315         return tag_ptr(ret_conv, true);
42316 }
42317
42318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42319         if (!ptr_is_owned(this_ptr)) return;
42320         void* this_ptr_ptr = untag_ptr(this_ptr);
42321         CHECK_ACCESS(this_ptr_ptr);
42322         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
42323         FREE(untag_ptr(this_ptr));
42324         OutputSpendStatus_free(this_ptr_conv);
42325 }
42326
42327 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
42328         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
42329         *ret_copy = OutputSpendStatus_clone(arg);
42330         int64_t ret_ref = tag_ptr(ret_copy, true);
42331         return ret_ref;
42332 }
42333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42334         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
42335         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
42336         return ret_conv;
42337 }
42338
42339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42340         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
42341         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
42342         *ret_copy = OutputSpendStatus_clone(orig_conv);
42343         int64_t ret_ref = tag_ptr(ret_copy, true);
42344         return ret_ref;
42345 }
42346
42347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1initial_1broadcast(JNIEnv *env, jclass clz, int64_t delayed_until_height) {
42348         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
42349         CHECK_ACCESS(delayed_until_height_ptr);
42350         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
42351         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
42352         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
42353         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
42354         int64_t ret_ref = tag_ptr(ret_copy, true);
42355         return ret_ref;
42356 }
42357
42358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1first_1confirmation(JNIEnv *env, jclass clz, int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx) {
42359         LDKThirtyTwoBytes first_broadcast_hash_ref;
42360         CHECK((*env)->GetArrayLength(env, first_broadcast_hash) == 32);
42361         (*env)->GetByteArrayRegion(env, first_broadcast_hash, 0, 32, first_broadcast_hash_ref.data);
42362         LDKTransaction latest_spending_tx_ref;
42363         latest_spending_tx_ref.datalen = (*env)->GetArrayLength(env, latest_spending_tx);
42364         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
42365         (*env)->GetByteArrayRegion(env, latest_spending_tx, 0, latest_spending_tx_ref.datalen, latest_spending_tx_ref.data);
42366         latest_spending_tx_ref.data_is_owned = true;
42367         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
42368         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
42369         int64_t ret_ref = tag_ptr(ret_copy, true);
42370         return ret_ref;
42371 }
42372
42373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1threshold_1confirmations(JNIEnv *env, jclass clz, int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx, int32_t confirmation_height, int8_tArray confirmation_hash) {
42374         LDKThirtyTwoBytes first_broadcast_hash_ref;
42375         CHECK((*env)->GetArrayLength(env, first_broadcast_hash) == 32);
42376         (*env)->GetByteArrayRegion(env, first_broadcast_hash, 0, 32, first_broadcast_hash_ref.data);
42377         LDKTransaction latest_spending_tx_ref;
42378         latest_spending_tx_ref.datalen = (*env)->GetArrayLength(env, latest_spending_tx);
42379         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
42380         (*env)->GetByteArrayRegion(env, latest_spending_tx, 0, latest_spending_tx_ref.datalen, latest_spending_tx_ref.data);
42381         latest_spending_tx_ref.data_is_owned = true;
42382         LDKThirtyTwoBytes confirmation_hash_ref;
42383         CHECK((*env)->GetArrayLength(env, confirmation_hash) == 32);
42384         (*env)->GetByteArrayRegion(env, confirmation_hash, 0, 32, confirmation_hash_ref.data);
42385         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
42386         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
42387         int64_t ret_ref = tag_ptr(ret_copy, true);
42388         return ret_ref;
42389 }
42390
42391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42392         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
42393         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
42394         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
42395         return ret_conv;
42396 }
42397
42398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1write(JNIEnv *env, jclass clz, int64_t obj) {
42399         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
42400         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
42401         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42402         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42403         CVec_u8Z_free(ret_var);
42404         return ret_arr;
42405 }
42406
42407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42408         LDKu8slice ser_ref;
42409         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42410         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42411         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
42412         *ret_conv = OutputSpendStatus_read(ser_ref);
42413         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42414         return tag_ptr(ret_conv, true);
42415 }
42416
42417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42418         LDKOutputSweeper this_obj_conv;
42419         this_obj_conv.inner = untag_ptr(this_obj);
42420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42422         OutputSweeper_free(this_obj_conv);
42423 }
42424
42425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1new(JNIEnv *env, jclass clz, int64_t best_block, int64_t broadcaster, int64_t fee_estimator, int64_t chain_data_source, int64_t output_spender, int64_t change_destination_source, int64_t kv_store, int64_t logger) {
42426         LDKBestBlock best_block_conv;
42427         best_block_conv.inner = untag_ptr(best_block);
42428         best_block_conv.is_owned = ptr_is_owned(best_block);
42429         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
42430         best_block_conv = BestBlock_clone(&best_block_conv);
42431         void* broadcaster_ptr = untag_ptr(broadcaster);
42432         CHECK_ACCESS(broadcaster_ptr);
42433         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
42434         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
42435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42436                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
42437         }
42438         void* fee_estimator_ptr = untag_ptr(fee_estimator);
42439         CHECK_ACCESS(fee_estimator_ptr);
42440         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
42441         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
42442                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42443                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
42444         }
42445         void* chain_data_source_ptr = untag_ptr(chain_data_source);
42446         CHECK_ACCESS(chain_data_source_ptr);
42447         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
42448         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42449         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
42450                 // Manually implement clone for Java trait instances
42451                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
42452                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42453                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
42454                 }
42455         }
42456         void* output_spender_ptr = untag_ptr(output_spender);
42457         CHECK_ACCESS(output_spender_ptr);
42458         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
42459         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
42460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42461                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
42462         }
42463         void* change_destination_source_ptr = untag_ptr(change_destination_source);
42464         CHECK_ACCESS(change_destination_source_ptr);
42465         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
42466         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
42467                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42468                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
42469         }
42470         void* kv_store_ptr = untag_ptr(kv_store);
42471         CHECK_ACCESS(kv_store_ptr);
42472         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
42473         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
42474                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42475                 LDKKVStore_JCalls_cloned(&kv_store_conv);
42476         }
42477         void* logger_ptr = untag_ptr(logger);
42478         CHECK_ACCESS(logger_ptr);
42479         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42480         if (logger_conv.free == LDKLogger_JCalls_free) {
42481                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42482                 LDKLogger_JCalls_cloned(&logger_conv);
42483         }
42484         LDKOutputSweeper ret_var = OutputSweeper_new(best_block_conv, broadcaster_conv, fee_estimator_conv, chain_data_source_conv, output_spender_conv, change_destination_source_conv, kv_store_conv, logger_conv);
42485         int64_t ret_ref = 0;
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42488         return ret_ref;
42489 }
42490
42491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1track_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray output_descriptors, int64_t channel_id, jboolean exclude_static_outputs, int64_t delay_until_height) {
42492         LDKOutputSweeper this_arg_conv;
42493         this_arg_conv.inner = untag_ptr(this_arg);
42494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42496         this_arg_conv.is_owned = false;
42497         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
42498         output_descriptors_constr.datalen = (*env)->GetArrayLength(env, output_descriptors);
42499         if (output_descriptors_constr.datalen > 0)
42500                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
42501         else
42502                 output_descriptors_constr.data = NULL;
42503         int64_t* output_descriptors_vals = (*env)->GetLongArrayElements (env, output_descriptors, NULL);
42504         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
42505                 int64_t output_descriptors_conv_27 = output_descriptors_vals[b];
42506                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
42507                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
42508                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
42509                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
42510                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
42511         }
42512         (*env)->ReleaseLongArrayElements(env, output_descriptors, output_descriptors_vals, 0);
42513         LDKChannelId channel_id_conv;
42514         channel_id_conv.inner = untag_ptr(channel_id);
42515         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42517         channel_id_conv = ChannelId_clone(&channel_id_conv);
42518         void* delay_until_height_ptr = untag_ptr(delay_until_height);
42519         CHECK_ACCESS(delay_until_height_ptr);
42520         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
42521         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
42522         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
42523         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
42524         return tag_ptr(ret_conv, true);
42525 }
42526
42527 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1tracked_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg) {
42528         LDKOutputSweeper this_arg_conv;
42529         this_arg_conv.inner = untag_ptr(this_arg);
42530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42532         this_arg_conv.is_owned = false;
42533         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
42534         int64_tArray ret_arr = NULL;
42535         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42536         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42537         for (size_t y = 0; y < ret_var.datalen; y++) {
42538                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
42539                 int64_t ret_conv_24_ref = 0;
42540                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
42541                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
42542                 ret_arr_ptr[y] = ret_conv_24_ref;
42543         }
42544         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42545         FREE(ret_var.data);
42546         return ret_arr;
42547 }
42548
42549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
42550         LDKOutputSweeper this_arg_conv;
42551         this_arg_conv.inner = untag_ptr(this_arg);
42552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42554         this_arg_conv.is_owned = false;
42555         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
42556         int64_t ret_ref = 0;
42557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42559         return ret_ref;
42560 }
42561
42562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
42563         LDKOutputSweeper this_arg_conv;
42564         this_arg_conv.inner = untag_ptr(this_arg);
42565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42567         this_arg_conv.is_owned = false;
42568         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
42569         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
42570         return tag_ptr(ret_ret, true);
42571 }
42572
42573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
42574         LDKOutputSweeper this_arg_conv;
42575         this_arg_conv.inner = untag_ptr(this_arg);
42576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42578         this_arg_conv.is_owned = false;
42579         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
42580         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
42581         return tag_ptr(ret_ret, true);
42582 }
42583
42584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42585         if (!ptr_is_owned(this_ptr)) return;
42586         void* this_ptr_ptr = untag_ptr(this_ptr);
42587         CHECK_ACCESS(this_ptr_ptr);
42588         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
42589         FREE(untag_ptr(this_ptr));
42590         SpendingDelay_free(this_ptr_conv);
42591 }
42592
42593 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
42594         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
42595         *ret_copy = SpendingDelay_clone(arg);
42596         int64_t ret_ref = tag_ptr(ret_copy, true);
42597         return ret_ref;
42598 }
42599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42600         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
42601         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
42602         return ret_conv;
42603 }
42604
42605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42606         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
42607         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
42608         *ret_copy = SpendingDelay_clone(orig_conv);
42609         int64_t ret_ref = tag_ptr(ret_copy, true);
42610         return ret_ref;
42611 }
42612
42613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1relative(JNIEnv *env, jclass clz, int32_t num_blocks) {
42614         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
42615         *ret_copy = SpendingDelay_relative(num_blocks);
42616         int64_t ret_ref = tag_ptr(ret_copy, true);
42617         return ret_ref;
42618 }
42619
42620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1absolute(JNIEnv *env, jclass clz, int32_t height) {
42621         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
42622         *ret_copy = SpendingDelay_absolute(height);
42623         int64_t ret_ref = tag_ptr(ret_copy, true);
42624         return ret_ref;
42625 }
42626
42627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
42628         LDKu8slice ser_ref;
42629         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42630         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42631         void* arg_a_ptr = untag_ptr(arg_a);
42632         CHECK_ACCESS(arg_a_ptr);
42633         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
42634         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
42635                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42636                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
42637         }
42638         void* arg_b_ptr = untag_ptr(arg_b);
42639         CHECK_ACCESS(arg_b_ptr);
42640         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
42641         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
42642                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42643                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
42644         }
42645         void* arg_c_ptr = untag_ptr(arg_c);
42646         CHECK_ACCESS(arg_c_ptr);
42647         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
42648         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42649         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
42650                 // Manually implement clone for Java trait instances
42651                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
42652                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42653                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
42654                 }
42655         }
42656         void* arg_d_ptr = untag_ptr(arg_d);
42657         CHECK_ACCESS(arg_d_ptr);
42658         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
42659         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
42660                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42661                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
42662         }
42663         void* arg_e_ptr = untag_ptr(arg_e);
42664         CHECK_ACCESS(arg_e_ptr);
42665         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
42666         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
42667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42668                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
42669         }
42670         void* arg_f_ptr = untag_ptr(arg_f);
42671         CHECK_ACCESS(arg_f_ptr);
42672         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
42673         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
42674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42675                 LDKKVStore_JCalls_cloned(&arg_f_conv);
42676         }
42677         void* arg_g_ptr = untag_ptr(arg_g);
42678         CHECK_ACCESS(arg_g_ptr);
42679         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
42680         if (arg_g_conv.free == LDKLogger_JCalls_free) {
42681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42682                 LDKLogger_JCalls_cloned(&arg_g_conv);
42683         }
42684         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
42685         *ret_conv = OutputSweeper_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
42686         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42687         return tag_ptr(ret_conv, true);
42688 }
42689
42690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
42691         LDKu8slice ser_ref;
42692         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42693         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42694         void* arg_a_ptr = untag_ptr(arg_a);
42695         CHECK_ACCESS(arg_a_ptr);
42696         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
42697         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
42698                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42699                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
42700         }
42701         void* arg_b_ptr = untag_ptr(arg_b);
42702         CHECK_ACCESS(arg_b_ptr);
42703         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
42704         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
42705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42706                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
42707         }
42708         void* arg_c_ptr = untag_ptr(arg_c);
42709         CHECK_ACCESS(arg_c_ptr);
42710         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
42711         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42712         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
42713                 // Manually implement clone for Java trait instances
42714                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
42715                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42716                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
42717                 }
42718         }
42719         void* arg_d_ptr = untag_ptr(arg_d);
42720         CHECK_ACCESS(arg_d_ptr);
42721         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
42722         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
42723                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42724                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
42725         }
42726         void* arg_e_ptr = untag_ptr(arg_e);
42727         CHECK_ACCESS(arg_e_ptr);
42728         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
42729         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
42730                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42731                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
42732         }
42733         void* arg_f_ptr = untag_ptr(arg_f);
42734         CHECK_ACCESS(arg_f_ptr);
42735         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
42736         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
42737                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42738                 LDKKVStore_JCalls_cloned(&arg_f_conv);
42739         }
42740         void* arg_g_ptr = untag_ptr(arg_g);
42741         CHECK_ACCESS(arg_g_ptr);
42742         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
42743         if (arg_g_conv.free == LDKLogger_JCalls_free) {
42744                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42745                 LDKLogger_JCalls_cloned(&arg_g_conv);
42746         }
42747         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
42748         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
42749         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42750         return tag_ptr(ret_conv, true);
42751 }
42752
42753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42754         if (!ptr_is_owned(this_ptr)) return;
42755         void* this_ptr_ptr = untag_ptr(this_ptr);
42756         CHECK_ACCESS(this_ptr_ptr);
42757         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
42758         FREE(untag_ptr(this_ptr));
42759         FutureCallback_free(this_ptr_conv);
42760 }
42761
42762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42763         LDKFuture this_obj_conv;
42764         this_obj_conv.inner = untag_ptr(this_obj);
42765         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42767         Future_free(this_obj_conv);
42768 }
42769
42770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
42771         LDKFuture this_arg_conv;
42772         this_arg_conv.inner = untag_ptr(this_arg);
42773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42775         this_arg_conv.is_owned = false;
42776         void* callback_ptr = untag_ptr(callback);
42777         CHECK_ACCESS(callback_ptr);
42778         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
42779         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
42780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42781                 LDKFutureCallback_JCalls_cloned(&callback_conv);
42782         }
42783         Future_register_callback_fn(&this_arg_conv, callback_conv);
42784 }
42785
42786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
42787         LDKFuture this_arg_conv;
42788         this_arg_conv.inner = untag_ptr(this_arg);
42789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42791         this_arg_conv.is_owned = false;
42792         Future_wait(&this_arg_conv);
42793 }
42794
42795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
42796         LDKFuture this_arg_conv;
42797         this_arg_conv.inner = untag_ptr(this_arg);
42798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42800         this_arg_conv.is_owned = false;
42801         jboolean ret_conv = Future_wait_timeout(&this_arg_conv, max_wait);
42802         return ret_conv;
42803 }
42804
42805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42806         LDKSleeper this_obj_conv;
42807         this_obj_conv.inner = untag_ptr(this_obj);
42808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42810         Sleeper_free(this_obj_conv);
42811 }
42812
42813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
42814         LDKFuture future_conv;
42815         future_conv.inner = untag_ptr(future);
42816         future_conv.is_owned = ptr_is_owned(future);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
42818         future_conv.is_owned = false;
42819         LDKSleeper ret_var = Sleeper_from_single_future(&future_conv);
42820         int64_t ret_ref = 0;
42821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42823         return ret_ref;
42824 }
42825
42826 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) {
42827         LDKFuture fut_a_conv;
42828         fut_a_conv.inner = untag_ptr(fut_a);
42829         fut_a_conv.is_owned = ptr_is_owned(fut_a);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
42831         fut_a_conv.is_owned = false;
42832         LDKFuture fut_b_conv;
42833         fut_b_conv.inner = untag_ptr(fut_b);
42834         fut_b_conv.is_owned = ptr_is_owned(fut_b);
42835         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
42836         fut_b_conv.is_owned = false;
42837         LDKSleeper ret_var = Sleeper_from_two_futures(&fut_a_conv, &fut_b_conv);
42838         int64_t ret_ref = 0;
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42841         return ret_ref;
42842 }
42843
42844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
42845         LDKCVec_FutureZ futures_constr;
42846         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
42847         if (futures_constr.datalen > 0)
42848                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
42849         else
42850                 futures_constr.data = NULL;
42851         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
42852         for (size_t i = 0; i < futures_constr.datalen; i++) {
42853                 int64_t futures_conv_8 = futures_vals[i];
42854                 LDKFuture futures_conv_8_conv;
42855                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
42856                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
42857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
42858                 // WARNING: we need a move here but no clone is available for LDKFuture
42859                 
42860                 futures_constr.data[i] = futures_conv_8_conv;
42861         }
42862         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
42863         LDKSleeper ret_var = Sleeper_new(futures_constr);
42864         int64_t ret_ref = 0;
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42867         return ret_ref;
42868 }
42869
42870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
42871         LDKSleeper this_arg_conv;
42872         this_arg_conv.inner = untag_ptr(this_arg);
42873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42875         this_arg_conv.is_owned = false;
42876         Sleeper_wait(&this_arg_conv);
42877 }
42878
42879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
42880         LDKSleeper this_arg_conv;
42881         this_arg_conv.inner = untag_ptr(this_arg);
42882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42884         this_arg_conv.is_owned = false;
42885         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
42886         return ret_conv;
42887 }
42888
42889 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42890         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
42891         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
42892         return ret_conv;
42893 }
42894
42895 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
42896         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
42897         return ret_conv;
42898 }
42899
42900 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
42901         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
42902         return ret_conv;
42903 }
42904
42905 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
42906         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
42907         return ret_conv;
42908 }
42909
42910 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
42911         jclass ret_conv = LDKLevel_to_java(env, Level_info());
42912         return ret_conv;
42913 }
42914
42915 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
42916         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
42917         return ret_conv;
42918 }
42919
42920 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
42921         jclass ret_conv = LDKLevel_to_java(env, Level_error());
42922         return ret_conv;
42923 }
42924
42925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42926         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
42927         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
42928         jboolean ret_conv = Level_eq(a_conv, b_conv);
42929         return ret_conv;
42930 }
42931
42932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
42933         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
42934         int64_t ret_conv = Level_hash(o_conv);
42935         return ret_conv;
42936 }
42937
42938 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Level_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42939         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
42940         LDKStr ret_str = Level_to_str(o_conv);
42941         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42942         Str_free(ret_str);
42943         return ret_conv;
42944 }
42945
42946 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
42947         jclass ret_conv = LDKLevel_to_java(env, Level_max());
42948         return ret_conv;
42949 }
42950
42951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42952         LDKRecord this_obj_conv;
42953         this_obj_conv.inner = untag_ptr(this_obj);
42954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42956         Record_free(this_obj_conv);
42957 }
42958
42959 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
42960         LDKRecord this_ptr_conv;
42961         this_ptr_conv.inner = untag_ptr(this_ptr);
42962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42964         this_ptr_conv.is_owned = false;
42965         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
42966         return ret_conv;
42967 }
42968
42969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
42970         LDKRecord this_ptr_conv;
42971         this_ptr_conv.inner = untag_ptr(this_ptr);
42972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42974         this_ptr_conv.is_owned = false;
42975         LDKLevel val_conv = LDKLevel_from_java(env, val);
42976         Record_set_level(&this_ptr_conv, val_conv);
42977 }
42978
42979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Record_1get_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42980         LDKRecord 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, Record_get_peer_id(&this_ptr_conv).compressed_form);
42987         return ret_arr;
42988 }
42989
42990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42991         LDKRecord 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         Record_set_peer_id(&this_ptr_conv, val_ref);
43000 }
43001
43002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43003         LDKRecord 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         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
43009         int64_t ret_ref = 0;
43010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43012         return ret_ref;
43013 }
43014
43015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43016         LDKRecord this_ptr_conv;
43017         this_ptr_conv.inner = untag_ptr(this_ptr);
43018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43020         this_ptr_conv.is_owned = false;
43021         LDKChannelId val_conv;
43022         val_conv.inner = untag_ptr(val);
43023         val_conv.is_owned = ptr_is_owned(val);
43024         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43025         val_conv = ChannelId_clone(&val_conv);
43026         Record_set_channel_id(&this_ptr_conv, val_conv);
43027 }
43028
43029 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
43030         LDKRecord this_ptr_conv;
43031         this_ptr_conv.inner = untag_ptr(this_ptr);
43032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43034         this_ptr_conv.is_owned = false;
43035         LDKStr ret_str = Record_get_args(&this_ptr_conv);
43036         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
43037         Str_free(ret_str);
43038         return ret_conv;
43039 }
43040
43041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
43042         LDKRecord this_ptr_conv;
43043         this_ptr_conv.inner = untag_ptr(this_ptr);
43044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43046         this_ptr_conv.is_owned = false;
43047         LDKStr val_conv = java_to_owned_str(env, val);
43048         Record_set_args(&this_ptr_conv, val_conv);
43049 }
43050
43051 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
43052         LDKRecord this_ptr_conv;
43053         this_ptr_conv.inner = untag_ptr(this_ptr);
43054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43056         this_ptr_conv.is_owned = false;
43057         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
43058         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
43059         Str_free(ret_str);
43060         return ret_conv;
43061 }
43062
43063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
43064         LDKRecord this_ptr_conv;
43065         this_ptr_conv.inner = untag_ptr(this_ptr);
43066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43068         this_ptr_conv.is_owned = false;
43069         LDKStr val_conv = java_to_owned_str(env, val);
43070         Record_set_module_path(&this_ptr_conv, val_conv);
43071 }
43072
43073 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
43074         LDKRecord this_ptr_conv;
43075         this_ptr_conv.inner = untag_ptr(this_ptr);
43076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43078         this_ptr_conv.is_owned = false;
43079         LDKStr ret_str = Record_get_file(&this_ptr_conv);
43080         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
43081         Str_free(ret_str);
43082         return ret_conv;
43083 }
43084
43085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
43086         LDKRecord this_ptr_conv;
43087         this_ptr_conv.inner = untag_ptr(this_ptr);
43088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43090         this_ptr_conv.is_owned = false;
43091         LDKStr val_conv = java_to_owned_str(env, val);
43092         Record_set_file(&this_ptr_conv, val_conv);
43093 }
43094
43095 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
43096         LDKRecord this_ptr_conv;
43097         this_ptr_conv.inner = untag_ptr(this_ptr);
43098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43100         this_ptr_conv.is_owned = false;
43101         int32_t ret_conv = Record_get_line(&this_ptr_conv);
43102         return ret_conv;
43103 }
43104
43105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43106         LDKRecord 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         Record_set_line(&this_ptr_conv, val);
43112 }
43113
43114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1new(JNIEnv *env, jclass clz, jclass level_arg, int8_tArray peer_id_arg, int64_t channel_id_arg, jstring args_arg, jstring module_path_arg, jstring file_arg, int32_t line_arg) {
43115         LDKLevel level_arg_conv = LDKLevel_from_java(env, level_arg);
43116         LDKPublicKey peer_id_arg_ref;
43117         CHECK((*env)->GetArrayLength(env, peer_id_arg) == 33);
43118         (*env)->GetByteArrayRegion(env, peer_id_arg, 0, 33, peer_id_arg_ref.compressed_form);
43119         LDKChannelId channel_id_arg_conv;
43120         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
43121         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
43122         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
43123         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
43124         LDKStr args_arg_conv = java_to_owned_str(env, args_arg);
43125         LDKStr module_path_arg_conv = java_to_owned_str(env, module_path_arg);
43126         LDKStr file_arg_conv = java_to_owned_str(env, file_arg);
43127         LDKRecord ret_var = Record_new(level_arg_conv, peer_id_arg_ref, channel_id_arg_conv, args_arg_conv, module_path_arg_conv, file_arg_conv, line_arg);
43128         int64_t ret_ref = 0;
43129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43131         return ret_ref;
43132 }
43133
43134 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
43135         LDKRecord ret_var = Record_clone(arg);
43136         int64_t ret_ref = 0;
43137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43139         return ret_ref;
43140 }
43141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43142         LDKRecord arg_conv;
43143         arg_conv.inner = untag_ptr(arg);
43144         arg_conv.is_owned = ptr_is_owned(arg);
43145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43146         arg_conv.is_owned = false;
43147         int64_t ret_conv = Record_clone_ptr(&arg_conv);
43148         return ret_conv;
43149 }
43150
43151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43152         LDKRecord orig_conv;
43153         orig_conv.inner = untag_ptr(orig);
43154         orig_conv.is_owned = ptr_is_owned(orig);
43155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43156         orig_conv.is_owned = false;
43157         LDKRecord ret_var = Record_clone(&orig_conv);
43158         int64_t ret_ref = 0;
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43161         return ret_ref;
43162 }
43163
43164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43165         if (!ptr_is_owned(this_ptr)) return;
43166         void* this_ptr_ptr = untag_ptr(this_ptr);
43167         CHECK_ACCESS(this_ptr_ptr);
43168         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
43169         FREE(untag_ptr(this_ptr));
43170         Logger_free(this_ptr_conv);
43171 }
43172
43173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43174         LDKChannelHandshakeConfig this_obj_conv;
43175         this_obj_conv.inner = untag_ptr(this_obj);
43176         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43178         ChannelHandshakeConfig_free(this_obj_conv);
43179 }
43180
43181 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
43182         LDKChannelHandshakeConfig this_ptr_conv;
43183         this_ptr_conv.inner = untag_ptr(this_ptr);
43184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43186         this_ptr_conv.is_owned = false;
43187         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
43188         return ret_conv;
43189 }
43190
43191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43192         LDKChannelHandshakeConfig this_ptr_conv;
43193         this_ptr_conv.inner = untag_ptr(this_ptr);
43194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43196         this_ptr_conv.is_owned = false;
43197         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
43198 }
43199
43200 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43201         LDKChannelHandshakeConfig this_ptr_conv;
43202         this_ptr_conv.inner = untag_ptr(this_ptr);
43203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43205         this_ptr_conv.is_owned = false;
43206         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
43207         return ret_conv;
43208 }
43209
43210 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) {
43211         LDKChannelHandshakeConfig this_ptr_conv;
43212         this_ptr_conv.inner = untag_ptr(this_ptr);
43213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43215         this_ptr_conv.is_owned = false;
43216         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
43217 }
43218
43219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43220         LDKChannelHandshakeConfig this_ptr_conv;
43221         this_ptr_conv.inner = untag_ptr(this_ptr);
43222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43224         this_ptr_conv.is_owned = false;
43225         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
43226         return ret_conv;
43227 }
43228
43229 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) {
43230         LDKChannelHandshakeConfig this_ptr_conv;
43231         this_ptr_conv.inner = untag_ptr(this_ptr);
43232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43234         this_ptr_conv.is_owned = false;
43235         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
43236 }
43237
43238 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) {
43239         LDKChannelHandshakeConfig this_ptr_conv;
43240         this_ptr_conv.inner = untag_ptr(this_ptr);
43241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43243         this_ptr_conv.is_owned = false;
43244         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
43245         return ret_conv;
43246 }
43247
43248 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) {
43249         LDKChannelHandshakeConfig this_ptr_conv;
43250         this_ptr_conv.inner = untag_ptr(this_ptr);
43251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43253         this_ptr_conv.is_owned = false;
43254         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
43255 }
43256
43257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
43258         LDKChannelHandshakeConfig this_ptr_conv;
43259         this_ptr_conv.inner = untag_ptr(this_ptr);
43260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43262         this_ptr_conv.is_owned = false;
43263         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
43264         return ret_conv;
43265 }
43266
43267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43268         LDKChannelHandshakeConfig this_ptr_conv;
43269         this_ptr_conv.inner = untag_ptr(this_ptr);
43270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43272         this_ptr_conv.is_owned = false;
43273         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
43274 }
43275
43276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
43277         LDKChannelHandshakeConfig this_ptr_conv;
43278         this_ptr_conv.inner = untag_ptr(this_ptr);
43279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43281         this_ptr_conv.is_owned = false;
43282         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
43283         return ret_conv;
43284 }
43285
43286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43287         LDKChannelHandshakeConfig this_ptr_conv;
43288         this_ptr_conv.inner = untag_ptr(this_ptr);
43289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43291         this_ptr_conv.is_owned = false;
43292         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
43293 }
43294
43295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43296         LDKChannelHandshakeConfig this_ptr_conv;
43297         this_ptr_conv.inner = untag_ptr(this_ptr);
43298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43300         this_ptr_conv.is_owned = false;
43301         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
43302         return ret_conv;
43303 }
43304
43305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43306         LDKChannelHandshakeConfig this_ptr_conv;
43307         this_ptr_conv.inner = untag_ptr(this_ptr);
43308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43310         this_ptr_conv.is_owned = false;
43311         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
43312 }
43313
43314 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43315         LDKChannelHandshakeConfig this_ptr_conv;
43316         this_ptr_conv.inner = untag_ptr(this_ptr);
43317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43319         this_ptr_conv.is_owned = false;
43320         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
43321         return ret_conv;
43322 }
43323
43324 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) {
43325         LDKChannelHandshakeConfig this_ptr_conv;
43326         this_ptr_conv.inner = untag_ptr(this_ptr);
43327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43329         this_ptr_conv.is_owned = false;
43330         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
43331 }
43332
43333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
43334         LDKChannelHandshakeConfig this_ptr_conv;
43335         this_ptr_conv.inner = untag_ptr(this_ptr);
43336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43338         this_ptr_conv.is_owned = false;
43339         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
43340         return ret_conv;
43341 }
43342
43343 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) {
43344         LDKChannelHandshakeConfig this_ptr_conv;
43345         this_ptr_conv.inner = untag_ptr(this_ptr);
43346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43348         this_ptr_conv.is_owned = false;
43349         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
43350 }
43351
43352 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43353         LDKChannelHandshakeConfig 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         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
43359         return ret_conv;
43360 }
43361
43362 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) {
43363         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
43369 }
43370
43371 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) {
43372         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);
43373         int64_t ret_ref = 0;
43374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43376         return ret_ref;
43377 }
43378
43379 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
43380         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
43381         int64_t ret_ref = 0;
43382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43384         return ret_ref;
43385 }
43386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43387         LDKChannelHandshakeConfig arg_conv;
43388         arg_conv.inner = untag_ptr(arg);
43389         arg_conv.is_owned = ptr_is_owned(arg);
43390         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43391         arg_conv.is_owned = false;
43392         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
43393         return ret_conv;
43394 }
43395
43396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43397         LDKChannelHandshakeConfig orig_conv;
43398         orig_conv.inner = untag_ptr(orig);
43399         orig_conv.is_owned = ptr_is_owned(orig);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43401         orig_conv.is_owned = false;
43402         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
43403         int64_t ret_ref = 0;
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43406         return ret_ref;
43407 }
43408
43409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
43410         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
43411         int64_t ret_ref = 0;
43412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43414         return ret_ref;
43415 }
43416
43417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43418         LDKChannelHandshakeLimits this_obj_conv;
43419         this_obj_conv.inner = untag_ptr(this_obj);
43420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43422         ChannelHandshakeLimits_free(this_obj_conv);
43423 }
43424
43425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43426         LDKChannelHandshakeLimits this_ptr_conv;
43427         this_ptr_conv.inner = untag_ptr(this_ptr);
43428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43430         this_ptr_conv.is_owned = false;
43431         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
43432         return ret_conv;
43433 }
43434
43435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43436         LDKChannelHandshakeLimits this_ptr_conv;
43437         this_ptr_conv.inner = untag_ptr(this_ptr);
43438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43440         this_ptr_conv.is_owned = false;
43441         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
43442 }
43443
43444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43445         LDKChannelHandshakeLimits this_ptr_conv;
43446         this_ptr_conv.inner = untag_ptr(this_ptr);
43447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43449         this_ptr_conv.is_owned = false;
43450         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
43451         return ret_conv;
43452 }
43453
43454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43455         LDKChannelHandshakeLimits this_ptr_conv;
43456         this_ptr_conv.inner = untag_ptr(this_ptr);
43457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43459         this_ptr_conv.is_owned = false;
43460         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
43461 }
43462
43463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43464         LDKChannelHandshakeLimits this_ptr_conv;
43465         this_ptr_conv.inner = untag_ptr(this_ptr);
43466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43468         this_ptr_conv.is_owned = false;
43469         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
43470         return ret_conv;
43471 }
43472
43473 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) {
43474         LDKChannelHandshakeLimits this_ptr_conv;
43475         this_ptr_conv.inner = untag_ptr(this_ptr);
43476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43478         this_ptr_conv.is_owned = false;
43479         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
43480 }
43481
43482 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) {
43483         LDKChannelHandshakeLimits this_ptr_conv;
43484         this_ptr_conv.inner = untag_ptr(this_ptr);
43485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43487         this_ptr_conv.is_owned = false;
43488         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
43489         return ret_conv;
43490 }
43491
43492 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) {
43493         LDKChannelHandshakeLimits this_ptr_conv;
43494         this_ptr_conv.inner = untag_ptr(this_ptr);
43495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43497         this_ptr_conv.is_owned = false;
43498         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43499 }
43500
43501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43502         LDKChannelHandshakeLimits this_ptr_conv;
43503         this_ptr_conv.inner = untag_ptr(this_ptr);
43504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43506         this_ptr_conv.is_owned = false;
43507         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
43508         return ret_conv;
43509 }
43510
43511 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) {
43512         LDKChannelHandshakeLimits this_ptr_conv;
43513         this_ptr_conv.inner = untag_ptr(this_ptr);
43514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43516         this_ptr_conv.is_owned = false;
43517         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
43518 }
43519
43520 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43521         LDKChannelHandshakeLimits this_ptr_conv;
43522         this_ptr_conv.inner = untag_ptr(this_ptr);
43523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43525         this_ptr_conv.is_owned = false;
43526         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
43527         return ret_conv;
43528 }
43529
43530 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) {
43531         LDKChannelHandshakeLimits this_ptr_conv;
43532         this_ptr_conv.inner = untag_ptr(this_ptr);
43533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43535         this_ptr_conv.is_owned = false;
43536         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
43537 }
43538
43539 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
43540         LDKChannelHandshakeLimits this_ptr_conv;
43541         this_ptr_conv.inner = untag_ptr(this_ptr);
43542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43544         this_ptr_conv.is_owned = false;
43545         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
43546         return ret_conv;
43547 }
43548
43549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43550         LDKChannelHandshakeLimits this_ptr_conv;
43551         this_ptr_conv.inner = untag_ptr(this_ptr);
43552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43554         this_ptr_conv.is_owned = false;
43555         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
43556 }
43557
43558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
43559         LDKChannelHandshakeLimits this_ptr_conv;
43560         this_ptr_conv.inner = untag_ptr(this_ptr);
43561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43563         this_ptr_conv.is_owned = false;
43564         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
43565         return ret_conv;
43566 }
43567
43568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43569         LDKChannelHandshakeLimits this_ptr_conv;
43570         this_ptr_conv.inner = untag_ptr(this_ptr);
43571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43573         this_ptr_conv.is_owned = false;
43574         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
43575 }
43576
43577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
43578         LDKChannelHandshakeLimits 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         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
43584         return ret_conv;
43585 }
43586
43587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43588         LDKChannelHandshakeLimits this_ptr_conv;
43589         this_ptr_conv.inner = untag_ptr(this_ptr);
43590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43592         this_ptr_conv.is_owned = false;
43593         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
43594 }
43595
43596 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43597         LDKChannelHandshakeLimits this_ptr_conv;
43598         this_ptr_conv.inner = untag_ptr(this_ptr);
43599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43601         this_ptr_conv.is_owned = false;
43602         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
43603         return ret_conv;
43604 }
43605
43606 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) {
43607         LDKChannelHandshakeLimits this_ptr_conv;
43608         this_ptr_conv.inner = untag_ptr(this_ptr);
43609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43611         this_ptr_conv.is_owned = false;
43612         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
43613 }
43614
43615 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) {
43616         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);
43617         int64_t ret_ref = 0;
43618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43620         return ret_ref;
43621 }
43622
43623 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
43624         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
43625         int64_t ret_ref = 0;
43626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43628         return ret_ref;
43629 }
43630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43631         LDKChannelHandshakeLimits arg_conv;
43632         arg_conv.inner = untag_ptr(arg);
43633         arg_conv.is_owned = ptr_is_owned(arg);
43634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43635         arg_conv.is_owned = false;
43636         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
43637         return ret_conv;
43638 }
43639
43640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43641         LDKChannelHandshakeLimits orig_conv;
43642         orig_conv.inner = untag_ptr(orig);
43643         orig_conv.is_owned = ptr_is_owned(orig);
43644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43645         orig_conv.is_owned = false;
43646         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
43647         int64_t ret_ref = 0;
43648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43650         return ret_ref;
43651 }
43652
43653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
43654         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
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_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43662         if (!ptr_is_owned(this_ptr)) return;
43663         void* this_ptr_ptr = untag_ptr(this_ptr);
43664         CHECK_ACCESS(this_ptr_ptr);
43665         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
43666         FREE(untag_ptr(this_ptr));
43667         MaxDustHTLCExposure_free(this_ptr_conv);
43668 }
43669
43670 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
43671         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43672         *ret_copy = MaxDustHTLCExposure_clone(arg);
43673         int64_t ret_ref = tag_ptr(ret_copy, true);
43674         return ret_ref;
43675 }
43676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43677         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
43678         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
43679         return ret_conv;
43680 }
43681
43682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43683         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
43684         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43685         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
43686         int64_t ret_ref = tag_ptr(ret_copy, true);
43687         return ret_ref;
43688 }
43689
43690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
43691         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43692         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
43693         int64_t ret_ref = tag_ptr(ret_copy, true);
43694         return ret_ref;
43695 }
43696
43697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
43698         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43699         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
43700         int64_t ret_ref = tag_ptr(ret_copy, true);
43701         return ret_ref;
43702 }
43703
43704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43705         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
43706         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
43707         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
43708         return ret_conv;
43709 }
43710
43711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
43712         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
43713         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
43714         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43715         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43716         CVec_u8Z_free(ret_var);
43717         return ret_arr;
43718 }
43719
43720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43721         LDKu8slice ser_ref;
43722         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43723         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43724         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
43725         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
43726         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43727         return tag_ptr(ret_conv, true);
43728 }
43729
43730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43731         LDKChannelConfig this_obj_conv;
43732         this_obj_conv.inner = untag_ptr(this_obj);
43733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43735         ChannelConfig_free(this_obj_conv);
43736 }
43737
43738 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43739         LDKChannelConfig this_ptr_conv;
43740         this_ptr_conv.inner = untag_ptr(this_ptr);
43741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43743         this_ptr_conv.is_owned = false;
43744         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
43745         return ret_conv;
43746 }
43747
43748 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) {
43749         LDKChannelConfig this_ptr_conv;
43750         this_ptr_conv.inner = untag_ptr(this_ptr);
43751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43753         this_ptr_conv.is_owned = false;
43754         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
43755 }
43756
43757 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43758         LDKChannelConfig this_ptr_conv;
43759         this_ptr_conv.inner = untag_ptr(this_ptr);
43760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43762         this_ptr_conv.is_owned = false;
43763         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
43764         return ret_conv;
43765 }
43766
43767 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) {
43768         LDKChannelConfig this_ptr_conv;
43769         this_ptr_conv.inner = untag_ptr(this_ptr);
43770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43772         this_ptr_conv.is_owned = false;
43773         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
43774 }
43775
43776 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43777         LDKChannelConfig this_ptr_conv;
43778         this_ptr_conv.inner = untag_ptr(this_ptr);
43779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43781         this_ptr_conv.is_owned = false;
43782         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
43783         return ret_conv;
43784 }
43785
43786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43787         LDKChannelConfig this_ptr_conv;
43788         this_ptr_conv.inner = untag_ptr(this_ptr);
43789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43791         this_ptr_conv.is_owned = false;
43792         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
43793 }
43794
43795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
43796         LDKChannelConfig this_ptr_conv;
43797         this_ptr_conv.inner = untag_ptr(this_ptr);
43798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43800         this_ptr_conv.is_owned = false;
43801         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43802         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
43803         int64_t ret_ref = tag_ptr(ret_copy, true);
43804         return ret_ref;
43805 }
43806
43807 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) {
43808         LDKChannelConfig this_ptr_conv;
43809         this_ptr_conv.inner = untag_ptr(this_ptr);
43810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43812         this_ptr_conv.is_owned = false;
43813         void* val_ptr = untag_ptr(val);
43814         CHECK_ACCESS(val_ptr);
43815         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
43816         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
43817         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
43818 }
43819
43820 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) {
43821         LDKChannelConfig this_ptr_conv;
43822         this_ptr_conv.inner = untag_ptr(this_ptr);
43823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43825         this_ptr_conv.is_owned = false;
43826         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
43827         return ret_conv;
43828 }
43829
43830 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) {
43831         LDKChannelConfig this_ptr_conv;
43832         this_ptr_conv.inner = untag_ptr(this_ptr);
43833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43835         this_ptr_conv.is_owned = false;
43836         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
43837 }
43838
43839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43840         LDKChannelConfig this_ptr_conv;
43841         this_ptr_conv.inner = untag_ptr(this_ptr);
43842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43844         this_ptr_conv.is_owned = false;
43845         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
43846         return ret_conv;
43847 }
43848
43849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43850         LDKChannelConfig this_ptr_conv;
43851         this_ptr_conv.inner = untag_ptr(this_ptr);
43852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43854         this_ptr_conv.is_owned = false;
43855         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
43856 }
43857
43858 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) {
43859         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
43860         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
43861         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
43862         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
43863         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);
43864         int64_t ret_ref = 0;
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43867         return ret_ref;
43868 }
43869
43870 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
43871         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
43872         int64_t ret_ref = 0;
43873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43875         return ret_ref;
43876 }
43877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43878         LDKChannelConfig arg_conv;
43879         arg_conv.inner = untag_ptr(arg);
43880         arg_conv.is_owned = ptr_is_owned(arg);
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43882         arg_conv.is_owned = false;
43883         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
43884         return ret_conv;
43885 }
43886
43887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43888         LDKChannelConfig orig_conv;
43889         orig_conv.inner = untag_ptr(orig);
43890         orig_conv.is_owned = ptr_is_owned(orig);
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43892         orig_conv.is_owned = false;
43893         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
43894         int64_t ret_ref = 0;
43895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43897         return ret_ref;
43898 }
43899
43900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43901         LDKChannelConfig a_conv;
43902         a_conv.inner = untag_ptr(a);
43903         a_conv.is_owned = ptr_is_owned(a);
43904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43905         a_conv.is_owned = false;
43906         LDKChannelConfig b_conv;
43907         b_conv.inner = untag_ptr(b);
43908         b_conv.is_owned = ptr_is_owned(b);
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43910         b_conv.is_owned = false;
43911         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
43912         return ret_conv;
43913 }
43914
43915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
43916         LDKChannelConfig this_arg_conv;
43917         this_arg_conv.inner = untag_ptr(this_arg);
43918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43920         this_arg_conv.is_owned = false;
43921         LDKChannelConfigUpdate update_conv;
43922         update_conv.inner = untag_ptr(update);
43923         update_conv.is_owned = ptr_is_owned(update);
43924         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
43925         update_conv.is_owned = false;
43926         ChannelConfig_apply(&this_arg_conv, &update_conv);
43927 }
43928
43929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
43930         LDKChannelConfig ret_var = ChannelConfig_default();
43931         int64_t ret_ref = 0;
43932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43934         return ret_ref;
43935 }
43936
43937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
43938         LDKChannelConfig obj_conv;
43939         obj_conv.inner = untag_ptr(obj);
43940         obj_conv.is_owned = ptr_is_owned(obj);
43941         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43942         obj_conv.is_owned = false;
43943         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
43944         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43945         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43946         CVec_u8Z_free(ret_var);
43947         return ret_arr;
43948 }
43949
43950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43951         LDKu8slice ser_ref;
43952         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43953         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43954         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
43955         *ret_conv = ChannelConfig_read(ser_ref);
43956         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43957         return tag_ptr(ret_conv, true);
43958 }
43959
43960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43961         LDKChannelConfigUpdate this_obj_conv;
43962         this_obj_conv.inner = untag_ptr(this_obj);
43963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43965         ChannelConfigUpdate_free(this_obj_conv);
43966 }
43967
43968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43969         LDKChannelConfigUpdate 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         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43975         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
43976         int64_t ret_ref = tag_ptr(ret_copy, true);
43977         return ret_ref;
43978 }
43979
43980 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) {
43981         LDKChannelConfigUpdate this_ptr_conv;
43982         this_ptr_conv.inner = untag_ptr(this_ptr);
43983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43985         this_ptr_conv.is_owned = false;
43986         void* val_ptr = untag_ptr(val);
43987         CHECK_ACCESS(val_ptr);
43988         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43989         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43990         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
43991 }
43992
43993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43994         LDKChannelConfigUpdate this_ptr_conv;
43995         this_ptr_conv.inner = untag_ptr(this_ptr);
43996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43998         this_ptr_conv.is_owned = false;
43999         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
44000         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
44001         int64_t ret_ref = tag_ptr(ret_copy, true);
44002         return ret_ref;
44003 }
44004
44005 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) {
44006         LDKChannelConfigUpdate this_ptr_conv;
44007         this_ptr_conv.inner = untag_ptr(this_ptr);
44008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44010         this_ptr_conv.is_owned = false;
44011         void* val_ptr = untag_ptr(val);
44012         CHECK_ACCESS(val_ptr);
44013         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
44014         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
44015         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
44016 }
44017
44018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44019         LDKChannelConfigUpdate this_ptr_conv;
44020         this_ptr_conv.inner = untag_ptr(this_ptr);
44021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44023         this_ptr_conv.is_owned = false;
44024         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
44025         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
44026         int64_t ret_ref = tag_ptr(ret_copy, true);
44027         return ret_ref;
44028 }
44029
44030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44031         LDKChannelConfigUpdate this_ptr_conv;
44032         this_ptr_conv.inner = untag_ptr(this_ptr);
44033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44035         this_ptr_conv.is_owned = false;
44036         void* val_ptr = untag_ptr(val);
44037         CHECK_ACCESS(val_ptr);
44038         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
44039         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
44040         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
44041 }
44042
44043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44044         LDKChannelConfigUpdate this_ptr_conv;
44045         this_ptr_conv.inner = untag_ptr(this_ptr);
44046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44048         this_ptr_conv.is_owned = false;
44049         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
44050         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
44051         int64_t ret_ref = tag_ptr(ret_copy, true);
44052         return ret_ref;
44053 }
44054
44055 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) {
44056         LDKChannelConfigUpdate this_ptr_conv;
44057         this_ptr_conv.inner = untag_ptr(this_ptr);
44058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44060         this_ptr_conv.is_owned = false;
44061         void* val_ptr = untag_ptr(val);
44062         CHECK_ACCESS(val_ptr);
44063         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
44064         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
44065         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
44066 }
44067
44068 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) {
44069         LDKChannelConfigUpdate this_ptr_conv;
44070         this_ptr_conv.inner = untag_ptr(this_ptr);
44071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44073         this_ptr_conv.is_owned = false;
44074         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44075         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
44076         int64_t ret_ref = tag_ptr(ret_copy, true);
44077         return ret_ref;
44078 }
44079
44080 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) {
44081         LDKChannelConfigUpdate this_ptr_conv;
44082         this_ptr_conv.inner = untag_ptr(this_ptr);
44083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44085         this_ptr_conv.is_owned = false;
44086         void* val_ptr = untag_ptr(val);
44087         CHECK_ACCESS(val_ptr);
44088         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44089         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44090         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
44091 }
44092
44093 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) {
44094         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
44095         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
44096         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
44097         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
44098         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
44099         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
44100         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
44101         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
44102         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
44103         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
44104         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
44105         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
44106         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
44107         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
44108         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
44109         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
44110         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
44111         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
44112         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
44113         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
44114         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);
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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
44122         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
44123         int64_t ret_ref = 0;
44124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44126         return ret_ref;
44127 }
44128
44129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44130         LDKUserConfig this_obj_conv;
44131         this_obj_conv.inner = untag_ptr(this_obj);
44132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44134         UserConfig_free(this_obj_conv);
44135 }
44136
44137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
44138         LDKUserConfig this_ptr_conv;
44139         this_ptr_conv.inner = untag_ptr(this_ptr);
44140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44142         this_ptr_conv.is_owned = false;
44143         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
44144         int64_t ret_ref = 0;
44145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44147         return ret_ref;
44148 }
44149
44150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44151         LDKUserConfig this_ptr_conv;
44152         this_ptr_conv.inner = untag_ptr(this_ptr);
44153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44155         this_ptr_conv.is_owned = false;
44156         LDKChannelHandshakeConfig val_conv;
44157         val_conv.inner = untag_ptr(val);
44158         val_conv.is_owned = ptr_is_owned(val);
44159         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44160         val_conv = ChannelHandshakeConfig_clone(&val_conv);
44161         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
44162 }
44163
44164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
44165         LDKUserConfig this_ptr_conv;
44166         this_ptr_conv.inner = untag_ptr(this_ptr);
44167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44169         this_ptr_conv.is_owned = false;
44170         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
44171         int64_t ret_ref = 0;
44172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44174         return ret_ref;
44175 }
44176
44177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44178         LDKUserConfig this_ptr_conv;
44179         this_ptr_conv.inner = untag_ptr(this_ptr);
44180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44182         this_ptr_conv.is_owned = false;
44183         LDKChannelHandshakeLimits val_conv;
44184         val_conv.inner = untag_ptr(val);
44185         val_conv.is_owned = ptr_is_owned(val);
44186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44187         val_conv = ChannelHandshakeLimits_clone(&val_conv);
44188         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
44189 }
44190
44191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
44192         LDKUserConfig this_ptr_conv;
44193         this_ptr_conv.inner = untag_ptr(this_ptr);
44194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44196         this_ptr_conv.is_owned = false;
44197         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
44198         int64_t ret_ref = 0;
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44201         return ret_ref;
44202 }
44203
44204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44205         LDKUserConfig this_ptr_conv;
44206         this_ptr_conv.inner = untag_ptr(this_ptr);
44207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44209         this_ptr_conv.is_owned = false;
44210         LDKChannelConfig val_conv;
44211         val_conv.inner = untag_ptr(val);
44212         val_conv.is_owned = ptr_is_owned(val);
44213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44214         val_conv = ChannelConfig_clone(&val_conv);
44215         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
44216 }
44217
44218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44219         LDKUserConfig this_ptr_conv;
44220         this_ptr_conv.inner = untag_ptr(this_ptr);
44221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44223         this_ptr_conv.is_owned = false;
44224         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
44225         return ret_conv;
44226 }
44227
44228 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) {
44229         LDKUserConfig this_ptr_conv;
44230         this_ptr_conv.inner = untag_ptr(this_ptr);
44231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44233         this_ptr_conv.is_owned = false;
44234         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
44235 }
44236
44237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44238         LDKUserConfig this_ptr_conv;
44239         this_ptr_conv.inner = untag_ptr(this_ptr);
44240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44242         this_ptr_conv.is_owned = false;
44243         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
44244         return ret_conv;
44245 }
44246
44247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
44248         LDKUserConfig this_ptr_conv;
44249         this_ptr_conv.inner = untag_ptr(this_ptr);
44250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44252         this_ptr_conv.is_owned = false;
44253         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
44254 }
44255
44256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44257         LDKUserConfig this_ptr_conv;
44258         this_ptr_conv.inner = untag_ptr(this_ptr);
44259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44261         this_ptr_conv.is_owned = false;
44262         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
44263         return ret_conv;
44264 }
44265
44266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
44267         LDKUserConfig this_ptr_conv;
44268         this_ptr_conv.inner = untag_ptr(this_ptr);
44269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44271         this_ptr_conv.is_owned = false;
44272         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
44273 }
44274
44275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44276         LDKUserConfig this_ptr_conv;
44277         this_ptr_conv.inner = untag_ptr(this_ptr);
44278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44280         this_ptr_conv.is_owned = false;
44281         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
44282         return ret_conv;
44283 }
44284
44285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
44286         LDKUserConfig this_ptr_conv;
44287         this_ptr_conv.inner = untag_ptr(this_ptr);
44288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44290         this_ptr_conv.is_owned = false;
44291         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
44292 }
44293
44294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
44295         LDKUserConfig this_ptr_conv;
44296         this_ptr_conv.inner = untag_ptr(this_ptr);
44297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44299         this_ptr_conv.is_owned = false;
44300         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
44301         return ret_conv;
44302 }
44303
44304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
44305         LDKUserConfig this_ptr_conv;
44306         this_ptr_conv.inner = untag_ptr(this_ptr);
44307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44309         this_ptr_conv.is_owned = false;
44310         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
44311 }
44312
44313 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) {
44314         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
44315         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
44316         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
44317         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
44318         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
44319         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
44320         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
44321         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
44323         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
44324         LDKChannelConfig channel_config_arg_conv;
44325         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
44326         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
44327         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
44328         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
44329         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);
44330         int64_t ret_ref = 0;
44331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44333         return ret_ref;
44334 }
44335
44336 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
44337         LDKUserConfig ret_var = UserConfig_clone(arg);
44338         int64_t ret_ref = 0;
44339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44341         return ret_ref;
44342 }
44343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44344         LDKUserConfig arg_conv;
44345         arg_conv.inner = untag_ptr(arg);
44346         arg_conv.is_owned = ptr_is_owned(arg);
44347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44348         arg_conv.is_owned = false;
44349         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
44350         return ret_conv;
44351 }
44352
44353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44354         LDKUserConfig orig_conv;
44355         orig_conv.inner = untag_ptr(orig);
44356         orig_conv.is_owned = ptr_is_owned(orig);
44357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44358         orig_conv.is_owned = false;
44359         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
44360         int64_t ret_ref = 0;
44361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44363         return ret_ref;
44364 }
44365
44366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
44367         LDKUserConfig ret_var = UserConfig_default();
44368         int64_t ret_ref = 0;
44369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44371         return ret_ref;
44372 }
44373
44374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44375         LDKBestBlock this_obj_conv;
44376         this_obj_conv.inner = untag_ptr(this_obj);
44377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44379         BestBlock_free(this_obj_conv);
44380 }
44381
44382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
44383         LDKBestBlock this_ptr_conv;
44384         this_ptr_conv.inner = untag_ptr(this_ptr);
44385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44387         this_ptr_conv.is_owned = false;
44388         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44389         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BestBlock_get_block_hash(&this_ptr_conv));
44390         return ret_arr;
44391 }
44392
44393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44394         LDKBestBlock this_ptr_conv;
44395         this_ptr_conv.inner = untag_ptr(this_ptr);
44396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44398         this_ptr_conv.is_owned = false;
44399         LDKThirtyTwoBytes val_ref;
44400         CHECK((*env)->GetArrayLength(env, val) == 32);
44401         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44402         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
44403 }
44404
44405 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1get_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
44406         LDKBestBlock this_ptr_conv;
44407         this_ptr_conv.inner = untag_ptr(this_ptr);
44408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44410         this_ptr_conv.is_owned = false;
44411         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
44412         return ret_conv;
44413 }
44414
44415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1set_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44416         LDKBestBlock this_ptr_conv;
44417         this_ptr_conv.inner = untag_ptr(this_ptr);
44418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44420         this_ptr_conv.is_owned = false;
44421         BestBlock_set_height(&this_ptr_conv, val);
44422 }
44423
44424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int32_t height_arg) {
44425         LDKThirtyTwoBytes block_hash_arg_ref;
44426         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
44427         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
44428         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
44429         int64_t ret_ref = 0;
44430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44432         return ret_ref;
44433 }
44434
44435 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
44436         LDKBestBlock ret_var = BestBlock_clone(arg);
44437         int64_t ret_ref = 0;
44438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44440         return ret_ref;
44441 }
44442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44443         LDKBestBlock arg_conv;
44444         arg_conv.inner = untag_ptr(arg);
44445         arg_conv.is_owned = ptr_is_owned(arg);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44447         arg_conv.is_owned = false;
44448         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
44449         return ret_conv;
44450 }
44451
44452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44453         LDKBestBlock orig_conv;
44454         orig_conv.inner = untag_ptr(orig);
44455         orig_conv.is_owned = ptr_is_owned(orig);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44457         orig_conv.is_owned = false;
44458         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
44459         int64_t ret_ref = 0;
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44462         return ret_ref;
44463 }
44464
44465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1hash(JNIEnv *env, jclass clz, int64_t o) {
44466         LDKBestBlock o_conv;
44467         o_conv.inner = untag_ptr(o);
44468         o_conv.is_owned = ptr_is_owned(o);
44469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44470         o_conv.is_owned = false;
44471         int64_t ret_conv = BestBlock_hash(&o_conv);
44472         return ret_conv;
44473 }
44474
44475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44476         LDKBestBlock a_conv;
44477         a_conv.inner = untag_ptr(a);
44478         a_conv.is_owned = ptr_is_owned(a);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44480         a_conv.is_owned = false;
44481         LDKBestBlock b_conv;
44482         b_conv.inner = untag_ptr(b);
44483         b_conv.is_owned = ptr_is_owned(b);
44484         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44485         b_conv.is_owned = false;
44486         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
44487         return ret_conv;
44488 }
44489
44490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
44491         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
44492         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
44493         int64_t ret_ref = 0;
44494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44496         return ret_ref;
44497 }
44498
44499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1write(JNIEnv *env, jclass clz, int64_t obj) {
44500         LDKBestBlock obj_conv;
44501         obj_conv.inner = untag_ptr(obj);
44502         obj_conv.is_owned = ptr_is_owned(obj);
44503         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44504         obj_conv.is_owned = false;
44505         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
44506         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44507         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44508         CVec_u8Z_free(ret_var);
44509         return ret_arr;
44510 }
44511
44512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44513         LDKu8slice ser_ref;
44514         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44515         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44516         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
44517         *ret_conv = BestBlock_read(ser_ref);
44518         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44519         return tag_ptr(ret_conv, true);
44520 }
44521
44522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44523         if (!ptr_is_owned(this_ptr)) return;
44524         void* this_ptr_ptr = untag_ptr(this_ptr);
44525         CHECK_ACCESS(this_ptr_ptr);
44526         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
44527         FREE(untag_ptr(this_ptr));
44528         Listen_free(this_ptr_conv);
44529 }
44530
44531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44532         if (!ptr_is_owned(this_ptr)) return;
44533         void* this_ptr_ptr = untag_ptr(this_ptr);
44534         CHECK_ACCESS(this_ptr_ptr);
44535         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
44536         FREE(untag_ptr(this_ptr));
44537         Confirm_free(this_ptr_conv);
44538 }
44539
44540 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44541         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
44542         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
44543         return ret_conv;
44544 }
44545
44546 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
44547         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
44548         return ret_conv;
44549 }
44550
44551 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
44552         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
44553         return ret_conv;
44554 }
44555
44556 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
44557         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
44558         return ret_conv;
44559 }
44560
44561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44562         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
44563         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
44564         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
44565         return ret_conv;
44566 }
44567
44568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44569         if (!ptr_is_owned(this_ptr)) return;
44570         void* this_ptr_ptr = untag_ptr(this_ptr);
44571         CHECK_ACCESS(this_ptr_ptr);
44572         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
44573         FREE(untag_ptr(this_ptr));
44574         Watch_free(this_ptr_conv);
44575 }
44576
44577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44578         if (!ptr_is_owned(this_ptr)) return;
44579         void* this_ptr_ptr = untag_ptr(this_ptr);
44580         CHECK_ACCESS(this_ptr_ptr);
44581         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
44582         FREE(untag_ptr(this_ptr));
44583         Filter_free(this_ptr_conv);
44584 }
44585
44586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44587         LDKWatchedOutput this_obj_conv;
44588         this_obj_conv.inner = untag_ptr(this_obj);
44589         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44591         WatchedOutput_free(this_obj_conv);
44592 }
44593
44594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
44595         LDKWatchedOutput this_ptr_conv;
44596         this_ptr_conv.inner = untag_ptr(this_ptr);
44597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44599         this_ptr_conv.is_owned = false;
44600         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
44601         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
44602         int64_t ret_ref = tag_ptr(ret_copy, true);
44603         return ret_ref;
44604 }
44605
44606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44607         LDKWatchedOutput this_ptr_conv;
44608         this_ptr_conv.inner = untag_ptr(this_ptr);
44609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44611         this_ptr_conv.is_owned = false;
44612         void* val_ptr = untag_ptr(val);
44613         CHECK_ACCESS(val_ptr);
44614         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
44615         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
44616         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
44617 }
44618
44619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44620         LDKWatchedOutput this_ptr_conv;
44621         this_ptr_conv.inner = untag_ptr(this_ptr);
44622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44624         this_ptr_conv.is_owned = false;
44625         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
44626         int64_t ret_ref = 0;
44627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44629         return ret_ref;
44630 }
44631
44632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44633         LDKWatchedOutput this_ptr_conv;
44634         this_ptr_conv.inner = untag_ptr(this_ptr);
44635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44637         this_ptr_conv.is_owned = false;
44638         LDKOutPoint val_conv;
44639         val_conv.inner = untag_ptr(val);
44640         val_conv.is_owned = ptr_is_owned(val);
44641         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44642         val_conv = OutPoint_clone(&val_conv);
44643         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
44644 }
44645
44646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44647         LDKWatchedOutput this_ptr_conv;
44648         this_ptr_conv.inner = untag_ptr(this_ptr);
44649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44651         this_ptr_conv.is_owned = false;
44652         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
44653         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44654         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44655         CVec_u8Z_free(ret_var);
44656         return ret_arr;
44657 }
44658
44659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44660         LDKWatchedOutput this_ptr_conv;
44661         this_ptr_conv.inner = untag_ptr(this_ptr);
44662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44664         this_ptr_conv.is_owned = false;
44665         LDKCVec_u8Z val_ref;
44666         val_ref.datalen = (*env)->GetArrayLength(env, val);
44667         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44668         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
44669         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
44670 }
44671
44672 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) {
44673         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
44674         CHECK_ACCESS(block_hash_arg_ptr);
44675         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
44676         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
44677         LDKOutPoint outpoint_arg_conv;
44678         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
44679         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
44680         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
44681         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
44682         LDKCVec_u8Z script_pubkey_arg_ref;
44683         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
44684         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44685         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
44686         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
44687         int64_t ret_ref = 0;
44688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44690         return ret_ref;
44691 }
44692
44693 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
44694         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
44695         int64_t ret_ref = 0;
44696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44698         return ret_ref;
44699 }
44700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44701         LDKWatchedOutput arg_conv;
44702         arg_conv.inner = untag_ptr(arg);
44703         arg_conv.is_owned = ptr_is_owned(arg);
44704         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44705         arg_conv.is_owned = false;
44706         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
44707         return ret_conv;
44708 }
44709
44710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44711         LDKWatchedOutput orig_conv;
44712         orig_conv.inner = untag_ptr(orig);
44713         orig_conv.is_owned = ptr_is_owned(orig);
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44715         orig_conv.is_owned = false;
44716         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
44717         int64_t ret_ref = 0;
44718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44720         return ret_ref;
44721 }
44722
44723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44724         LDKWatchedOutput a_conv;
44725         a_conv.inner = untag_ptr(a);
44726         a_conv.is_owned = ptr_is_owned(a);
44727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44728         a_conv.is_owned = false;
44729         LDKWatchedOutput b_conv;
44730         b_conv.inner = untag_ptr(b);
44731         b_conv.is_owned = ptr_is_owned(b);
44732         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44733         b_conv.is_owned = false;
44734         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
44735         return ret_conv;
44736 }
44737
44738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
44739         LDKWatchedOutput o_conv;
44740         o_conv.inner = untag_ptr(o);
44741         o_conv.is_owned = ptr_is_owned(o);
44742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44743         o_conv.is_owned = false;
44744         int64_t ret_conv = WatchedOutput_hash(&o_conv);
44745         return ret_conv;
44746 }
44747
44748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44749         if (!ptr_is_owned(this_ptr)) return;
44750         void* this_ptr_ptr = untag_ptr(this_ptr);
44751         CHECK_ACCESS(this_ptr_ptr);
44752         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
44753         FREE(untag_ptr(this_ptr));
44754         BroadcasterInterface_free(this_ptr_conv);
44755 }
44756
44757 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44758         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
44759         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
44760         return ret_conv;
44761 }
44762
44763 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
44764         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
44765         return ret_conv;
44766 }
44767
44768 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
44769         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
44770         return ret_conv;
44771 }
44772
44773 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
44774         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
44775         return ret_conv;
44776 }
44777
44778 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
44779         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
44780         return ret_conv;
44781 }
44782
44783 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
44784         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
44785         return ret_conv;
44786 }
44787
44788 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
44789         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
44790         return ret_conv;
44791 }
44792
44793 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1output_1spending_1fee(JNIEnv *env, jclass clz) {
44794         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_output_spending_fee());
44795         return ret_conv;
44796 }
44797
44798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
44799         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
44800         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
44801         return ret_conv;
44802 }
44803
44804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44805         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
44806         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
44807         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
44808         return ret_conv;
44809 }
44810
44811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44812         if (!ptr_is_owned(this_ptr)) return;
44813         void* this_ptr_ptr = untag_ptr(this_ptr);
44814         CHECK_ACCESS(this_ptr_ptr);
44815         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
44816         FREE(untag_ptr(this_ptr));
44817         FeeEstimator_free(this_ptr_conv);
44818 }
44819
44820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44821         LDKMonitorUpdateId this_obj_conv;
44822         this_obj_conv.inner = untag_ptr(this_obj);
44823         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44825         MonitorUpdateId_free(this_obj_conv);
44826 }
44827
44828 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
44829         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
44830         int64_t ret_ref = 0;
44831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44833         return ret_ref;
44834 }
44835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44836         LDKMonitorUpdateId arg_conv;
44837         arg_conv.inner = untag_ptr(arg);
44838         arg_conv.is_owned = ptr_is_owned(arg);
44839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44840         arg_conv.is_owned = false;
44841         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
44842         return ret_conv;
44843 }
44844
44845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44846         LDKMonitorUpdateId orig_conv;
44847         orig_conv.inner = untag_ptr(orig);
44848         orig_conv.is_owned = ptr_is_owned(orig);
44849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44850         orig_conv.is_owned = false;
44851         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
44852         int64_t ret_ref = 0;
44853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44855         return ret_ref;
44856 }
44857
44858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
44859         LDKMonitorUpdateId o_conv;
44860         o_conv.inner = untag_ptr(o);
44861         o_conv.is_owned = ptr_is_owned(o);
44862         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44863         o_conv.is_owned = false;
44864         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
44865         return ret_conv;
44866 }
44867
44868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44869         LDKMonitorUpdateId a_conv;
44870         a_conv.inner = untag_ptr(a);
44871         a_conv.is_owned = ptr_is_owned(a);
44872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44873         a_conv.is_owned = false;
44874         LDKMonitorUpdateId b_conv;
44875         b_conv.inner = untag_ptr(b);
44876         b_conv.is_owned = ptr_is_owned(b);
44877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44878         b_conv.is_owned = false;
44879         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
44880         return ret_conv;
44881 }
44882
44883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44884         if (!ptr_is_owned(this_ptr)) return;
44885         void* this_ptr_ptr = untag_ptr(this_ptr);
44886         CHECK_ACCESS(this_ptr_ptr);
44887         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
44888         FREE(untag_ptr(this_ptr));
44889         Persist_free(this_ptr_conv);
44890 }
44891
44892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44893         LDKLockedChannelMonitor this_obj_conv;
44894         this_obj_conv.inner = untag_ptr(this_obj);
44895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44897         LockedChannelMonitor_free(this_obj_conv);
44898 }
44899
44900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44901         LDKChainMonitor this_obj_conv;
44902         this_obj_conv.inner = untag_ptr(this_obj);
44903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44905         ChainMonitor_free(this_obj_conv);
44906 }
44907
44908 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) {
44909         void* chain_source_ptr = untag_ptr(chain_source);
44910         CHECK_ACCESS(chain_source_ptr);
44911         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
44912         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
44913         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
44914                 // Manually implement clone for Java trait instances
44915                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
44916                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44917                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
44918                 }
44919         }
44920         void* broadcaster_ptr = untag_ptr(broadcaster);
44921         CHECK_ACCESS(broadcaster_ptr);
44922         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
44923         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
44924                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44925                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
44926         }
44927         void* logger_ptr = untag_ptr(logger);
44928         CHECK_ACCESS(logger_ptr);
44929         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44930         if (logger_conv.free == LDKLogger_JCalls_free) {
44931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44932                 LDKLogger_JCalls_cloned(&logger_conv);
44933         }
44934         void* feeest_ptr = untag_ptr(feeest);
44935         CHECK_ACCESS(feeest_ptr);
44936         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
44937         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
44938                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44939                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
44940         }
44941         void* persister_ptr = untag_ptr(persister);
44942         CHECK_ACCESS(persister_ptr);
44943         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
44944         if (persister_conv.free == LDKPersist_JCalls_free) {
44945                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44946                 LDKPersist_JCalls_cloned(&persister_conv);
44947         }
44948         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
44949         int64_t ret_ref = 0;
44950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44952         return ret_ref;
44953 }
44954
44955 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) {
44956         LDKChainMonitor this_arg_conv;
44957         this_arg_conv.inner = untag_ptr(this_arg);
44958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44960         this_arg_conv.is_owned = false;
44961         LDKCVec_ChannelDetailsZ ignored_channels_constr;
44962         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
44963         if (ignored_channels_constr.datalen > 0)
44964                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44965         else
44966                 ignored_channels_constr.data = NULL;
44967         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
44968         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
44969                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
44970                 LDKChannelDetails ignored_channels_conv_16_conv;
44971                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
44972                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
44973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
44974                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
44975                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
44976         }
44977         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
44978         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
44979         int64_tArray ret_arr = NULL;
44980         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44981         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44982         for (size_t j = 0; j < ret_var.datalen; j++) {
44983                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44984                 *ret_conv_9_copy = ret_var.data[j];
44985                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
44986                 ret_arr_ptr[j] = ret_conv_9_ref;
44987         }
44988         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44989         FREE(ret_var.data);
44990         return ret_arr;
44991 }
44992
44993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
44994         LDKChainMonitor this_arg_conv;
44995         this_arg_conv.inner = untag_ptr(this_arg);
44996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44998         this_arg_conv.is_owned = false;
44999         LDKOutPoint funding_txo_conv;
45000         funding_txo_conv.inner = untag_ptr(funding_txo);
45001         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
45002         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
45003         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
45004         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
45005         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
45006         return tag_ptr(ret_conv, true);
45007 }
45008
45009 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
45010         LDKChainMonitor this_arg_conv;
45011         this_arg_conv.inner = untag_ptr(this_arg);
45012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45014         this_arg_conv.is_owned = false;
45015         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
45016         int64_tArray ret_arr = NULL;
45017         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45018         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45019         for (size_t d = 0; d < ret_var.datalen; d++) {
45020                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
45021                 *ret_conv_29_conv = ret_var.data[d];
45022                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
45023         }
45024         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45025         FREE(ret_var.data);
45026         return ret_arr;
45027 }
45028
45029 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
45030         LDKChainMonitor this_arg_conv;
45031         this_arg_conv.inner = untag_ptr(this_arg);
45032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45034         this_arg_conv.is_owned = false;
45035         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
45036         int64_tArray ret_arr = NULL;
45037         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45038         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45039         for (size_t p = 0; p < ret_var.datalen; p++) {
45040                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
45041                 *ret_conv_41_conv = ret_var.data[p];
45042                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
45043         }
45044         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45045         FREE(ret_var.data);
45046         return ret_arr;
45047 }
45048
45049 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) {
45050         LDKChainMonitor this_arg_conv;
45051         this_arg_conv.inner = untag_ptr(this_arg);
45052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45054         this_arg_conv.is_owned = false;
45055         LDKOutPoint funding_txo_conv;
45056         funding_txo_conv.inner = untag_ptr(funding_txo);
45057         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
45058         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
45059         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
45060         LDKMonitorUpdateId completed_update_id_conv;
45061         completed_update_id_conv.inner = untag_ptr(completed_update_id);
45062         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
45063         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
45064         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
45065         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
45066         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
45067         return tag_ptr(ret_conv, true);
45068 }
45069
45070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
45071         LDKChainMonitor this_arg_conv;
45072         this_arg_conv.inner = untag_ptr(this_arg);
45073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45075         this_arg_conv.is_owned = false;
45076         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
45077         int64_t ret_ref = 0;
45078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45080         return ret_ref;
45081 }
45082
45083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
45084         LDKChainMonitor this_arg_conv;
45085         this_arg_conv.inner = untag_ptr(this_arg);
45086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45088         this_arg_conv.is_owned = false;
45089         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
45090 }
45091
45092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1signer_1unblocked(JNIEnv *env, jclass clz, int64_t this_arg, int64_t monitor_opt) {
45093         LDKChainMonitor this_arg_conv;
45094         this_arg_conv.inner = untag_ptr(this_arg);
45095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45097         this_arg_conv.is_owned = false;
45098         LDKOutPoint monitor_opt_conv;
45099         monitor_opt_conv.inner = untag_ptr(monitor_opt);
45100         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
45101         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
45102         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
45103         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
45104 }
45105
45106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1archive_1fully_1resolved_1channel_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
45107         LDKChainMonitor this_arg_conv;
45108         this_arg_conv.inner = untag_ptr(this_arg);
45109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45111         this_arg_conv.is_owned = false;
45112         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
45113 }
45114
45115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
45116         LDKChainMonitor this_arg_conv;
45117         this_arg_conv.inner = untag_ptr(this_arg);
45118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45120         this_arg_conv.is_owned = false;
45121         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
45122         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
45123         return tag_ptr(ret_ret, true);
45124 }
45125
45126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
45127         LDKChainMonitor this_arg_conv;
45128         this_arg_conv.inner = untag_ptr(this_arg);
45129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45131         this_arg_conv.is_owned = false;
45132         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
45133         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
45134         return tag_ptr(ret_ret, true);
45135 }
45136
45137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
45138         LDKChainMonitor this_arg_conv;
45139         this_arg_conv.inner = untag_ptr(this_arg);
45140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45142         this_arg_conv.is_owned = false;
45143         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
45144         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
45145         return tag_ptr(ret_ret, true);
45146 }
45147
45148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
45149         LDKChainMonitor this_arg_conv;
45150         this_arg_conv.inner = untag_ptr(this_arg);
45151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45153         this_arg_conv.is_owned = false;
45154         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
45155         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
45156         return tag_ptr(ret_ret, true);
45157 }
45158
45159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45160         LDKChannelMonitorUpdate this_obj_conv;
45161         this_obj_conv.inner = untag_ptr(this_obj);
45162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45164         ChannelMonitorUpdate_free(this_obj_conv);
45165 }
45166
45167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45168         LDKChannelMonitorUpdate this_ptr_conv;
45169         this_ptr_conv.inner = untag_ptr(this_ptr);
45170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45172         this_ptr_conv.is_owned = false;
45173         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
45174         return ret_conv;
45175 }
45176
45177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45178         LDKChannelMonitorUpdate this_ptr_conv;
45179         this_ptr_conv.inner = untag_ptr(this_ptr);
45180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45182         this_ptr_conv.is_owned = false;
45183         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
45184 }
45185
45186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45187         LDKChannelMonitorUpdate this_ptr_conv;
45188         this_ptr_conv.inner = untag_ptr(this_ptr);
45189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45191         this_ptr_conv.is_owned = false;
45192         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
45193         int64_t ret_ref = 0;
45194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45196         return ret_ref;
45197 }
45198
45199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45200         LDKChannelMonitorUpdate this_ptr_conv;
45201         this_ptr_conv.inner = untag_ptr(this_ptr);
45202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45204         this_ptr_conv.is_owned = false;
45205         LDKChannelId val_conv;
45206         val_conv.inner = untag_ptr(val);
45207         val_conv.is_owned = ptr_is_owned(val);
45208         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45209         val_conv = ChannelId_clone(&val_conv);
45210         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
45211 }
45212
45213 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
45214         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
45215         int64_t ret_ref = 0;
45216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45218         return ret_ref;
45219 }
45220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45221         LDKChannelMonitorUpdate arg_conv;
45222         arg_conv.inner = untag_ptr(arg);
45223         arg_conv.is_owned = ptr_is_owned(arg);
45224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45225         arg_conv.is_owned = false;
45226         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
45227         return ret_conv;
45228 }
45229
45230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45231         LDKChannelMonitorUpdate orig_conv;
45232         orig_conv.inner = untag_ptr(orig);
45233         orig_conv.is_owned = ptr_is_owned(orig);
45234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45235         orig_conv.is_owned = false;
45236         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
45237         int64_t ret_ref = 0;
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45240         return ret_ref;
45241 }
45242
45243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45244         LDKChannelMonitorUpdate a_conv;
45245         a_conv.inner = untag_ptr(a);
45246         a_conv.is_owned = ptr_is_owned(a);
45247         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45248         a_conv.is_owned = false;
45249         LDKChannelMonitorUpdate b_conv;
45250         b_conv.inner = untag_ptr(b);
45251         b_conv.is_owned = ptr_is_owned(b);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45253         b_conv.is_owned = false;
45254         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
45255         return ret_conv;
45256 }
45257
45258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
45259         LDKChannelMonitorUpdate obj_conv;
45260         obj_conv.inner = untag_ptr(obj);
45261         obj_conv.is_owned = ptr_is_owned(obj);
45262         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45263         obj_conv.is_owned = false;
45264         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
45265         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45266         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45267         CVec_u8Z_free(ret_var);
45268         return ret_arr;
45269 }
45270
45271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45272         LDKu8slice ser_ref;
45273         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45274         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45275         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
45276         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
45277         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45278         return tag_ptr(ret_conv, true);
45279 }
45280
45281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45282         if (!ptr_is_owned(this_ptr)) return;
45283         void* this_ptr_ptr = untag_ptr(this_ptr);
45284         CHECK_ACCESS(this_ptr_ptr);
45285         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
45286         FREE(untag_ptr(this_ptr));
45287         MonitorEvent_free(this_ptr_conv);
45288 }
45289
45290 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
45291         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45292         *ret_copy = MonitorEvent_clone(arg);
45293         int64_t ret_ref = tag_ptr(ret_copy, true);
45294         return ret_ref;
45295 }
45296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45297         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
45298         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
45299         return ret_conv;
45300 }
45301
45302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45303         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
45304         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45305         *ret_copy = MonitorEvent_clone(orig_conv);
45306         int64_t ret_ref = tag_ptr(ret_copy, true);
45307         return ret_ref;
45308 }
45309
45310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
45311         LDKHTLCUpdate a_conv;
45312         a_conv.inner = untag_ptr(a);
45313         a_conv.is_owned = ptr_is_owned(a);
45314         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45315         a_conv = HTLCUpdate_clone(&a_conv);
45316         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45317         *ret_copy = MonitorEvent_htlcevent(a_conv);
45318         int64_t ret_ref = tag_ptr(ret_copy, true);
45319         return ret_ref;
45320 }
45321
45322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed_1with_1info(JNIEnv *env, jclass clz, int64_t reason, int64_t outpoint, int64_t channel_id) {
45323         void* reason_ptr = untag_ptr(reason);
45324         CHECK_ACCESS(reason_ptr);
45325         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
45326         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
45327         LDKOutPoint outpoint_conv;
45328         outpoint_conv.inner = untag_ptr(outpoint);
45329         outpoint_conv.is_owned = ptr_is_owned(outpoint);
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
45331         outpoint_conv = OutPoint_clone(&outpoint_conv);
45332         LDKChannelId channel_id_conv;
45333         channel_id_conv.inner = untag_ptr(channel_id);
45334         channel_id_conv.is_owned = ptr_is_owned(channel_id);
45335         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
45336         channel_id_conv = ChannelId_clone(&channel_id_conv);
45337         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45338         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
45339         int64_t ret_ref = tag_ptr(ret_copy, true);
45340         return ret_ref;
45341 }
45342
45343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
45344         LDKOutPoint a_conv;
45345         a_conv.inner = untag_ptr(a);
45346         a_conv.is_owned = ptr_is_owned(a);
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45348         a_conv = OutPoint_clone(&a_conv);
45349         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45350         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
45351         int64_t ret_ref = tag_ptr(ret_copy, true);
45352         return ret_ref;
45353 }
45354
45355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t channel_id, int64_t monitor_update_id) {
45356         LDKOutPoint funding_txo_conv;
45357         funding_txo_conv.inner = untag_ptr(funding_txo);
45358         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
45359         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
45360         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
45361         LDKChannelId channel_id_conv;
45362         channel_id_conv.inner = untag_ptr(channel_id);
45363         channel_id_conv.is_owned = ptr_is_owned(channel_id);
45364         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
45365         channel_id_conv = ChannelId_clone(&channel_id_conv);
45366         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45367         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
45368         int64_t ret_ref = tag_ptr(ret_copy, true);
45369         return ret_ref;
45370 }
45371
45372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45373         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
45374         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
45375         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
45376         return ret_conv;
45377 }
45378
45379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
45380         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
45381         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
45382         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45383         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45384         CVec_u8Z_free(ret_var);
45385         return ret_arr;
45386 }
45387
45388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45389         LDKu8slice ser_ref;
45390         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45391         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45392         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
45393         *ret_conv = MonitorEvent_read(ser_ref);
45394         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45395         return tag_ptr(ret_conv, true);
45396 }
45397
45398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45399         LDKHTLCUpdate this_obj_conv;
45400         this_obj_conv.inner = untag_ptr(this_obj);
45401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45403         HTLCUpdate_free(this_obj_conv);
45404 }
45405
45406 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
45407         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
45408         int64_t ret_ref = 0;
45409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45411         return ret_ref;
45412 }
45413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45414         LDKHTLCUpdate arg_conv;
45415         arg_conv.inner = untag_ptr(arg);
45416         arg_conv.is_owned = ptr_is_owned(arg);
45417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45418         arg_conv.is_owned = false;
45419         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
45420         return ret_conv;
45421 }
45422
45423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45424         LDKHTLCUpdate orig_conv;
45425         orig_conv.inner = untag_ptr(orig);
45426         orig_conv.is_owned = ptr_is_owned(orig);
45427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45428         orig_conv.is_owned = false;
45429         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
45430         int64_t ret_ref = 0;
45431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45433         return ret_ref;
45434 }
45435
45436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45437         LDKHTLCUpdate a_conv;
45438         a_conv.inner = untag_ptr(a);
45439         a_conv.is_owned = ptr_is_owned(a);
45440         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45441         a_conv.is_owned = false;
45442         LDKHTLCUpdate b_conv;
45443         b_conv.inner = untag_ptr(b);
45444         b_conv.is_owned = ptr_is_owned(b);
45445         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45446         b_conv.is_owned = false;
45447         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
45448         return ret_conv;
45449 }
45450
45451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
45452         LDKHTLCUpdate obj_conv;
45453         obj_conv.inner = untag_ptr(obj);
45454         obj_conv.is_owned = ptr_is_owned(obj);
45455         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45456         obj_conv.is_owned = false;
45457         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
45458         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45459         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45460         CVec_u8Z_free(ret_var);
45461         return ret_arr;
45462 }
45463
45464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45465         LDKu8slice ser_ref;
45466         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45467         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45468         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
45469         *ret_conv = HTLCUpdate_read(ser_ref);
45470         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45471         return tag_ptr(ret_conv, true);
45472 }
45473
45474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45475         if (!ptr_is_owned(this_ptr)) return;
45476         void* this_ptr_ptr = untag_ptr(this_ptr);
45477         CHECK_ACCESS(this_ptr_ptr);
45478         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
45479         FREE(untag_ptr(this_ptr));
45480         Balance_free(this_ptr_conv);
45481 }
45482
45483 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
45484         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45485         *ret_copy = Balance_clone(arg);
45486         int64_t ret_ref = tag_ptr(ret_copy, true);
45487         return ret_ref;
45488 }
45489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45490         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
45491         int64_t ret_conv = Balance_clone_ptr(arg_conv);
45492         return ret_conv;
45493 }
45494
45495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45496         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
45497         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45498         *ret_copy = Balance_clone(orig_conv);
45499         int64_t ret_ref = tag_ptr(ret_copy, true);
45500         return ret_ref;
45501 }
45502
45503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
45504         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45505         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
45506         int64_t ret_ref = tag_ptr(ret_copy, true);
45507         return ret_ref;
45508 }
45509
45510 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) {
45511         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45512         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
45513         int64_t ret_ref = tag_ptr(ret_copy, true);
45514         return ret_ref;
45515 }
45516
45517 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) {
45518         LDKThirtyTwoBytes payment_hash_ref;
45519         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45520         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
45521         LDKThirtyTwoBytes payment_preimage_ref;
45522         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
45523         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
45524         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45525         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
45526         int64_t ret_ref = tag_ptr(ret_copy, true);
45527         return ret_ref;
45528 }
45529
45530 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) {
45531         LDKThirtyTwoBytes payment_hash_ref;
45532         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45533         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
45534         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45535         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
45536         int64_t ret_ref = tag_ptr(ret_copy, true);
45537         return ret_ref;
45538 }
45539
45540 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) {
45541         LDKThirtyTwoBytes payment_hash_ref;
45542         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45543         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
45544         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45545         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
45546         int64_t ret_ref = tag_ptr(ret_copy, true);
45547         return ret_ref;
45548 }
45549
45550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
45551         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45552         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
45553         int64_t ret_ref = tag_ptr(ret_copy, true);
45554         return ret_ref;
45555 }
45556
45557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45558         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
45559         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
45560         jboolean ret_conv = Balance_eq(a_conv, b_conv);
45561         return ret_conv;
45562 }
45563
45564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
45565         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
45566         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
45567         return ret_conv;
45568 }
45569
45570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45571         LDKChannelMonitor this_obj_conv;
45572         this_obj_conv.inner = untag_ptr(this_obj);
45573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45575         ChannelMonitor_free(this_obj_conv);
45576 }
45577
45578 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
45579         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
45580         int64_t ret_ref = 0;
45581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45583         return ret_ref;
45584 }
45585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45586         LDKChannelMonitor arg_conv;
45587         arg_conv.inner = untag_ptr(arg);
45588         arg_conv.is_owned = ptr_is_owned(arg);
45589         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45590         arg_conv.is_owned = false;
45591         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
45592         return ret_conv;
45593 }
45594
45595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45596         LDKChannelMonitor orig_conv;
45597         orig_conv.inner = untag_ptr(orig);
45598         orig_conv.is_owned = ptr_is_owned(orig);
45599         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45600         orig_conv.is_owned = false;
45601         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
45602         int64_t ret_ref = 0;
45603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45605         return ret_ref;
45606 }
45607
45608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
45609         LDKChannelMonitor obj_conv;
45610         obj_conv.inner = untag_ptr(obj);
45611         obj_conv.is_owned = ptr_is_owned(obj);
45612         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45613         obj_conv.is_owned = false;
45614         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
45615         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45616         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45617         CVec_u8Z_free(ret_var);
45618         return ret_arr;
45619 }
45620
45621 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) {
45622         LDKChannelMonitor this_arg_conv;
45623         this_arg_conv.inner = untag_ptr(this_arg);
45624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45626         this_arg_conv.is_owned = false;
45627         LDKChannelMonitorUpdate updates_conv;
45628         updates_conv.inner = untag_ptr(updates);
45629         updates_conv.is_owned = ptr_is_owned(updates);
45630         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
45631         updates_conv.is_owned = false;
45632         void* broadcaster_ptr = untag_ptr(broadcaster);
45633         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
45634         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
45635         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45636         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
45637         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
45638         void* logger_ptr = untag_ptr(logger);
45639         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45640         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45641         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
45642         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45643         return tag_ptr(ret_conv, true);
45644 }
45645
45646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45647         LDKChannelMonitor this_arg_conv;
45648         this_arg_conv.inner = untag_ptr(this_arg);
45649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45651         this_arg_conv.is_owned = false;
45652         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
45653         return ret_conv;
45654 }
45655
45656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
45657         LDKChannelMonitor this_arg_conv;
45658         this_arg_conv.inner = untag_ptr(this_arg);
45659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45661         this_arg_conv.is_owned = false;
45662         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
45663         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
45664         return tag_ptr(ret_conv, true);
45665 }
45666
45667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45668         LDKChannelMonitor this_arg_conv;
45669         this_arg_conv.inner = untag_ptr(this_arg);
45670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45672         this_arg_conv.is_owned = false;
45673         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
45674         int64_t ret_ref = 0;
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45677         return ret_ref;
45678 }
45679
45680 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
45681         LDKChannelMonitor this_arg_conv;
45682         this_arg_conv.inner = untag_ptr(this_arg);
45683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45685         this_arg_conv.is_owned = false;
45686         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
45687         int64_tArray ret_arr = NULL;
45688         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45689         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45690         for (size_t a = 0; a < ret_var.datalen; a++) {
45691                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
45692                 *ret_conv_52_conv = ret_var.data[a];
45693                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
45694         }
45695         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45696         FREE(ret_var.data);
45697         return ret_arr;
45698 }
45699
45700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter, int64_t logger) {
45701         LDKChannelMonitor this_arg_conv;
45702         this_arg_conv.inner = untag_ptr(this_arg);
45703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45705         this_arg_conv.is_owned = false;
45706         void* filter_ptr = untag_ptr(filter);
45707         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
45708         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
45709         void* logger_ptr = untag_ptr(logger);
45710         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45711         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45712         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
45713 }
45714
45715 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
45716         LDKChannelMonitor this_arg_conv;
45717         this_arg_conv.inner = untag_ptr(this_arg);
45718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45720         this_arg_conv.is_owned = false;
45721         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
45722         int64_tArray ret_arr = NULL;
45723         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45724         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45725         for (size_t o = 0; o < ret_var.datalen; o++) {
45726                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45727                 *ret_conv_14_copy = ret_var.data[o];
45728                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
45729                 ret_arr_ptr[o] = ret_conv_14_ref;
45730         }
45731         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45732         FREE(ret_var.data);
45733         return ret_arr;
45734 }
45735
45736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
45737         LDKChannelMonitor this_arg_conv;
45738         this_arg_conv.inner = untag_ptr(this_arg);
45739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45741         this_arg_conv.is_owned = false;
45742         void* handler_ptr = untag_ptr(handler);
45743         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
45744         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
45745         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
45746 }
45747
45748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
45749         LDKChannelMonitor this_arg_conv;
45750         this_arg_conv.inner = untag_ptr(this_arg);
45751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45753         this_arg_conv.is_owned = false;
45754         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
45755         int64_t ret_ref = 0;
45756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45758         return ret_ref;
45759 }
45760
45761 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) {
45762         LDKChannelMonitor this_arg_conv;
45763         this_arg_conv.inner = untag_ptr(this_arg);
45764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45766         this_arg_conv.is_owned = false;
45767         LDKChannelMonitorUpdate update_conv;
45768         update_conv.inner = untag_ptr(update);
45769         update_conv.is_owned = ptr_is_owned(update);
45770         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
45771         update_conv.is_owned = false;
45772         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
45773         int64_tArray ret_arr = NULL;
45774         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45775         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45776         for (size_t x = 0; x < ret_var.datalen; x++) {
45777                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
45778                 int64_t ret_conv_23_ref = 0;
45779                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
45780                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
45781                 ret_arr_ptr[x] = ret_conv_23_ref;
45782         }
45783         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45784         FREE(ret_var.data);
45785         return ret_arr;
45786 }
45787
45788 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) {
45789         LDKChannelMonitor this_arg_conv;
45790         this_arg_conv.inner = untag_ptr(this_arg);
45791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45793         this_arg_conv.is_owned = false;
45794         LDKTransaction justice_tx_ref;
45795         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
45796         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
45797         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
45798         justice_tx_ref.data_is_owned = true;
45799         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
45800         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
45801         return tag_ptr(ret_conv, true);
45802 }
45803
45804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45805         LDKChannelMonitor this_arg_conv;
45806         this_arg_conv.inner = untag_ptr(this_arg);
45807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45809         this_arg_conv.is_owned = false;
45810         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45811         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
45812         return ret_arr;
45813 }
45814
45815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1broadcast_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
45816         LDKChannelMonitor this_arg_conv;
45817         this_arg_conv.inner = untag_ptr(this_arg);
45818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45820         this_arg_conv.is_owned = false;
45821         void* broadcaster_ptr = untag_ptr(broadcaster);
45822         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
45823         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
45824         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45825         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
45826         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
45827         void* logger_ptr = untag_ptr(logger);
45828         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45829         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45830         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45831 }
45832
45833 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) {
45834         LDKChannelMonitor this_arg_conv;
45835         this_arg_conv.inner = untag_ptr(this_arg);
45836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45838         this_arg_conv.is_owned = false;
45839         uint8_t header_arr[80];
45840         CHECK((*env)->GetArrayLength(env, header) == 80);
45841         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45842         uint8_t (*header_ref)[80] = &header_arr;
45843         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
45844         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
45845         if (txdata_constr.datalen > 0)
45846                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
45847         else
45848                 txdata_constr.data = NULL;
45849         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
45850         for (size_t c = 0; c < txdata_constr.datalen; c++) {
45851                 int64_t txdata_conv_28 = txdata_vals[c];
45852                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
45853                 CHECK_ACCESS(txdata_conv_28_ptr);
45854                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
45855                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
45856                 txdata_constr.data[c] = txdata_conv_28_conv;
45857         }
45858         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
45859         void* broadcaster_ptr = untag_ptr(broadcaster);
45860         CHECK_ACCESS(broadcaster_ptr);
45861         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45862         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45864                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45865         }
45866         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45867         CHECK_ACCESS(fee_estimator_ptr);
45868         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45869         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45870                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45871                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45872         }
45873         void* logger_ptr = untag_ptr(logger);
45874         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45875         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45876         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);
45877         int64_tArray ret_arr = NULL;
45878         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45879         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45880         for (size_t x = 0; x < ret_var.datalen; x++) {
45881                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45882                 *ret_conv_49_conv = ret_var.data[x];
45883                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45884         }
45885         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45886         FREE(ret_var.data);
45887         return ret_arr;
45888 }
45889
45890 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) {
45891         LDKChannelMonitor this_arg_conv;
45892         this_arg_conv.inner = untag_ptr(this_arg);
45893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45895         this_arg_conv.is_owned = false;
45896         uint8_t header_arr[80];
45897         CHECK((*env)->GetArrayLength(env, header) == 80);
45898         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45899         uint8_t (*header_ref)[80] = &header_arr;
45900         void* broadcaster_ptr = untag_ptr(broadcaster);
45901         CHECK_ACCESS(broadcaster_ptr);
45902         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45903         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45905                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45906         }
45907         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45908         CHECK_ACCESS(fee_estimator_ptr);
45909         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45910         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45911                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45912                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45913         }
45914         void* logger_ptr = untag_ptr(logger);
45915         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45916         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45917         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
45918 }
45919
45920 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) {
45921         LDKChannelMonitor this_arg_conv;
45922         this_arg_conv.inner = untag_ptr(this_arg);
45923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45925         this_arg_conv.is_owned = false;
45926         uint8_t header_arr[80];
45927         CHECK((*env)->GetArrayLength(env, header) == 80);
45928         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45929         uint8_t (*header_ref)[80] = &header_arr;
45930         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
45931         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
45932         if (txdata_constr.datalen > 0)
45933                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
45934         else
45935                 txdata_constr.data = NULL;
45936         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
45937         for (size_t c = 0; c < txdata_constr.datalen; c++) {
45938                 int64_t txdata_conv_28 = txdata_vals[c];
45939                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
45940                 CHECK_ACCESS(txdata_conv_28_ptr);
45941                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
45942                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
45943                 txdata_constr.data[c] = txdata_conv_28_conv;
45944         }
45945         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
45946         void* broadcaster_ptr = untag_ptr(broadcaster);
45947         CHECK_ACCESS(broadcaster_ptr);
45948         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45949         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45951                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45952         }
45953         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45954         CHECK_ACCESS(fee_estimator_ptr);
45955         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45956         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45957                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45958                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45959         }
45960         void* logger_ptr = untag_ptr(logger);
45961         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45962         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45963         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);
45964         int64_tArray ret_arr = NULL;
45965         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45966         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45967         for (size_t x = 0; x < ret_var.datalen; x++) {
45968                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45969                 *ret_conv_49_conv = ret_var.data[x];
45970                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45971         }
45972         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45973         FREE(ret_var.data);
45974         return ret_arr;
45975 }
45976
45977 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) {
45978         LDKChannelMonitor this_arg_conv;
45979         this_arg_conv.inner = untag_ptr(this_arg);
45980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45982         this_arg_conv.is_owned = false;
45983         uint8_t txid_arr[32];
45984         CHECK((*env)->GetArrayLength(env, txid) == 32);
45985         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
45986         uint8_t (*txid_ref)[32] = &txid_arr;
45987         void* broadcaster_ptr = untag_ptr(broadcaster);
45988         CHECK_ACCESS(broadcaster_ptr);
45989         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45990         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45992                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45993         }
45994         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45995         CHECK_ACCESS(fee_estimator_ptr);
45996         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45997         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45999                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
46000         }
46001         void* logger_ptr = untag_ptr(logger);
46002         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
46003         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
46004         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
46005 }
46006
46007 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) {
46008         LDKChannelMonitor this_arg_conv;
46009         this_arg_conv.inner = untag_ptr(this_arg);
46010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46012         this_arg_conv.is_owned = false;
46013         uint8_t header_arr[80];
46014         CHECK((*env)->GetArrayLength(env, header) == 80);
46015         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
46016         uint8_t (*header_ref)[80] = &header_arr;
46017         void* broadcaster_ptr = untag_ptr(broadcaster);
46018         CHECK_ACCESS(broadcaster_ptr);
46019         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
46020         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
46021                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46022                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
46023         }
46024         void* fee_estimator_ptr = untag_ptr(fee_estimator);
46025         CHECK_ACCESS(fee_estimator_ptr);
46026         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
46027         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
46028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46029                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
46030         }
46031         void* logger_ptr = untag_ptr(logger);
46032         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
46033         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
46034         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
46035         int64_tArray ret_arr = NULL;
46036         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46037         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46038         for (size_t x = 0; x < ret_var.datalen; x++) {
46039                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
46040                 *ret_conv_49_conv = ret_var.data[x];
46041                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
46042         }
46043         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46044         FREE(ret_var.data);
46045         return ret_arr;
46046 }
46047
46048 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
46049         LDKChannelMonitor this_arg_conv;
46050         this_arg_conv.inner = untag_ptr(this_arg);
46051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46053         this_arg_conv.is_owned = false;
46054         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
46055         int64_tArray ret_arr = NULL;
46056         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46057         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46058         for (size_t c = 0; c < ret_var.datalen; c++) {
46059                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
46060                 *ret_conv_54_conv = ret_var.data[c];
46061                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
46062         }
46063         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46064         FREE(ret_var.data);
46065         return ret_arr;
46066 }
46067
46068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
46069         LDKChannelMonitor this_arg_conv;
46070         this_arg_conv.inner = untag_ptr(this_arg);
46071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46073         this_arg_conv.is_owned = false;
46074         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
46075         int64_t ret_ref = 0;
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46078         return ret_ref;
46079 }
46080
46081 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) {
46082         LDKChannelMonitor this_arg_conv;
46083         this_arg_conv.inner = untag_ptr(this_arg);
46084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46086         this_arg_conv.is_owned = false;
46087         void* broadcaster_ptr = untag_ptr(broadcaster);
46088         CHECK_ACCESS(broadcaster_ptr);
46089         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
46090         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
46091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46092                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
46093         }
46094         void* fee_estimator_ptr = untag_ptr(fee_estimator);
46095         CHECK_ACCESS(fee_estimator_ptr);
46096         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
46097         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
46098                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46099                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
46100         }
46101         void* logger_ptr = untag_ptr(logger);
46102         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
46103         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
46104         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
46105 }
46106
46107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1signer_1unblocked(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
46108         LDKChannelMonitor this_arg_conv;
46109         this_arg_conv.inner = untag_ptr(this_arg);
46110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46112         this_arg_conv.is_owned = false;
46113         void* broadcaster_ptr = untag_ptr(broadcaster);
46114         CHECK_ACCESS(broadcaster_ptr);
46115         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
46116         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
46117                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46118                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
46119         }
46120         void* fee_estimator_ptr = untag_ptr(fee_estimator);
46121         CHECK_ACCESS(fee_estimator_ptr);
46122         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
46123         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
46124                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46125                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
46126         }
46127         void* logger_ptr = untag_ptr(logger);
46128         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
46129         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
46130         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
46131 }
46132
46133 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) {
46134         LDKChannelMonitor this_arg_conv;
46135         this_arg_conv.inner = untag_ptr(this_arg);
46136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46138         this_arg_conv.is_owned = false;
46139         LDKTransaction tx_ref;
46140         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
46141         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
46142         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
46143         tx_ref.data_is_owned = true;
46144         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
46145         int64_tArray ret_arr = NULL;
46146         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46147         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46148         for (size_t b = 0; b < ret_var.datalen; b++) {
46149                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
46150                 *ret_conv_27_copy = ret_var.data[b];
46151                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
46152                 ret_arr_ptr[b] = ret_conv_27_ref;
46153         }
46154         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46155         FREE(ret_var.data);
46156         return ret_arr;
46157 }
46158
46159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1is_1fully_1resolved(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
46160         LDKChannelMonitor this_arg_conv;
46161         this_arg_conv.inner = untag_ptr(this_arg);
46162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46164         this_arg_conv.is_owned = false;
46165         void* logger_ptr = untag_ptr(logger);
46166         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
46167         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
46168         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
46169         return ret_conv;
46170 }
46171
46172 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
46173         LDKChannelMonitor this_arg_conv;
46174         this_arg_conv.inner = untag_ptr(this_arg);
46175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46177         this_arg_conv.is_owned = false;
46178         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
46179         int64_tArray ret_arr = NULL;
46180         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46181         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46182         for (size_t j = 0; j < ret_var.datalen; j++) {
46183                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
46184                 *ret_conv_9_copy = ret_var.data[j];
46185                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
46186                 ret_arr_ptr[j] = ret_conv_9_ref;
46187         }
46188         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46189         FREE(ret_var.data);
46190         return ret_arr;
46191 }
46192
46193 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) {
46194         LDKu8slice ser_ref;
46195         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46196         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46197         void* arg_a_ptr = untag_ptr(arg_a);
46198         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
46199         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
46200         void* arg_b_ptr = untag_ptr(arg_b);
46201         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
46202         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
46203         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
46204         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
46205         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46206         return tag_ptr(ret_conv, true);
46207 }
46208
46209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46210         LDKOutPoint this_obj_conv;
46211         this_obj_conv.inner = untag_ptr(this_obj);
46212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46214         OutPoint_free(this_obj_conv);
46215 }
46216
46217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
46218         LDKOutPoint this_ptr_conv;
46219         this_ptr_conv.inner = untag_ptr(this_ptr);
46220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46222         this_ptr_conv.is_owned = false;
46223         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
46225         return ret_arr;
46226 }
46227
46228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46229         LDKOutPoint this_ptr_conv;
46230         this_ptr_conv.inner = untag_ptr(this_ptr);
46231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46233         this_ptr_conv.is_owned = false;
46234         LDKThirtyTwoBytes val_ref;
46235         CHECK((*env)->GetArrayLength(env, val) == 32);
46236         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46237         OutPoint_set_txid(&this_ptr_conv, val_ref);
46238 }
46239
46240 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
46241         LDKOutPoint this_ptr_conv;
46242         this_ptr_conv.inner = untag_ptr(this_ptr);
46243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46245         this_ptr_conv.is_owned = false;
46246         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
46247         return ret_conv;
46248 }
46249
46250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46251         LDKOutPoint this_ptr_conv;
46252         this_ptr_conv.inner = untag_ptr(this_ptr);
46253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255         this_ptr_conv.is_owned = false;
46256         OutPoint_set_index(&this_ptr_conv, val);
46257 }
46258
46259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
46260         LDKThirtyTwoBytes txid_arg_ref;
46261         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
46262         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
46263         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
46264         int64_t ret_ref = 0;
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46267         return ret_ref;
46268 }
46269
46270 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
46271         LDKOutPoint ret_var = OutPoint_clone(arg);
46272         int64_t ret_ref = 0;
46273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46275         return ret_ref;
46276 }
46277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46278         LDKOutPoint arg_conv;
46279         arg_conv.inner = untag_ptr(arg);
46280         arg_conv.is_owned = ptr_is_owned(arg);
46281         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46282         arg_conv.is_owned = false;
46283         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
46284         return ret_conv;
46285 }
46286
46287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46288         LDKOutPoint orig_conv;
46289         orig_conv.inner = untag_ptr(orig);
46290         orig_conv.is_owned = ptr_is_owned(orig);
46291         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46292         orig_conv.is_owned = false;
46293         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
46294         int64_t ret_ref = 0;
46295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46297         return ret_ref;
46298 }
46299
46300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46301         LDKOutPoint a_conv;
46302         a_conv.inner = untag_ptr(a);
46303         a_conv.is_owned = ptr_is_owned(a);
46304         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46305         a_conv.is_owned = false;
46306         LDKOutPoint b_conv;
46307         b_conv.inner = untag_ptr(b);
46308         b_conv.is_owned = ptr_is_owned(b);
46309         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46310         b_conv.is_owned = false;
46311         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
46312         return ret_conv;
46313 }
46314
46315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
46316         LDKOutPoint o_conv;
46317         o_conv.inner = untag_ptr(o);
46318         o_conv.is_owned = ptr_is_owned(o);
46319         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46320         o_conv.is_owned = false;
46321         int64_t ret_conv = OutPoint_hash(&o_conv);
46322         return ret_conv;
46323 }
46324
46325 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46326         LDKOutPoint o_conv;
46327         o_conv.inner = untag_ptr(o);
46328         o_conv.is_owned = ptr_is_owned(o);
46329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46330         o_conv.is_owned = false;
46331         LDKStr ret_str = OutPoint_to_str(&o_conv);
46332         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46333         Str_free(ret_str);
46334         return ret_conv;
46335 }
46336
46337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
46338         LDKOutPoint obj_conv;
46339         obj_conv.inner = untag_ptr(obj);
46340         obj_conv.is_owned = ptr_is_owned(obj);
46341         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46342         obj_conv.is_owned = false;
46343         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
46344         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46345         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46346         CVec_u8Z_free(ret_var);
46347         return ret_arr;
46348 }
46349
46350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46351         LDKu8slice ser_ref;
46352         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46353         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46354         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
46355         *ret_conv = OutPoint_read(ser_ref);
46356         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46357         return tag_ptr(ret_conv, true);
46358 }
46359
46360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46361         LDKInboundHTLCErr this_obj_conv;
46362         this_obj_conv.inner = untag_ptr(this_obj);
46363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46365         InboundHTLCErr_free(this_obj_conv);
46366 }
46367
46368 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
46369         LDKInboundHTLCErr this_ptr_conv;
46370         this_ptr_conv.inner = untag_ptr(this_ptr);
46371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46373         this_ptr_conv.is_owned = false;
46374         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
46375         return ret_conv;
46376 }
46377
46378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46379         LDKInboundHTLCErr this_ptr_conv;
46380         this_ptr_conv.inner = untag_ptr(this_ptr);
46381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46383         this_ptr_conv.is_owned = false;
46384         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
46385 }
46386
46387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46388         LDKInboundHTLCErr this_ptr_conv;
46389         this_ptr_conv.inner = untag_ptr(this_ptr);
46390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46392         this_ptr_conv.is_owned = false;
46393         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
46394         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46395         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46396         CVec_u8Z_free(ret_var);
46397         return ret_arr;
46398 }
46399
46400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46401         LDKInboundHTLCErr this_ptr_conv;
46402         this_ptr_conv.inner = untag_ptr(this_ptr);
46403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46405         this_ptr_conv.is_owned = false;
46406         LDKCVec_u8Z val_ref;
46407         val_ref.datalen = (*env)->GetArrayLength(env, val);
46408         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46409         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46410         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
46411 }
46412
46413 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1msg(JNIEnv *env, jclass clz, int64_t this_ptr) {
46414         LDKInboundHTLCErr 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         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
46420         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46421         Str_free(ret_str);
46422         return ret_conv;
46423 }
46424
46425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1msg(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
46426         LDKInboundHTLCErr this_ptr_conv;
46427         this_ptr_conv.inner = untag_ptr(this_ptr);
46428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46430         this_ptr_conv.is_owned = false;
46431         LDKStr val_conv = java_to_owned_str(env, val);
46432         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
46433 }
46434
46435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1new(JNIEnv *env, jclass clz, int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
46436         LDKCVec_u8Z err_data_arg_ref;
46437         err_data_arg_ref.datalen = (*env)->GetArrayLength(env, err_data_arg);
46438         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46439         (*env)->GetByteArrayRegion(env, err_data_arg, 0, err_data_arg_ref.datalen, err_data_arg_ref.data);
46440         LDKStr msg_arg_conv = java_to_owned_str(env, msg_arg);
46441         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
46442         int64_t ret_ref = 0;
46443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46445         return ret_ref;
46446 }
46447
46448 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
46449         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
46450         int64_t ret_ref = 0;
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46453         return ret_ref;
46454 }
46455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46456         LDKInboundHTLCErr arg_conv;
46457         arg_conv.inner = untag_ptr(arg);
46458         arg_conv.is_owned = ptr_is_owned(arg);
46459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46460         arg_conv.is_owned = false;
46461         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
46462         return ret_conv;
46463 }
46464
46465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46466         LDKInboundHTLCErr orig_conv;
46467         orig_conv.inner = untag_ptr(orig);
46468         orig_conv.is_owned = ptr_is_owned(orig);
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46470         orig_conv.is_owned = false;
46471         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
46472         int64_t ret_ref = 0;
46473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46475         return ret_ref;
46476 }
46477
46478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1hash(JNIEnv *env, jclass clz, int64_t o) {
46479         LDKInboundHTLCErr o_conv;
46480         o_conv.inner = untag_ptr(o);
46481         o_conv.is_owned = ptr_is_owned(o);
46482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46483         o_conv.is_owned = false;
46484         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
46485         return ret_conv;
46486 }
46487
46488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46489         LDKInboundHTLCErr a_conv;
46490         a_conv.inner = untag_ptr(a);
46491         a_conv.is_owned = ptr_is_owned(a);
46492         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46493         a_conv.is_owned = false;
46494         LDKInboundHTLCErr b_conv;
46495         b_conv.inner = untag_ptr(b);
46496         b_conv.is_owned = ptr_is_owned(b);
46497         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46498         b_conv.is_owned = false;
46499         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
46500         return ret_conv;
46501 }
46502
46503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1payment_1onion(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
46504         LDKUpdateAddHTLC msg_conv;
46505         msg_conv.inner = untag_ptr(msg);
46506         msg_conv.is_owned = ptr_is_owned(msg);
46507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
46508         msg_conv.is_owned = false;
46509         void* node_signer_ptr = untag_ptr(node_signer);
46510         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
46511         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
46512         void* logger_ptr = untag_ptr(logger);
46513         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
46514         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
46515         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
46516         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
46517         return tag_ptr(ret_conv, true);
46518 }
46519
46520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46521         if (!ptr_is_owned(this_ptr)) return;
46522         void* this_ptr_ptr = untag_ptr(this_ptr);
46523         CHECK_ACCESS(this_ptr_ptr);
46524         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
46525         FREE(untag_ptr(this_ptr));
46526         PendingHTLCRouting_free(this_ptr_conv);
46527 }
46528
46529 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
46530         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46531         *ret_copy = PendingHTLCRouting_clone(arg);
46532         int64_t ret_ref = tag_ptr(ret_copy, true);
46533         return ret_ref;
46534 }
46535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46536         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
46537         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
46538         return ret_conv;
46539 }
46540
46541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46542         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
46543         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46544         *ret_copy = PendingHTLCRouting_clone(orig_conv);
46545         int64_t ret_ref = tag_ptr(ret_copy, true);
46546         return ret_ref;
46547 }
46548
46549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1forward(JNIEnv *env, jclass clz, int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
46550         LDKOnionPacket onion_packet_conv;
46551         onion_packet_conv.inner = untag_ptr(onion_packet);
46552         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
46553         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
46554         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
46555         LDKBlindedForward blinded_conv;
46556         blinded_conv.inner = untag_ptr(blinded);
46557         blinded_conv.is_owned = ptr_is_owned(blinded);
46558         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
46559         blinded_conv = BlindedForward_clone(&blinded_conv);
46560         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46561         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
46562         int64_t ret_ref = tag_ptr(ret_copy, true);
46563         return ret_ref;
46564 }
46565
46566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive(JNIEnv *env, jclass clz, int64_t payment_data, int64_t payment_metadata, int64_t payment_context, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
46567         LDKFinalOnionHopData payment_data_conv;
46568         payment_data_conv.inner = untag_ptr(payment_data);
46569         payment_data_conv.is_owned = ptr_is_owned(payment_data);
46570         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
46571         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
46572         void* payment_metadata_ptr = untag_ptr(payment_metadata);
46573         CHECK_ACCESS(payment_metadata_ptr);
46574         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
46575         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
46576         void* payment_context_ptr = untag_ptr(payment_context);
46577         CHECK_ACCESS(payment_context_ptr);
46578         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
46579         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
46580         LDKThirtyTwoBytes phantom_shared_secret_ref;
46581         CHECK((*env)->GetArrayLength(env, phantom_shared_secret) == 32);
46582         (*env)->GetByteArrayRegion(env, phantom_shared_secret, 0, 32, phantom_shared_secret_ref.data);
46583         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
46584         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
46585         if (custom_tlvs_constr.datalen > 0)
46586                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
46587         else
46588                 custom_tlvs_constr.data = NULL;
46589         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
46590         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
46591                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
46592                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
46593                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
46594                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
46595                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
46596                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
46597         }
46598         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
46599         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46600         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, payment_context_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
46601         int64_t ret_ref = tag_ptr(ret_copy, true);
46602         return ret_ref;
46603 }
46604
46605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive_1keysend(JNIEnv *env, jclass clz, int64_t payment_data, int8_tArray payment_preimage, int64_t payment_metadata, int32_t incoming_cltv_expiry, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
46606         LDKFinalOnionHopData payment_data_conv;
46607         payment_data_conv.inner = untag_ptr(payment_data);
46608         payment_data_conv.is_owned = ptr_is_owned(payment_data);
46609         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
46610         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
46611         LDKThirtyTwoBytes payment_preimage_ref;
46612         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
46613         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
46614         void* payment_metadata_ptr = untag_ptr(payment_metadata);
46615         CHECK_ACCESS(payment_metadata_ptr);
46616         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
46617         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
46618         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
46619         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
46620         if (custom_tlvs_constr.datalen > 0)
46621                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
46622         else
46623                 custom_tlvs_constr.data = NULL;
46624         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
46625         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
46626                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
46627                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
46628                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
46629                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
46630                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
46631                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
46632         }
46633         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
46634         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46635         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
46636         int64_t ret_ref = tag_ptr(ret_copy, true);
46637         return ret_ref;
46638 }
46639
46640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46641         LDKBlindedForward this_obj_conv;
46642         this_obj_conv.inner = untag_ptr(this_obj);
46643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46645         BlindedForward_free(this_obj_conv);
46646 }
46647
46648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
46649         LDKBlindedForward this_ptr_conv;
46650         this_ptr_conv.inner = untag_ptr(this_ptr);
46651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46653         this_ptr_conv.is_owned = false;
46654         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46655         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form);
46656         return ret_arr;
46657 }
46658
46659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46660         LDKBlindedForward this_ptr_conv;
46661         this_ptr_conv.inner = untag_ptr(this_ptr);
46662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46664         this_ptr_conv.is_owned = false;
46665         LDKPublicKey val_ref;
46666         CHECK((*env)->GetArrayLength(env, val) == 33);
46667         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46668         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
46669 }
46670
46671 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1failure(JNIEnv *env, jclass clz, int64_t this_ptr) {
46672         LDKBlindedForward this_ptr_conv;
46673         this_ptr_conv.inner = untag_ptr(this_ptr);
46674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46676         this_ptr_conv.is_owned = false;
46677         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedForward_get_failure(&this_ptr_conv));
46678         return ret_conv;
46679 }
46680
46681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1failure(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
46682         LDKBlindedForward this_ptr_conv;
46683         this_ptr_conv.inner = untag_ptr(this_ptr);
46684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46686         this_ptr_conv.is_owned = false;
46687         LDKBlindedFailure val_conv = LDKBlindedFailure_from_java(env, val);
46688         BlindedForward_set_failure(&this_ptr_conv, val_conv);
46689 }
46690
46691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1new(JNIEnv *env, jclass clz, int8_tArray inbound_blinding_point_arg, jclass failure_arg) {
46692         LDKPublicKey inbound_blinding_point_arg_ref;
46693         CHECK((*env)->GetArrayLength(env, inbound_blinding_point_arg) == 33);
46694         (*env)->GetByteArrayRegion(env, inbound_blinding_point_arg, 0, 33, inbound_blinding_point_arg_ref.compressed_form);
46695         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_java(env, failure_arg);
46696         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
46697         int64_t ret_ref = 0;
46698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46700         return ret_ref;
46701 }
46702
46703 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
46704         LDKBlindedForward ret_var = BlindedForward_clone(arg);
46705         int64_t ret_ref = 0;
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46708         return ret_ref;
46709 }
46710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46711         LDKBlindedForward arg_conv;
46712         arg_conv.inner = untag_ptr(arg);
46713         arg_conv.is_owned = ptr_is_owned(arg);
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46715         arg_conv.is_owned = false;
46716         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
46717         return ret_conv;
46718 }
46719
46720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46721         LDKBlindedForward orig_conv;
46722         orig_conv.inner = untag_ptr(orig);
46723         orig_conv.is_owned = ptr_is_owned(orig);
46724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46725         orig_conv.is_owned = false;
46726         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
46727         int64_t ret_ref = 0;
46728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46730         return ret_ref;
46731 }
46732
46733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1hash(JNIEnv *env, jclass clz, int64_t o) {
46734         LDKBlindedForward o_conv;
46735         o_conv.inner = untag_ptr(o);
46736         o_conv.is_owned = ptr_is_owned(o);
46737         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46738         o_conv.is_owned = false;
46739         int64_t ret_conv = BlindedForward_hash(&o_conv);
46740         return ret_conv;
46741 }
46742
46743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedForward_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46744         LDKBlindedForward a_conv;
46745         a_conv.inner = untag_ptr(a);
46746         a_conv.is_owned = ptr_is_owned(a);
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46748         a_conv.is_owned = false;
46749         LDKBlindedForward b_conv;
46750         b_conv.inner = untag_ptr(b);
46751         b_conv.is_owned = ptr_is_owned(b);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46753         b_conv.is_owned = false;
46754         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
46755         return ret_conv;
46756 }
46757
46758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46759         LDKPendingHTLCInfo this_obj_conv;
46760         this_obj_conv.inner = untag_ptr(this_obj);
46761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46763         PendingHTLCInfo_free(this_obj_conv);
46764 }
46765
46766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1routing(JNIEnv *env, jclass clz, int64_t this_ptr) {
46767         LDKPendingHTLCInfo this_ptr_conv;
46768         this_ptr_conv.inner = untag_ptr(this_ptr);
46769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46771         this_ptr_conv.is_owned = false;
46772         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46773         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
46774         int64_t ret_ref = tag_ptr(ret_copy, true);
46775         return ret_ref;
46776 }
46777
46778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1routing(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46779         LDKPendingHTLCInfo this_ptr_conv;
46780         this_ptr_conv.inner = untag_ptr(this_ptr);
46781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46783         this_ptr_conv.is_owned = false;
46784         void* val_ptr = untag_ptr(val);
46785         CHECK_ACCESS(val_ptr);
46786         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
46787         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
46788         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
46789 }
46790
46791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
46792         LDKPendingHTLCInfo this_ptr_conv;
46793         this_ptr_conv.inner = untag_ptr(this_ptr);
46794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46796         this_ptr_conv.is_owned = false;
46797         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46798         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv));
46799         return ret_arr;
46800 }
46801
46802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46803         LDKPendingHTLCInfo this_ptr_conv;
46804         this_ptr_conv.inner = untag_ptr(this_ptr);
46805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46807         this_ptr_conv.is_owned = false;
46808         LDKThirtyTwoBytes val_ref;
46809         CHECK((*env)->GetArrayLength(env, val) == 32);
46810         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46811         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
46812 }
46813
46814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46815         LDKPendingHTLCInfo this_ptr_conv;
46816         this_ptr_conv.inner = untag_ptr(this_ptr);
46817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46819         this_ptr_conv.is_owned = false;
46820         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46821         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv));
46822         return ret_arr;
46823 }
46824
46825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46826         LDKPendingHTLCInfo this_ptr_conv;
46827         this_ptr_conv.inner = untag_ptr(this_ptr);
46828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46830         this_ptr_conv.is_owned = false;
46831         LDKThirtyTwoBytes val_ref;
46832         CHECK((*env)->GetArrayLength(env, val) == 32);
46833         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46834         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
46835 }
46836
46837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46838         LDKPendingHTLCInfo this_ptr_conv;
46839         this_ptr_conv.inner = untag_ptr(this_ptr);
46840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46842         this_ptr_conv.is_owned = false;
46843         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46844         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
46845         int64_t ret_ref = tag_ptr(ret_copy, true);
46846         return ret_ref;
46847 }
46848
46849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46850         LDKPendingHTLCInfo this_ptr_conv;
46851         this_ptr_conv.inner = untag_ptr(this_ptr);
46852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46854         this_ptr_conv.is_owned = false;
46855         void* val_ptr = untag_ptr(val);
46856         CHECK_ACCESS(val_ptr);
46857         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46858         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46859         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
46860 }
46861
46862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46863         LDKPendingHTLCInfo this_ptr_conv;
46864         this_ptr_conv.inner = untag_ptr(this_ptr);
46865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46867         this_ptr_conv.is_owned = false;
46868         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
46869         return ret_conv;
46870 }
46871
46872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46873         LDKPendingHTLCInfo this_ptr_conv;
46874         this_ptr_conv.inner = untag_ptr(this_ptr);
46875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46877         this_ptr_conv.is_owned = false;
46878         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
46879 }
46880
46881 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
46882         LDKPendingHTLCInfo this_ptr_conv;
46883         this_ptr_conv.inner = untag_ptr(this_ptr);
46884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46886         this_ptr_conv.is_owned = false;
46887         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
46888         return ret_conv;
46889 }
46890
46891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46892         LDKPendingHTLCInfo this_ptr_conv;
46893         this_ptr_conv.inner = untag_ptr(this_ptr);
46894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46896         this_ptr_conv.is_owned = false;
46897         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
46898 }
46899
46900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46901         LDKPendingHTLCInfo this_ptr_conv;
46902         this_ptr_conv.inner = untag_ptr(this_ptr);
46903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46905         this_ptr_conv.is_owned = false;
46906         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46907         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
46908         int64_t ret_ref = tag_ptr(ret_copy, true);
46909         return ret_ref;
46910 }
46911
46912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46913         LDKPendingHTLCInfo this_ptr_conv;
46914         this_ptr_conv.inner = untag_ptr(this_ptr);
46915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46917         this_ptr_conv.is_owned = false;
46918         void* val_ptr = untag_ptr(val);
46919         CHECK_ACCESS(val_ptr);
46920         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46921         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46922         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46923 }
46924
46925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1new(JNIEnv *env, jclass clz, int64_t routing_arg, int8_tArray incoming_shared_secret_arg, int8_tArray payment_hash_arg, int64_t incoming_amt_msat_arg, int64_t outgoing_amt_msat_arg, int32_t outgoing_cltv_value_arg, int64_t skimmed_fee_msat_arg) {
46926         void* routing_arg_ptr = untag_ptr(routing_arg);
46927         CHECK_ACCESS(routing_arg_ptr);
46928         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
46929         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
46930         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
46931         CHECK((*env)->GetArrayLength(env, incoming_shared_secret_arg) == 32);
46932         (*env)->GetByteArrayRegion(env, incoming_shared_secret_arg, 0, 32, incoming_shared_secret_arg_ref.data);
46933         LDKThirtyTwoBytes payment_hash_arg_ref;
46934         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
46935         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
46936         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
46937         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
46938         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
46939         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
46940         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46941         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46942         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46943         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46944         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_new(routing_arg_conv, incoming_shared_secret_arg_ref, payment_hash_arg_ref, incoming_amt_msat_arg_conv, outgoing_amt_msat_arg, outgoing_cltv_value_arg, skimmed_fee_msat_arg_conv);
46945         int64_t ret_ref = 0;
46946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46948         return ret_ref;
46949 }
46950
46951 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
46952         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
46953         int64_t ret_ref = 0;
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46956         return ret_ref;
46957 }
46958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46959         LDKPendingHTLCInfo arg_conv;
46960         arg_conv.inner = untag_ptr(arg);
46961         arg_conv.is_owned = ptr_is_owned(arg);
46962         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46963         arg_conv.is_owned = false;
46964         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
46965         return ret_conv;
46966 }
46967
46968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46969         LDKPendingHTLCInfo orig_conv;
46970         orig_conv.inner = untag_ptr(orig);
46971         orig_conv.is_owned = ptr_is_owned(orig);
46972         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46973         orig_conv.is_owned = false;
46974         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
46975         int64_t ret_ref = 0;
46976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46978         return ret_ref;
46979 }
46980
46981 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46982         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
46983         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_clone(orig_conv));
46984         return ret_conv;
46985 }
46986
46987 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1introduction_1node(JNIEnv *env, jclass clz) {
46988         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_introduction_node());
46989         return ret_conv;
46990 }
46991
46992 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1blinded_1node(JNIEnv *env, jclass clz) {
46993         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_blinded_node());
46994         return ret_conv;
46995 }
46996
46997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1hash(JNIEnv *env, jclass clz, int64_t o) {
46998         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
46999         int64_t ret_conv = BlindedFailure_hash(o_conv);
47000         return ret_conv;
47001 }
47002
47003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47004         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
47005         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
47006         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
47007         return ret_conv;
47008 }
47009
47010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47011         if (!ptr_is_owned(this_ptr)) return;
47012         void* this_ptr_ptr = untag_ptr(this_ptr);
47013         CHECK_ACCESS(this_ptr_ptr);
47014         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
47015         FREE(untag_ptr(this_ptr));
47016         FailureCode_free(this_ptr_conv);
47017 }
47018
47019 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
47020         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
47021         *ret_copy = FailureCode_clone(arg);
47022         int64_t ret_ref = tag_ptr(ret_copy, true);
47023         return ret_ref;
47024 }
47025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47026         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
47027         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
47028         return ret_conv;
47029 }
47030
47031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47032         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
47033         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
47034         *ret_copy = FailureCode_clone(orig_conv);
47035         int64_t ret_ref = tag_ptr(ret_copy, true);
47036         return ret_ref;
47037 }
47038
47039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
47040         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
47041         *ret_copy = FailureCode_temporary_node_failure();
47042         int64_t ret_ref = tag_ptr(ret_copy, true);
47043         return ret_ref;
47044 }
47045
47046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
47047         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
47048         *ret_copy = FailureCode_required_node_feature_missing();
47049         int64_t ret_ref = tag_ptr(ret_copy, true);
47050         return ret_ref;
47051 }
47052
47053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
47054         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
47055         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
47056         int64_t ret_ref = tag_ptr(ret_copy, true);
47057         return ret_ref;
47058 }
47059
47060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
47061         void* a_ptr = untag_ptr(a);
47062         CHECK_ACCESS(a_ptr);
47063         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
47064         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
47065         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
47066         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
47067         int64_t ret_ref = tag_ptr(ret_copy, true);
47068         return ret_ref;
47069 }
47070
47071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47072         LDKChannelManager this_obj_conv;
47073         this_obj_conv.inner = untag_ptr(this_obj);
47074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47076         ChannelManager_free(this_obj_conv);
47077 }
47078
47079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47080         LDKChainParameters this_obj_conv;
47081         this_obj_conv.inner = untag_ptr(this_obj);
47082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47084         ChainParameters_free(this_obj_conv);
47085 }
47086
47087 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
47088         LDKChainParameters 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         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
47094         return ret_conv;
47095 }
47096
47097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
47098         LDKChainParameters this_ptr_conv;
47099         this_ptr_conv.inner = untag_ptr(this_ptr);
47100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47102         this_ptr_conv.is_owned = false;
47103         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
47104         ChainParameters_set_network(&this_ptr_conv, val_conv);
47105 }
47106
47107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
47108         LDKChainParameters this_ptr_conv;
47109         this_ptr_conv.inner = untag_ptr(this_ptr);
47110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47112         this_ptr_conv.is_owned = false;
47113         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
47114         int64_t ret_ref = 0;
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47117         return ret_ref;
47118 }
47119
47120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47121         LDKChainParameters this_ptr_conv;
47122         this_ptr_conv.inner = untag_ptr(this_ptr);
47123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47125         this_ptr_conv.is_owned = false;
47126         LDKBestBlock val_conv;
47127         val_conv.inner = untag_ptr(val);
47128         val_conv.is_owned = ptr_is_owned(val);
47129         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47130         val_conv = BestBlock_clone(&val_conv);
47131         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
47132 }
47133
47134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
47135         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
47136         LDKBestBlock best_block_arg_conv;
47137         best_block_arg_conv.inner = untag_ptr(best_block_arg);
47138         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
47139         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
47140         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
47141         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
47142         int64_t ret_ref = 0;
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47145         return ret_ref;
47146 }
47147
47148 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
47149         LDKChainParameters ret_var = ChainParameters_clone(arg);
47150         int64_t ret_ref = 0;
47151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47153         return ret_ref;
47154 }
47155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47156         LDKChainParameters arg_conv;
47157         arg_conv.inner = untag_ptr(arg);
47158         arg_conv.is_owned = ptr_is_owned(arg);
47159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47160         arg_conv.is_owned = false;
47161         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
47162         return ret_conv;
47163 }
47164
47165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47166         LDKChainParameters orig_conv;
47167         orig_conv.inner = untag_ptr(orig);
47168         orig_conv.is_owned = ptr_is_owned(orig);
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47170         orig_conv.is_owned = false;
47171         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
47172         int64_t ret_ref = 0;
47173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47175         return ret_ref;
47176 }
47177
47178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47179         if (!ptr_is_owned(this_ptr)) return;
47180         void* this_ptr_ptr = untag_ptr(this_ptr);
47181         CHECK_ACCESS(this_ptr_ptr);
47182         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
47183         FREE(untag_ptr(this_ptr));
47184         RecentPaymentDetails_free(this_ptr_conv);
47185 }
47186
47187 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
47188         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47189         *ret_copy = RecentPaymentDetails_clone(arg);
47190         int64_t ret_ref = tag_ptr(ret_copy, true);
47191         return ret_ref;
47192 }
47193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47194         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
47195         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
47196         return ret_conv;
47197 }
47198
47199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47200         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
47201         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47202         *ret_copy = RecentPaymentDetails_clone(orig_conv);
47203         int64_t ret_ref = tag_ptr(ret_copy, true);
47204         return ret_ref;
47205 }
47206
47207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
47208         LDKThirtyTwoBytes payment_id_ref;
47209         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47210         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47211         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47212         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
47213         int64_t ret_ref = tag_ptr(ret_copy, true);
47214         return ret_ref;
47215 }
47216
47217 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) {
47218         LDKThirtyTwoBytes payment_id_ref;
47219         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47220         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47221         LDKThirtyTwoBytes payment_hash_ref;
47222         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47223         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47224         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47225         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
47226         int64_t ret_ref = tag_ptr(ret_copy, true);
47227         return ret_ref;
47228 }
47229
47230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
47231         LDKThirtyTwoBytes payment_id_ref;
47232         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47233         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47234         void* payment_hash_ptr = untag_ptr(payment_hash);
47235         CHECK_ACCESS(payment_hash_ptr);
47236         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
47237         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
47238         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47239         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
47240         int64_t ret_ref = tag_ptr(ret_copy, true);
47241         return ret_ref;
47242 }
47243
47244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
47245         LDKThirtyTwoBytes payment_id_ref;
47246         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47247         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47248         LDKThirtyTwoBytes payment_hash_ref;
47249         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47250         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47251         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47252         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
47253         int64_t ret_ref = tag_ptr(ret_copy, true);
47254         return ret_ref;
47255 }
47256
47257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47258         LDKPhantomRouteHints this_obj_conv;
47259         this_obj_conv.inner = untag_ptr(this_obj);
47260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47262         PhantomRouteHints_free(this_obj_conv);
47263 }
47264
47265 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
47266         LDKPhantomRouteHints this_ptr_conv;
47267         this_ptr_conv.inner = untag_ptr(this_ptr);
47268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47270         this_ptr_conv.is_owned = false;
47271         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
47272         int64_tArray ret_arr = NULL;
47273         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47274         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47275         for (size_t q = 0; q < ret_var.datalen; q++) {
47276                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47277                 int64_t ret_conv_16_ref = 0;
47278                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47279                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47280                 ret_arr_ptr[q] = ret_conv_16_ref;
47281         }
47282         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47283         FREE(ret_var.data);
47284         return ret_arr;
47285 }
47286
47287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47288         LDKPhantomRouteHints this_ptr_conv;
47289         this_ptr_conv.inner = untag_ptr(this_ptr);
47290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47292         this_ptr_conv.is_owned = false;
47293         LDKCVec_ChannelDetailsZ val_constr;
47294         val_constr.datalen = (*env)->GetArrayLength(env, val);
47295         if (val_constr.datalen > 0)
47296                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47297         else
47298                 val_constr.data = NULL;
47299         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47300         for (size_t q = 0; q < val_constr.datalen; q++) {
47301                 int64_t val_conv_16 = val_vals[q];
47302                 LDKChannelDetails val_conv_16_conv;
47303                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
47304                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
47305                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
47306                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
47307                 val_constr.data[q] = val_conv_16_conv;
47308         }
47309         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47310         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
47311 }
47312
47313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
47314         LDKPhantomRouteHints this_ptr_conv;
47315         this_ptr_conv.inner = untag_ptr(this_ptr);
47316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47318         this_ptr_conv.is_owned = false;
47319         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
47320         return ret_conv;
47321 }
47322
47323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47324         LDKPhantomRouteHints this_ptr_conv;
47325         this_ptr_conv.inner = untag_ptr(this_ptr);
47326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47328         this_ptr_conv.is_owned = false;
47329         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
47330 }
47331
47332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47333         LDKPhantomRouteHints this_ptr_conv;
47334         this_ptr_conv.inner = untag_ptr(this_ptr);
47335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47337         this_ptr_conv.is_owned = false;
47338         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47339         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
47340         return ret_arr;
47341 }
47342
47343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47344         LDKPhantomRouteHints this_ptr_conv;
47345         this_ptr_conv.inner = untag_ptr(this_ptr);
47346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47348         this_ptr_conv.is_owned = false;
47349         LDKPublicKey val_ref;
47350         CHECK((*env)->GetArrayLength(env, val) == 33);
47351         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47352         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
47353 }
47354
47355 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) {
47356         LDKCVec_ChannelDetailsZ channels_arg_constr;
47357         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
47358         if (channels_arg_constr.datalen > 0)
47359                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47360         else
47361                 channels_arg_constr.data = NULL;
47362         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
47363         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
47364                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
47365                 LDKChannelDetails channels_arg_conv_16_conv;
47366                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
47367                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
47368                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
47369                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
47370                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
47371         }
47372         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
47373         LDKPublicKey real_node_pubkey_arg_ref;
47374         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
47375         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
47376         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
47377         int64_t ret_ref = 0;
47378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47380         return ret_ref;
47381 }
47382
47383 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
47384         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
47385         int64_t ret_ref = 0;
47386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47388         return ret_ref;
47389 }
47390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47391         LDKPhantomRouteHints arg_conv;
47392         arg_conv.inner = untag_ptr(arg);
47393         arg_conv.is_owned = ptr_is_owned(arg);
47394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47395         arg_conv.is_owned = false;
47396         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
47397         return ret_conv;
47398 }
47399
47400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47401         LDKPhantomRouteHints orig_conv;
47402         orig_conv.inner = untag_ptr(orig);
47403         orig_conv.is_owned = ptr_is_owned(orig);
47404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47405         orig_conv.is_owned = false;
47406         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
47407         int64_t ret_ref = 0;
47408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47410         return ret_ref;
47411 }
47412
47413 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) {
47414         void* fee_est_ptr = untag_ptr(fee_est);
47415         CHECK_ACCESS(fee_est_ptr);
47416         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
47417         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
47418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47419                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
47420         }
47421         void* chain_monitor_ptr = untag_ptr(chain_monitor);
47422         CHECK_ACCESS(chain_monitor_ptr);
47423         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
47424         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
47425                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47426                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
47427         }
47428         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
47429         CHECK_ACCESS(tx_broadcaster_ptr);
47430         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
47431         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
47432                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47433                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
47434         }
47435         void* router_ptr = untag_ptr(router);
47436         CHECK_ACCESS(router_ptr);
47437         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47438         if (router_conv.free == LDKRouter_JCalls_free) {
47439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47440                 LDKRouter_JCalls_cloned(&router_conv);
47441         }
47442         void* logger_ptr = untag_ptr(logger);
47443         CHECK_ACCESS(logger_ptr);
47444         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47445         if (logger_conv.free == LDKLogger_JCalls_free) {
47446                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47447                 LDKLogger_JCalls_cloned(&logger_conv);
47448         }
47449         void* entropy_source_ptr = untag_ptr(entropy_source);
47450         CHECK_ACCESS(entropy_source_ptr);
47451         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
47452         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
47453                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47454                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
47455         }
47456         void* node_signer_ptr = untag_ptr(node_signer);
47457         CHECK_ACCESS(node_signer_ptr);
47458         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47459         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47461                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47462         }
47463         void* signer_provider_ptr = untag_ptr(signer_provider);
47464         CHECK_ACCESS(signer_provider_ptr);
47465         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
47466         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
47467                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47468                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
47469         }
47470         LDKUserConfig config_conv;
47471         config_conv.inner = untag_ptr(config);
47472         config_conv.is_owned = ptr_is_owned(config);
47473         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
47474         config_conv = UserConfig_clone(&config_conv);
47475         LDKChainParameters params_conv;
47476         params_conv.inner = untag_ptr(params);
47477         params_conv.is_owned = ptr_is_owned(params);
47478         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
47479         params_conv = ChainParameters_clone(&params_conv);
47480         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);
47481         int64_t ret_ref = 0;
47482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47484         return ret_ref;
47485 }
47486
47487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
47488         LDKChannelManager this_arg_conv;
47489         this_arg_conv.inner = untag_ptr(this_arg);
47490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47492         this_arg_conv.is_owned = false;
47493         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
47494         int64_t ret_ref = 0;
47495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47497         return ret_ref;
47498 }
47499
47500 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 temporary_channel_id, int64_t override_config) {
47501         LDKChannelManager this_arg_conv;
47502         this_arg_conv.inner = untag_ptr(this_arg);
47503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47505         this_arg_conv.is_owned = false;
47506         LDKPublicKey their_network_key_ref;
47507         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
47508         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
47509         LDKU128 user_channel_id_ref;
47510         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
47511         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
47512         LDKChannelId temporary_channel_id_conv;
47513         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
47514         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
47515         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
47516         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
47517         LDKUserConfig override_config_conv;
47518         override_config_conv.inner = untag_ptr(override_config);
47519         override_config_conv.is_owned = ptr_is_owned(override_config);
47520         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
47521         override_config_conv = UserConfig_clone(&override_config_conv);
47522         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
47523         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, temporary_channel_id_conv, override_config_conv);
47524         return tag_ptr(ret_conv, true);
47525 }
47526
47527 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
47528         LDKChannelManager this_arg_conv;
47529         this_arg_conv.inner = untag_ptr(this_arg);
47530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47532         this_arg_conv.is_owned = false;
47533         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
47534         int64_tArray ret_arr = NULL;
47535         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47536         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47537         for (size_t q = 0; q < ret_var.datalen; q++) {
47538                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47539                 int64_t ret_conv_16_ref = 0;
47540                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47541                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47542                 ret_arr_ptr[q] = ret_conv_16_ref;
47543         }
47544         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47545         FREE(ret_var.data);
47546         return ret_arr;
47547 }
47548
47549 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
47550         LDKChannelManager this_arg_conv;
47551         this_arg_conv.inner = untag_ptr(this_arg);
47552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47554         this_arg_conv.is_owned = false;
47555         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
47556         int64_tArray ret_arr = NULL;
47557         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47558         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47559         for (size_t q = 0; q < ret_var.datalen; q++) {
47560                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47561                 int64_t ret_conv_16_ref = 0;
47562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47563                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47564                 ret_arr_ptr[q] = ret_conv_16_ref;
47565         }
47566         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47567         FREE(ret_var.data);
47568         return ret_arr;
47569 }
47570
47571 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) {
47572         LDKChannelManager this_arg_conv;
47573         this_arg_conv.inner = untag_ptr(this_arg);
47574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47576         this_arg_conv.is_owned = false;
47577         LDKPublicKey counterparty_node_id_ref;
47578         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47579         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47580         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
47581         int64_tArray ret_arr = NULL;
47582         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47583         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47584         for (size_t q = 0; q < ret_var.datalen; q++) {
47585                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47586                 int64_t ret_conv_16_ref = 0;
47587                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47588                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47589                 ret_arr_ptr[q] = ret_conv_16_ref;
47590         }
47591         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47592         FREE(ret_var.data);
47593         return ret_arr;
47594 }
47595
47596 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
47597         LDKChannelManager this_arg_conv;
47598         this_arg_conv.inner = untag_ptr(this_arg);
47599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47601         this_arg_conv.is_owned = false;
47602         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
47603         int64_tArray ret_arr = NULL;
47604         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47605         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47606         for (size_t w = 0; w < ret_var.datalen; w++) {
47607                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47608                 *ret_conv_22_copy = ret_var.data[w];
47609                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
47610                 ret_arr_ptr[w] = ret_conv_22_ref;
47611         }
47612         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47613         FREE(ret_var.data);
47614         return ret_arr;
47615 }
47616
47617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
47618         LDKChannelManager this_arg_conv;
47619         this_arg_conv.inner = untag_ptr(this_arg);
47620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47622         this_arg_conv.is_owned = false;
47623         LDKChannelId channel_id_conv;
47624         channel_id_conv.inner = untag_ptr(channel_id);
47625         channel_id_conv.is_owned = ptr_is_owned(channel_id);
47626         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
47627         channel_id_conv.is_owned = false;
47628         LDKPublicKey counterparty_node_id_ref;
47629         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47630         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47631         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47632         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
47633         return tag_ptr(ret_conv, true);
47634 }
47635
47636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
47637         LDKChannelManager this_arg_conv;
47638         this_arg_conv.inner = untag_ptr(this_arg);
47639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47641         this_arg_conv.is_owned = false;
47642         LDKChannelId channel_id_conv;
47643         channel_id_conv.inner = untag_ptr(channel_id);
47644         channel_id_conv.is_owned = ptr_is_owned(channel_id);
47645         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
47646         channel_id_conv.is_owned = false;
47647         LDKPublicKey counterparty_node_id_ref;
47648         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47649         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47650         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
47651         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
47652         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
47653         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
47654         LDKShutdownScript shutdown_script_conv;
47655         shutdown_script_conv.inner = untag_ptr(shutdown_script);
47656         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
47657         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
47658         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
47659         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47660         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
47661         return tag_ptr(ret_conv, true);
47662 }
47663
47664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
47665         LDKChannelManager this_arg_conv;
47666         this_arg_conv.inner = untag_ptr(this_arg);
47667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47669         this_arg_conv.is_owned = false;
47670         LDKChannelId channel_id_conv;
47671         channel_id_conv.inner = untag_ptr(channel_id);
47672         channel_id_conv.is_owned = ptr_is_owned(channel_id);
47673         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
47674         channel_id_conv.is_owned = false;
47675         LDKPublicKey counterparty_node_id_ref;
47676         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47677         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47678         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47679         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
47680         return tag_ptr(ret_conv, true);
47681 }
47682
47683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
47684         LDKChannelManager this_arg_conv;
47685         this_arg_conv.inner = untag_ptr(this_arg);
47686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47688         this_arg_conv.is_owned = false;
47689         LDKChannelId channel_id_conv;
47690         channel_id_conv.inner = untag_ptr(channel_id);
47691         channel_id_conv.is_owned = ptr_is_owned(channel_id);
47692         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
47693         channel_id_conv.is_owned = false;
47694         LDKPublicKey counterparty_node_id_ref;
47695         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47696         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47697         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47698         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
47699         return tag_ptr(ret_conv, true);
47700 }
47701
47702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
47703         LDKChannelManager this_arg_conv;
47704         this_arg_conv.inner = untag_ptr(this_arg);
47705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47707         this_arg_conv.is_owned = false;
47708         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
47709 }
47710
47711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
47712         LDKChannelManager this_arg_conv;
47713         this_arg_conv.inner = untag_ptr(this_arg);
47714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47716         this_arg_conv.is_owned = false;
47717         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
47718 }
47719
47720 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) {
47721         LDKChannelManager this_arg_conv;
47722         this_arg_conv.inner = untag_ptr(this_arg);
47723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47725         this_arg_conv.is_owned = false;
47726         LDKRoute route_conv;
47727         route_conv.inner = untag_ptr(route);
47728         route_conv.is_owned = ptr_is_owned(route);
47729         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
47730         route_conv.is_owned = false;
47731         LDKThirtyTwoBytes payment_hash_ref;
47732         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47733         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47734         LDKRecipientOnionFields recipient_onion_conv;
47735         recipient_onion_conv.inner = untag_ptr(recipient_onion);
47736         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
47737         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
47738         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
47739         LDKThirtyTwoBytes payment_id_ref;
47740         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47741         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47742         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
47743         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
47744         return tag_ptr(ret_conv, true);
47745 }
47746
47747 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) {
47748         LDKChannelManager this_arg_conv;
47749         this_arg_conv.inner = untag_ptr(this_arg);
47750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47752         this_arg_conv.is_owned = false;
47753         LDKThirtyTwoBytes payment_hash_ref;
47754         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47755         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47756         LDKRecipientOnionFields recipient_onion_conv;
47757         recipient_onion_conv.inner = untag_ptr(recipient_onion);
47758         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
47760         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
47761         LDKThirtyTwoBytes payment_id_ref;
47762         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47763         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47764         LDKRouteParameters route_params_conv;
47765         route_params_conv.inner = untag_ptr(route_params);
47766         route_params_conv.is_owned = ptr_is_owned(route_params);
47767         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
47768         route_params_conv = RouteParameters_clone(&route_params_conv);
47769         void* retry_strategy_ptr = untag_ptr(retry_strategy);
47770         CHECK_ACCESS(retry_strategy_ptr);
47771         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
47772         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
47773         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
47774         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
47775         return tag_ptr(ret_conv, true);
47776 }
47777
47778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
47779         LDKChannelManager this_arg_conv;
47780         this_arg_conv.inner = untag_ptr(this_arg);
47781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47783         this_arg_conv.is_owned = false;
47784         LDKThirtyTwoBytes payment_id_ref;
47785         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47786         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47787         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
47788 }
47789
47790 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) {
47791         LDKChannelManager this_arg_conv;
47792         this_arg_conv.inner = untag_ptr(this_arg);
47793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47795         this_arg_conv.is_owned = false;
47796         LDKRoute route_conv;
47797         route_conv.inner = untag_ptr(route);
47798         route_conv.is_owned = ptr_is_owned(route);
47799         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
47800         route_conv.is_owned = false;
47801         void* payment_preimage_ptr = untag_ptr(payment_preimage);
47802         CHECK_ACCESS(payment_preimage_ptr);
47803         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
47804         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
47805         LDKRecipientOnionFields recipient_onion_conv;
47806         recipient_onion_conv.inner = untag_ptr(recipient_onion);
47807         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
47808         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
47809         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
47810         LDKThirtyTwoBytes payment_id_ref;
47811         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47812         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47813         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
47814         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
47815         return tag_ptr(ret_conv, true);
47816 }
47817
47818 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) {
47819         LDKChannelManager this_arg_conv;
47820         this_arg_conv.inner = untag_ptr(this_arg);
47821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47823         this_arg_conv.is_owned = false;
47824         void* payment_preimage_ptr = untag_ptr(payment_preimage);
47825         CHECK_ACCESS(payment_preimage_ptr);
47826         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
47827         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
47828         LDKRecipientOnionFields recipient_onion_conv;
47829         recipient_onion_conv.inner = untag_ptr(recipient_onion);
47830         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
47831         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
47832         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
47833         LDKThirtyTwoBytes payment_id_ref;
47834         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47835         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47836         LDKRouteParameters route_params_conv;
47837         route_params_conv.inner = untag_ptr(route_params);
47838         route_params_conv.is_owned = ptr_is_owned(route_params);
47839         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
47840         route_params_conv = RouteParameters_clone(&route_params_conv);
47841         void* retry_strategy_ptr = untag_ptr(retry_strategy);
47842         CHECK_ACCESS(retry_strategy_ptr);
47843         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
47844         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
47845         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
47846         *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);
47847         return tag_ptr(ret_conv, true);
47848 }
47849
47850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
47851         LDKChannelManager this_arg_conv;
47852         this_arg_conv.inner = untag_ptr(this_arg);
47853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47855         this_arg_conv.is_owned = false;
47856         LDKPath path_conv;
47857         path_conv.inner = untag_ptr(path);
47858         path_conv.is_owned = ptr_is_owned(path);
47859         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
47860         path_conv = Path_clone(&path_conv);
47861         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
47862         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
47863         return tag_ptr(ret_conv, true);
47864 }
47865
47866 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) {
47867         LDKChannelManager this_arg_conv;
47868         this_arg_conv.inner = untag_ptr(this_arg);
47869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47871         this_arg_conv.is_owned = false;
47872         LDKPublicKey node_id_ref;
47873         CHECK((*env)->GetArrayLength(env, node_id) == 33);
47874         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
47875         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
47876         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
47877         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
47878         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
47879         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
47880         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
47881         return tag_ptr(ret_conv, true);
47882 }
47883
47884 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) {
47885         LDKChannelManager this_arg_conv;
47886         this_arg_conv.inner = untag_ptr(this_arg);
47887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47889         this_arg_conv.is_owned = false;
47890         LDKRouteParameters route_params_conv;
47891         route_params_conv.inner = untag_ptr(route_params);
47892         route_params_conv.is_owned = ptr_is_owned(route_params);
47893         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
47894         route_params_conv = RouteParameters_clone(&route_params_conv);
47895         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
47896         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
47897         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
47898         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
47899         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
47900         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
47901         return tag_ptr(ret_conv, true);
47902 }
47903
47904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
47905         LDKChannelManager this_arg_conv;
47906         this_arg_conv.inner = untag_ptr(this_arg);
47907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47909         this_arg_conv.is_owned = false;
47910         LDKChannelId temporary_channel_id_conv;
47911         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
47912         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
47913         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
47914         temporary_channel_id_conv.is_owned = false;
47915         LDKPublicKey counterparty_node_id_ref;
47916         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47917         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47918         LDKTransaction funding_transaction_ref;
47919         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
47920         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
47921         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
47922         funding_transaction_ref.data_is_owned = true;
47923         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47924         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
47925         return tag_ptr(ret_conv, true);
47926 }
47927
47928 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) {
47929         LDKChannelManager this_arg_conv;
47930         this_arg_conv.inner = untag_ptr(this_arg);
47931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47933         this_arg_conv.is_owned = false;
47934         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
47935         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
47936         if (temporary_channels_constr.datalen > 0)
47937                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
47938         else
47939                 temporary_channels_constr.data = NULL;
47940         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
47941         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
47942                 int64_t temporary_channels_conv_30 = temporary_channels_vals[e];
47943                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
47944                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
47945                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
47946                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
47947                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
47948         }
47949         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
47950         LDKTransaction funding_transaction_ref;
47951         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
47952         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
47953         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
47954         funding_transaction_ref.data_is_owned = true;
47955         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47956         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
47957         return tag_ptr(ret_conv, true);
47958 }
47959
47960 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, int64_tArray channel_ids, int64_t config_update) {
47961         LDKChannelManager this_arg_conv;
47962         this_arg_conv.inner = untag_ptr(this_arg);
47963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47965         this_arg_conv.is_owned = false;
47966         LDKPublicKey counterparty_node_id_ref;
47967         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47968         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47969         LDKCVec_ChannelIdZ channel_ids_constr;
47970         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
47971         if (channel_ids_constr.datalen > 0)
47972                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
47973         else
47974                 channel_ids_constr.data = NULL;
47975         int64_t* channel_ids_vals = (*env)->GetLongArrayElements (env, channel_ids, NULL);
47976         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
47977                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
47978                 LDKChannelId channel_ids_conv_11_conv;
47979                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
47980                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
47981                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
47982                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
47983                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
47984         }
47985         (*env)->ReleaseLongArrayElements(env, channel_ids, channel_ids_vals, 0);
47986         LDKChannelConfigUpdate config_update_conv;
47987         config_update_conv.inner = untag_ptr(config_update);
47988         config_update_conv.is_owned = ptr_is_owned(config_update);
47989         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
47990         config_update_conv.is_owned = false;
47991         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
47992         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
47993         return tag_ptr(ret_conv, true);
47994 }
47995
47996 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, int64_tArray channel_ids, int64_t config) {
47997         LDKChannelManager this_arg_conv;
47998         this_arg_conv.inner = untag_ptr(this_arg);
47999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48001         this_arg_conv.is_owned = false;
48002         LDKPublicKey counterparty_node_id_ref;
48003         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48004         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48005         LDKCVec_ChannelIdZ channel_ids_constr;
48006         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
48007         if (channel_ids_constr.datalen > 0)
48008                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
48009         else
48010                 channel_ids_constr.data = NULL;
48011         int64_t* channel_ids_vals = (*env)->GetLongArrayElements (env, channel_ids, NULL);
48012         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
48013                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
48014                 LDKChannelId channel_ids_conv_11_conv;
48015                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
48016                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
48017                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
48018                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
48019                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
48020         }
48021         (*env)->ReleaseLongArrayElements(env, channel_ids, channel_ids_vals, 0);
48022         LDKChannelConfig config_conv;
48023         config_conv.inner = untag_ptr(config);
48024         config_conv.is_owned = ptr_is_owned(config);
48025         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
48026         config_conv.is_owned = false;
48027         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48028         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
48029         return tag_ptr(ret_conv, true);
48030 }
48031
48032 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, int64_t next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
48033         LDKChannelManager this_arg_conv;
48034         this_arg_conv.inner = untag_ptr(this_arg);
48035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48037         this_arg_conv.is_owned = false;
48038         LDKThirtyTwoBytes intercept_id_ref;
48039         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
48040         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
48041         LDKChannelId next_hop_channel_id_conv;
48042         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
48043         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
48044         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
48045         next_hop_channel_id_conv.is_owned = false;
48046         LDKPublicKey next_node_id_ref;
48047         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
48048         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
48049         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48050         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, &next_hop_channel_id_conv, next_node_id_ref, amt_to_forward_msat);
48051         return tag_ptr(ret_conv, true);
48052 }
48053
48054 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) {
48055         LDKChannelManager this_arg_conv;
48056         this_arg_conv.inner = untag_ptr(this_arg);
48057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48059         this_arg_conv.is_owned = false;
48060         LDKThirtyTwoBytes intercept_id_ref;
48061         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
48062         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
48063         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48064         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
48065         return tag_ptr(ret_conv, true);
48066 }
48067
48068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
48069         LDKChannelManager this_arg_conv;
48070         this_arg_conv.inner = untag_ptr(this_arg);
48071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48073         this_arg_conv.is_owned = false;
48074         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
48075 }
48076
48077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
48078         LDKChannelManager this_arg_conv;
48079         this_arg_conv.inner = untag_ptr(this_arg);
48080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48082         this_arg_conv.is_owned = false;
48083         ChannelManager_timer_tick_occurred(&this_arg_conv);
48084 }
48085
48086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
48087         LDKChannelManager this_arg_conv;
48088         this_arg_conv.inner = untag_ptr(this_arg);
48089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48091         this_arg_conv.is_owned = false;
48092         uint8_t payment_hash_arr[32];
48093         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48094         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48095         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
48096         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
48097 }
48098
48099 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) {
48100         LDKChannelManager this_arg_conv;
48101         this_arg_conv.inner = untag_ptr(this_arg);
48102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48104         this_arg_conv.is_owned = false;
48105         uint8_t payment_hash_arr[32];
48106         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48107         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48108         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
48109         void* failure_code_ptr = untag_ptr(failure_code);
48110         CHECK_ACCESS(failure_code_ptr);
48111         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
48112         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
48113         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
48114 }
48115
48116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
48117         LDKChannelManager this_arg_conv;
48118         this_arg_conv.inner = untag_ptr(this_arg);
48119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48121         this_arg_conv.is_owned = false;
48122         LDKThirtyTwoBytes payment_preimage_ref;
48123         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48124         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48125         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
48126 }
48127
48128 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) {
48129         LDKChannelManager this_arg_conv;
48130         this_arg_conv.inner = untag_ptr(this_arg);
48131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48133         this_arg_conv.is_owned = false;
48134         LDKThirtyTwoBytes payment_preimage_ref;
48135         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48136         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48137         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
48138 }
48139
48140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
48141         LDKChannelManager this_arg_conv;
48142         this_arg_conv.inner = untag_ptr(this_arg);
48143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48145         this_arg_conv.is_owned = false;
48146         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48147         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
48148         return ret_arr;
48149 }
48150
48151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
48152         LDKChannelManager this_arg_conv;
48153         this_arg_conv.inner = untag_ptr(this_arg);
48154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48156         this_arg_conv.is_owned = false;
48157         LDKChannelId temporary_channel_id_conv;
48158         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48159         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48160         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48161         temporary_channel_id_conv.is_owned = false;
48162         LDKPublicKey counterparty_node_id_ref;
48163         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48164         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48165         LDKU128 user_channel_id_ref;
48166         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
48167         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
48168         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48169         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
48170         return tag_ptr(ret_conv, true);
48171 }
48172
48173 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, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
48174         LDKChannelManager this_arg_conv;
48175         this_arg_conv.inner = untag_ptr(this_arg);
48176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48178         this_arg_conv.is_owned = false;
48179         LDKChannelId temporary_channel_id_conv;
48180         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48181         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48182         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48183         temporary_channel_id_conv.is_owned = false;
48184         LDKPublicKey counterparty_node_id_ref;
48185         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48186         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48187         LDKU128 user_channel_id_ref;
48188         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
48189         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
48190         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48191         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
48192         return tag_ptr(ret_conv, true);
48193 }
48194
48195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1offer_1builder(JNIEnv *env, jclass clz, int64_t this_arg) {
48196         LDKChannelManager this_arg_conv;
48197         this_arg_conv.inner = untag_ptr(this_arg);
48198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48200         this_arg_conv.is_owned = false;
48201         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
48202         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
48203         return tag_ptr(ret_conv, true);
48204 }
48205
48206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1refund_1builder(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats, int64_t absolute_expiry, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
48207         LDKChannelManager this_arg_conv;
48208         this_arg_conv.inner = untag_ptr(this_arg);
48209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48211         this_arg_conv.is_owned = false;
48212         LDKThirtyTwoBytes payment_id_ref;
48213         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48214         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48215         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48216         CHECK_ACCESS(retry_strategy_ptr);
48217         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48218         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48219         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
48220         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
48221         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
48222         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
48223         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
48224         *ret_conv = ChannelManager_create_refund_builder(&this_arg_conv, amount_msats, absolute_expiry, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
48225         return tag_ptr(ret_conv, true);
48226 }
48227
48228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1pay_1for_1offer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t offer, int64_t quantity, int64_t amount_msats, int64_t payer_note, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
48229         LDKChannelManager this_arg_conv;
48230         this_arg_conv.inner = untag_ptr(this_arg);
48231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48233         this_arg_conv.is_owned = false;
48234         LDKOffer offer_conv;
48235         offer_conv.inner = untag_ptr(offer);
48236         offer_conv.is_owned = ptr_is_owned(offer);
48237         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
48238         offer_conv.is_owned = false;
48239         void* quantity_ptr = untag_ptr(quantity);
48240         CHECK_ACCESS(quantity_ptr);
48241         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
48242         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
48243         void* amount_msats_ptr = untag_ptr(amount_msats);
48244         CHECK_ACCESS(amount_msats_ptr);
48245         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
48246         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
48247         void* payer_note_ptr = untag_ptr(payer_note);
48248         CHECK_ACCESS(payer_note_ptr);
48249         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
48250         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
48251         LDKThirtyTwoBytes payment_id_ref;
48252         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48253         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48254         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48255         CHECK_ACCESS(retry_strategy_ptr);
48256         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48257         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48258         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
48259         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
48260         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
48261         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
48262         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
48263         *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
48264         return tag_ptr(ret_conv, true);
48265 }
48266
48267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
48268         LDKChannelManager this_arg_conv;
48269         this_arg_conv.inner = untag_ptr(this_arg);
48270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48272         this_arg_conv.is_owned = false;
48273         LDKRefund refund_conv;
48274         refund_conv.inner = untag_ptr(refund);
48275         refund_conv.is_owned = ptr_is_owned(refund);
48276         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
48277         refund_conv.is_owned = false;
48278         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
48279         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
48280         return tag_ptr(ret_conv, true);
48281 }
48282
48283 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) {
48284         LDKChannelManager this_arg_conv;
48285         this_arg_conv.inner = untag_ptr(this_arg);
48286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48288         this_arg_conv.is_owned = false;
48289         void* min_value_msat_ptr = untag_ptr(min_value_msat);
48290         CHECK_ACCESS(min_value_msat_ptr);
48291         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
48292         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
48293         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
48294         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
48295         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
48296         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
48297         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
48298         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
48299         return tag_ptr(ret_conv, true);
48300 }
48301
48302 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) {
48303         LDKChannelManager this_arg_conv;
48304         this_arg_conv.inner = untag_ptr(this_arg);
48305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48307         this_arg_conv.is_owned = false;
48308         LDKThirtyTwoBytes payment_hash_ref;
48309         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48310         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48311         void* min_value_msat_ptr = untag_ptr(min_value_msat);
48312         CHECK_ACCESS(min_value_msat_ptr);
48313         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
48314         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
48315         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
48316         CHECK_ACCESS(min_final_cltv_expiry_ptr);
48317         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
48318         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
48319         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
48320         *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);
48321         return tag_ptr(ret_conv, true);
48322 }
48323
48324 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) {
48325         LDKChannelManager this_arg_conv;
48326         this_arg_conv.inner = untag_ptr(this_arg);
48327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48329         this_arg_conv.is_owned = false;
48330         LDKThirtyTwoBytes payment_hash_ref;
48331         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48332         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48333         LDKThirtyTwoBytes payment_secret_ref;
48334         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
48335         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
48336         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
48337         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
48338         return tag_ptr(ret_conv, true);
48339 }
48340
48341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
48342         LDKChannelManager this_arg_conv;
48343         this_arg_conv.inner = untag_ptr(this_arg);
48344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48346         this_arg_conv.is_owned = false;
48347         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
48348         return ret_conv;
48349 }
48350
48351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
48352         LDKChannelManager this_arg_conv;
48353         this_arg_conv.inner = untag_ptr(this_arg);
48354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48356         this_arg_conv.is_owned = false;
48357         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
48358         int64_t ret_ref = 0;
48359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48361         return ret_ref;
48362 }
48363
48364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
48365         LDKChannelManager this_arg_conv;
48366         this_arg_conv.inner = untag_ptr(this_arg);
48367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48369         this_arg_conv.is_owned = false;
48370         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
48371         return ret_conv;
48372 }
48373
48374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
48375         LDKChannelManager this_arg_conv;
48376         this_arg_conv.inner = untag_ptr(this_arg);
48377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48379         this_arg_conv.is_owned = false;
48380         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
48381         int64_t ret_ref = 0;
48382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48384         return ret_ref;
48385 }
48386
48387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
48388         LDKChannelManager this_arg_conv;
48389         this_arg_conv.inner = untag_ptr(this_arg);
48390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48392         this_arg_conv.is_owned = false;
48393         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
48394         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
48395         return tag_ptr(ret_ret, true);
48396 }
48397
48398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
48399         LDKChannelManager this_arg_conv;
48400         this_arg_conv.inner = untag_ptr(this_arg);
48401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48403         this_arg_conv.is_owned = false;
48404         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
48405         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
48406         return tag_ptr(ret_ret, true);
48407 }
48408
48409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
48410         LDKChannelManager this_arg_conv;
48411         this_arg_conv.inner = untag_ptr(this_arg);
48412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48414         this_arg_conv.is_owned = false;
48415         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
48416         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
48417         return tag_ptr(ret_ret, true);
48418 }
48419
48420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
48421         LDKChannelManager this_arg_conv;
48422         this_arg_conv.inner = untag_ptr(this_arg);
48423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48425         this_arg_conv.is_owned = false;
48426         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
48427         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
48428         return tag_ptr(ret_ret, true);
48429 }
48430
48431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
48432         LDKChannelManager this_arg_conv;
48433         this_arg_conv.inner = untag_ptr(this_arg);
48434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48436         this_arg_conv.is_owned = false;
48437         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
48438         int64_t ret_ref = 0;
48439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48441         return ret_ref;
48442 }
48443
48444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
48445         LDKChannelManager this_arg_conv;
48446         this_arg_conv.inner = untag_ptr(this_arg);
48447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48449         this_arg_conv.is_owned = false;
48450         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
48451         return ret_conv;
48452 }
48453
48454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
48455         LDKChannelManager this_arg_conv;
48456         this_arg_conv.inner = untag_ptr(this_arg);
48457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48459         this_arg_conv.is_owned = false;
48460         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
48461         int64_t ret_ref = 0;
48462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48464         return ret_ref;
48465 }
48466
48467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48468         LDKChannelManager this_arg_conv;
48469         this_arg_conv.inner = untag_ptr(this_arg);
48470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48472         this_arg_conv.is_owned = false;
48473         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
48474         int64_t ret_ref = 0;
48475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48477         return ret_ref;
48478 }
48479
48480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48481         LDKChannelManager this_arg_conv;
48482         this_arg_conv.inner = untag_ptr(this_arg);
48483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48485         this_arg_conv.is_owned = false;
48486         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
48487         int64_t ret_ref = 0;
48488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48490         return ret_ref;
48491 }
48492
48493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48494         LDKChannelManager this_arg_conv;
48495         this_arg_conv.inner = untag_ptr(this_arg);
48496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48498         this_arg_conv.is_owned = false;
48499         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
48500         int64_t ret_ref = 0;
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48503         return ret_ref;
48504 }
48505
48506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48507         LDKChannelManager this_arg_conv;
48508         this_arg_conv.inner = untag_ptr(this_arg);
48509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48511         this_arg_conv.is_owned = false;
48512         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
48513         int64_t ret_ref = 0;
48514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48516         return ret_ref;
48517 }
48518
48519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48520         LDKChannelManager this_arg_conv;
48521         this_arg_conv.inner = untag_ptr(this_arg);
48522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48524         this_arg_conv.is_owned = false;
48525         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
48526         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
48527         return tag_ptr(ret_ret, true);
48528 }
48529
48530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48531         LDKChannelManager this_arg_conv;
48532         this_arg_conv.inner = untag_ptr(this_arg);
48533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48535         this_arg_conv.is_owned = false;
48536         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
48537         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
48538         return tag_ptr(ret_ret, true);
48539 }
48540
48541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1NodeIdLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
48542         LDKChannelManager this_arg_conv;
48543         this_arg_conv.inner = untag_ptr(this_arg);
48544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48546         this_arg_conv.is_owned = false;
48547         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
48548         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
48549         return tag_ptr(ret_ret, true);
48550 }
48551
48552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
48553         LDKUserConfig config_conv;
48554         config_conv.inner = untag_ptr(config);
48555         config_conv.is_owned = ptr_is_owned(config);
48556         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
48557         config_conv.is_owned = false;
48558         LDKInitFeatures ret_var = provided_init_features(&config_conv);
48559         int64_t ret_ref = 0;
48560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48562         return ret_ref;
48563 }
48564
48565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
48566         LDKPhantomRouteHints obj_conv;
48567         obj_conv.inner = untag_ptr(obj);
48568         obj_conv.is_owned = ptr_is_owned(obj);
48569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48570         obj_conv.is_owned = false;
48571         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
48572         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48573         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48574         CVec_u8Z_free(ret_var);
48575         return ret_arr;
48576 }
48577
48578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48579         LDKu8slice ser_ref;
48580         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48581         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48582         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
48583         *ret_conv = PhantomRouteHints_read(ser_ref);
48584         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48585         return tag_ptr(ret_conv, true);
48586 }
48587
48588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1write(JNIEnv *env, jclass clz, int64_t obj) {
48589         LDKBlindedForward obj_conv;
48590         obj_conv.inner = untag_ptr(obj);
48591         obj_conv.is_owned = ptr_is_owned(obj);
48592         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48593         obj_conv.is_owned = false;
48594         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
48595         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48596         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48597         CVec_u8Z_free(ret_var);
48598         return ret_arr;
48599 }
48600
48601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48602         LDKu8slice ser_ref;
48603         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48604         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48605         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
48606         *ret_conv = BlindedForward_read(ser_ref);
48607         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48608         return tag_ptr(ret_conv, true);
48609 }
48610
48611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1write(JNIEnv *env, jclass clz, int64_t obj) {
48612         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
48613         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
48614         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48615         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48616         CVec_u8Z_free(ret_var);
48617         return ret_arr;
48618 }
48619
48620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48621         LDKu8slice ser_ref;
48622         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48623         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48624         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
48625         *ret_conv = PendingHTLCRouting_read(ser_ref);
48626         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48627         return tag_ptr(ret_conv, true);
48628 }
48629
48630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
48631         LDKPendingHTLCInfo obj_conv;
48632         obj_conv.inner = untag_ptr(obj);
48633         obj_conv.is_owned = ptr_is_owned(obj);
48634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48635         obj_conv.is_owned = false;
48636         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
48637         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48638         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48639         CVec_u8Z_free(ret_var);
48640         return ret_arr;
48641 }
48642
48643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48644         LDKu8slice ser_ref;
48645         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48646         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48647         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
48648         *ret_conv = PendingHTLCInfo_read(ser_ref);
48649         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48650         return tag_ptr(ret_conv, true);
48651 }
48652
48653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
48654         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
48655         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
48656         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48657         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48658         CVec_u8Z_free(ret_var);
48659         return ret_arr;
48660 }
48661
48662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48663         LDKu8slice ser_ref;
48664         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48665         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48666         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
48667         *ret_conv = BlindedFailure_read(ser_ref);
48668         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48669         return tag_ptr(ret_conv, true);
48670 }
48671
48672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
48673         LDKChannelManager obj_conv;
48674         obj_conv.inner = untag_ptr(obj);
48675         obj_conv.is_owned = ptr_is_owned(obj);
48676         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48677         obj_conv.is_owned = false;
48678         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
48679         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48680         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48681         CVec_u8Z_free(ret_var);
48682         return ret_arr;
48683 }
48684
48685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48686         LDKChannelManagerReadArgs this_obj_conv;
48687         this_obj_conv.inner = untag_ptr(this_obj);
48688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48690         ChannelManagerReadArgs_free(this_obj_conv);
48691 }
48692
48693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
48694         LDKChannelManagerReadArgs this_ptr_conv;
48695         this_ptr_conv.inner = untag_ptr(this_ptr);
48696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48698         this_ptr_conv.is_owned = false;
48699         // WARNING: This object doesn't live past this scope, needs clone!
48700         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
48701         return ret_ret;
48702 }
48703
48704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48705         LDKChannelManagerReadArgs this_ptr_conv;
48706         this_ptr_conv.inner = untag_ptr(this_ptr);
48707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48709         this_ptr_conv.is_owned = false;
48710         void* val_ptr = untag_ptr(val);
48711         CHECK_ACCESS(val_ptr);
48712         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
48713         if (val_conv.free == LDKEntropySource_JCalls_free) {
48714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48715                 LDKEntropySource_JCalls_cloned(&val_conv);
48716         }
48717         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
48718 }
48719
48720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
48721         LDKChannelManagerReadArgs this_ptr_conv;
48722         this_ptr_conv.inner = untag_ptr(this_ptr);
48723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48725         this_ptr_conv.is_owned = false;
48726         // WARNING: This object doesn't live past this scope, needs clone!
48727         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
48728         return ret_ret;
48729 }
48730
48731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48732         LDKChannelManagerReadArgs this_ptr_conv;
48733         this_ptr_conv.inner = untag_ptr(this_ptr);
48734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48736         this_ptr_conv.is_owned = false;
48737         void* val_ptr = untag_ptr(val);
48738         CHECK_ACCESS(val_ptr);
48739         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
48740         if (val_conv.free == LDKNodeSigner_JCalls_free) {
48741                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48742                 LDKNodeSigner_JCalls_cloned(&val_conv);
48743         }
48744         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
48745 }
48746
48747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
48748         LDKChannelManagerReadArgs this_ptr_conv;
48749         this_ptr_conv.inner = untag_ptr(this_ptr);
48750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48752         this_ptr_conv.is_owned = false;
48753         // WARNING: This object doesn't live past this scope, needs clone!
48754         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
48755         return ret_ret;
48756 }
48757
48758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48759         LDKChannelManagerReadArgs this_ptr_conv;
48760         this_ptr_conv.inner = untag_ptr(this_ptr);
48761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48763         this_ptr_conv.is_owned = false;
48764         void* val_ptr = untag_ptr(val);
48765         CHECK_ACCESS(val_ptr);
48766         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
48767         if (val_conv.free == LDKSignerProvider_JCalls_free) {
48768                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48769                 LDKSignerProvider_JCalls_cloned(&val_conv);
48770         }
48771         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
48772 }
48773
48774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
48775         LDKChannelManagerReadArgs this_ptr_conv;
48776         this_ptr_conv.inner = untag_ptr(this_ptr);
48777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48779         this_ptr_conv.is_owned = false;
48780         // WARNING: This object doesn't live past this scope, needs clone!
48781         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
48782         return ret_ret;
48783 }
48784
48785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48786         LDKChannelManagerReadArgs this_ptr_conv;
48787         this_ptr_conv.inner = untag_ptr(this_ptr);
48788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48790         this_ptr_conv.is_owned = false;
48791         void* val_ptr = untag_ptr(val);
48792         CHECK_ACCESS(val_ptr);
48793         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
48794         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
48795                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48796                 LDKFeeEstimator_JCalls_cloned(&val_conv);
48797         }
48798         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
48799 }
48800
48801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
48802         LDKChannelManagerReadArgs this_ptr_conv;
48803         this_ptr_conv.inner = untag_ptr(this_ptr);
48804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48806         this_ptr_conv.is_owned = false;
48807         // WARNING: This object doesn't live past this scope, needs clone!
48808         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
48809         return ret_ret;
48810 }
48811
48812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48813         LDKChannelManagerReadArgs this_ptr_conv;
48814         this_ptr_conv.inner = untag_ptr(this_ptr);
48815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48817         this_ptr_conv.is_owned = false;
48818         void* val_ptr = untag_ptr(val);
48819         CHECK_ACCESS(val_ptr);
48820         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
48821         if (val_conv.free == LDKWatch_JCalls_free) {
48822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48823                 LDKWatch_JCalls_cloned(&val_conv);
48824         }
48825         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
48826 }
48827
48828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
48829         LDKChannelManagerReadArgs this_ptr_conv;
48830         this_ptr_conv.inner = untag_ptr(this_ptr);
48831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48833         this_ptr_conv.is_owned = false;
48834         // WARNING: This object doesn't live past this scope, needs clone!
48835         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
48836         return ret_ret;
48837 }
48838
48839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48840         LDKChannelManagerReadArgs this_ptr_conv;
48841         this_ptr_conv.inner = untag_ptr(this_ptr);
48842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48844         this_ptr_conv.is_owned = false;
48845         void* val_ptr = untag_ptr(val);
48846         CHECK_ACCESS(val_ptr);
48847         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
48848         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
48849                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48850                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
48851         }
48852         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
48853 }
48854
48855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
48856         LDKChannelManagerReadArgs this_ptr_conv;
48857         this_ptr_conv.inner = untag_ptr(this_ptr);
48858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48860         this_ptr_conv.is_owned = false;
48861         // WARNING: This object doesn't live past this scope, needs clone!
48862         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
48863         return ret_ret;
48864 }
48865
48866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48867         LDKChannelManagerReadArgs this_ptr_conv;
48868         this_ptr_conv.inner = untag_ptr(this_ptr);
48869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48871         this_ptr_conv.is_owned = false;
48872         void* val_ptr = untag_ptr(val);
48873         CHECK_ACCESS(val_ptr);
48874         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
48875         if (val_conv.free == LDKRouter_JCalls_free) {
48876                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48877                 LDKRouter_JCalls_cloned(&val_conv);
48878         }
48879         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
48880 }
48881
48882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
48883         LDKChannelManagerReadArgs this_ptr_conv;
48884         this_ptr_conv.inner = untag_ptr(this_ptr);
48885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48887         this_ptr_conv.is_owned = false;
48888         // WARNING: This object doesn't live past this scope, needs clone!
48889         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
48890         return ret_ret;
48891 }
48892
48893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48894         LDKChannelManagerReadArgs this_ptr_conv;
48895         this_ptr_conv.inner = untag_ptr(this_ptr);
48896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48898         this_ptr_conv.is_owned = false;
48899         void* val_ptr = untag_ptr(val);
48900         CHECK_ACCESS(val_ptr);
48901         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
48902         if (val_conv.free == LDKLogger_JCalls_free) {
48903                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48904                 LDKLogger_JCalls_cloned(&val_conv);
48905         }
48906         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
48907 }
48908
48909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
48910         LDKChannelManagerReadArgs this_ptr_conv;
48911         this_ptr_conv.inner = untag_ptr(this_ptr);
48912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48914         this_ptr_conv.is_owned = false;
48915         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
48916         int64_t ret_ref = 0;
48917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48919         return ret_ref;
48920 }
48921
48922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48923         LDKChannelManagerReadArgs this_ptr_conv;
48924         this_ptr_conv.inner = untag_ptr(this_ptr);
48925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48927         this_ptr_conv.is_owned = false;
48928         LDKUserConfig val_conv;
48929         val_conv.inner = untag_ptr(val);
48930         val_conv.is_owned = ptr_is_owned(val);
48931         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48932         val_conv = UserConfig_clone(&val_conv);
48933         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
48934 }
48935
48936 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) {
48937         void* entropy_source_ptr = untag_ptr(entropy_source);
48938         CHECK_ACCESS(entropy_source_ptr);
48939         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
48940         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
48941                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48942                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
48943         }
48944         void* node_signer_ptr = untag_ptr(node_signer);
48945         CHECK_ACCESS(node_signer_ptr);
48946         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
48947         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
48948                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48949                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
48950         }
48951         void* signer_provider_ptr = untag_ptr(signer_provider);
48952         CHECK_ACCESS(signer_provider_ptr);
48953         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
48954         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
48955                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48956                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
48957         }
48958         void* fee_estimator_ptr = untag_ptr(fee_estimator);
48959         CHECK_ACCESS(fee_estimator_ptr);
48960         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
48961         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
48962                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48963                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
48964         }
48965         void* chain_monitor_ptr = untag_ptr(chain_monitor);
48966         CHECK_ACCESS(chain_monitor_ptr);
48967         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
48968         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
48969                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48970                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
48971         }
48972         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
48973         CHECK_ACCESS(tx_broadcaster_ptr);
48974         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
48975         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
48976                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48977                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
48978         }
48979         void* router_ptr = untag_ptr(router);
48980         CHECK_ACCESS(router_ptr);
48981         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
48982         if (router_conv.free == LDKRouter_JCalls_free) {
48983                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48984                 LDKRouter_JCalls_cloned(&router_conv);
48985         }
48986         void* logger_ptr = untag_ptr(logger);
48987         CHECK_ACCESS(logger_ptr);
48988         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48989         if (logger_conv.free == LDKLogger_JCalls_free) {
48990                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48991                 LDKLogger_JCalls_cloned(&logger_conv);
48992         }
48993         LDKUserConfig default_config_conv;
48994         default_config_conv.inner = untag_ptr(default_config);
48995         default_config_conv.is_owned = ptr_is_owned(default_config);
48996         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
48997         default_config_conv = UserConfig_clone(&default_config_conv);
48998         LDKCVec_ChannelMonitorZ channel_monitors_constr;
48999         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
49000         if (channel_monitors_constr.datalen > 0)
49001                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
49002         else
49003                 channel_monitors_constr.data = NULL;
49004         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
49005         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
49006                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
49007                 LDKChannelMonitor channel_monitors_conv_16_conv;
49008                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
49009                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
49010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
49011                 channel_monitors_conv_16_conv.is_owned = false;
49012                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
49013         }
49014         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
49015         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);
49016         int64_t ret_ref = 0;
49017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49019         return ret_ref;
49020 }
49021
49022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
49023         LDKu8slice ser_ref;
49024         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49025         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49026         LDKChannelManagerReadArgs arg_conv;
49027         arg_conv.inner = untag_ptr(arg);
49028         arg_conv.is_owned = ptr_is_owned(arg);
49029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49030         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
49031         
49032         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
49033         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
49034         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49035         return tag_ptr(ret_conv, true);
49036 }
49037
49038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49039         LDKDelayedPaymentBasepoint this_obj_conv;
49040         this_obj_conv.inner = untag_ptr(this_obj);
49041         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49043         DelayedPaymentBasepoint_free(this_obj_conv);
49044 }
49045
49046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49047         LDKDelayedPaymentBasepoint this_ptr_conv;
49048         this_ptr_conv.inner = untag_ptr(this_ptr);
49049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49051         this_ptr_conv.is_owned = false;
49052         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49053         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form);
49054         return ret_arr;
49055 }
49056
49057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49058         LDKDelayedPaymentBasepoint this_ptr_conv;
49059         this_ptr_conv.inner = untag_ptr(this_ptr);
49060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49062         this_ptr_conv.is_owned = false;
49063         LDKPublicKey val_ref;
49064         CHECK((*env)->GetArrayLength(env, val) == 33);
49065         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49066         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
49067 }
49068
49069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49070         LDKPublicKey a_arg_ref;
49071         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49072         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49073         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
49074         int64_t ret_ref = 0;
49075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49077         return ret_ref;
49078 }
49079
49080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49081         LDKDelayedPaymentBasepoint a_conv;
49082         a_conv.inner = untag_ptr(a);
49083         a_conv.is_owned = ptr_is_owned(a);
49084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49085         a_conv.is_owned = false;
49086         LDKDelayedPaymentBasepoint b_conv;
49087         b_conv.inner = untag_ptr(b);
49088         b_conv.is_owned = ptr_is_owned(b);
49089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49090         b_conv.is_owned = false;
49091         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
49092         return ret_conv;
49093 }
49094
49095 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
49096         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
49097         int64_t ret_ref = 0;
49098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49100         return ret_ref;
49101 }
49102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49103         LDKDelayedPaymentBasepoint arg_conv;
49104         arg_conv.inner = untag_ptr(arg);
49105         arg_conv.is_owned = ptr_is_owned(arg);
49106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49107         arg_conv.is_owned = false;
49108         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
49109         return ret_conv;
49110 }
49111
49112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49113         LDKDelayedPaymentBasepoint orig_conv;
49114         orig_conv.inner = untag_ptr(orig);
49115         orig_conv.is_owned = ptr_is_owned(orig);
49116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49117         orig_conv.is_owned = false;
49118         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
49119         int64_t ret_ref = 0;
49120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49122         return ret_ref;
49123 }
49124
49125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49126         LDKDelayedPaymentBasepoint o_conv;
49127         o_conv.inner = untag_ptr(o);
49128         o_conv.is_owned = ptr_is_owned(o);
49129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49130         o_conv.is_owned = false;
49131         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
49132         return ret_conv;
49133 }
49134
49135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49136         LDKDelayedPaymentBasepoint this_arg_conv;
49137         this_arg_conv.inner = untag_ptr(this_arg);
49138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49140         this_arg_conv.is_owned = false;
49141         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49142         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form);
49143         return ret_arr;
49144 }
49145
49146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1derive_1add_1tweak(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray per_commitment_point) {
49147         LDKDelayedPaymentBasepoint this_arg_conv;
49148         this_arg_conv.inner = untag_ptr(this_arg);
49149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49151         this_arg_conv.is_owned = false;
49152         LDKPublicKey per_commitment_point_ref;
49153         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49154         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49155         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data);
49157         return ret_arr;
49158 }
49159
49160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49161         LDKDelayedPaymentBasepoint obj_conv;
49162         obj_conv.inner = untag_ptr(obj);
49163         obj_conv.is_owned = ptr_is_owned(obj);
49164         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49165         obj_conv.is_owned = false;
49166         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
49167         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49168         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49169         CVec_u8Z_free(ret_var);
49170         return ret_arr;
49171 }
49172
49173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49174         LDKu8slice ser_ref;
49175         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49176         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49177         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
49178         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
49179         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49180         return tag_ptr(ret_conv, true);
49181 }
49182
49183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49184         LDKDelayedPaymentKey this_obj_conv;
49185         this_obj_conv.inner = untag_ptr(this_obj);
49186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49188         DelayedPaymentKey_free(this_obj_conv);
49189 }
49190
49191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49192         LDKDelayedPaymentKey this_ptr_conv;
49193         this_ptr_conv.inner = untag_ptr(this_ptr);
49194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49196         this_ptr_conv.is_owned = false;
49197         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49198         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form);
49199         return ret_arr;
49200 }
49201
49202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49203         LDKDelayedPaymentKey this_ptr_conv;
49204         this_ptr_conv.inner = untag_ptr(this_ptr);
49205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49207         this_ptr_conv.is_owned = false;
49208         LDKPublicKey val_ref;
49209         CHECK((*env)->GetArrayLength(env, val) == 33);
49210         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49211         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
49212 }
49213
49214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49215         LDKPublicKey a_arg_ref;
49216         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49217         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49218         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
49219         int64_t ret_ref = 0;
49220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49222         return ret_ref;
49223 }
49224
49225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49226         LDKDelayedPaymentKey a_conv;
49227         a_conv.inner = untag_ptr(a);
49228         a_conv.is_owned = ptr_is_owned(a);
49229         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49230         a_conv.is_owned = false;
49231         LDKDelayedPaymentKey b_conv;
49232         b_conv.inner = untag_ptr(b);
49233         b_conv.is_owned = ptr_is_owned(b);
49234         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49235         b_conv.is_owned = false;
49236         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
49237         return ret_conv;
49238 }
49239
49240 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
49241         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
49242         int64_t ret_ref = 0;
49243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49245         return ret_ref;
49246 }
49247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49248         LDKDelayedPaymentKey arg_conv;
49249         arg_conv.inner = untag_ptr(arg);
49250         arg_conv.is_owned = ptr_is_owned(arg);
49251         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49252         arg_conv.is_owned = false;
49253         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
49254         return ret_conv;
49255 }
49256
49257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49258         LDKDelayedPaymentKey orig_conv;
49259         orig_conv.inner = untag_ptr(orig);
49260         orig_conv.is_owned = ptr_is_owned(orig);
49261         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49262         orig_conv.is_owned = false;
49263         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
49264         int64_t ret_ref = 0;
49265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49267         return ret_ref;
49268 }
49269
49270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
49271         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
49272         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
49273         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
49274         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
49275         countersignatory_basepoint_conv.is_owned = false;
49276         LDKPublicKey per_commitment_point_ref;
49277         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49278         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49279         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
49280         int64_t ret_ref = 0;
49281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49283         return ret_ref;
49284 }
49285
49286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
49287         uint8_t sk_arr[32];
49288         CHECK((*env)->GetArrayLength(env, sk) == 32);
49289         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
49290         uint8_t (*sk_ref)[32] = &sk_arr;
49291         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
49292         int64_t ret_ref = 0;
49293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49295         return ret_ref;
49296 }
49297
49298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49299         LDKDelayedPaymentKey this_arg_conv;
49300         this_arg_conv.inner = untag_ptr(this_arg);
49301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49303         this_arg_conv.is_owned = false;
49304         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49305         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form);
49306         return ret_arr;
49307 }
49308
49309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
49310         LDKDelayedPaymentKey obj_conv;
49311         obj_conv.inner = untag_ptr(obj);
49312         obj_conv.is_owned = ptr_is_owned(obj);
49313         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49314         obj_conv.is_owned = false;
49315         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
49316         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49317         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49318         CVec_u8Z_free(ret_var);
49319         return ret_arr;
49320 }
49321
49322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49323         LDKu8slice ser_ref;
49324         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49325         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49326         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
49327         *ret_conv = DelayedPaymentKey_read(ser_ref);
49328         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49329         return tag_ptr(ret_conv, true);
49330 }
49331
49332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49333         LDKHtlcBasepoint this_obj_conv;
49334         this_obj_conv.inner = untag_ptr(this_obj);
49335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49337         HtlcBasepoint_free(this_obj_conv);
49338 }
49339
49340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49341         LDKHtlcBasepoint this_ptr_conv;
49342         this_ptr_conv.inner = untag_ptr(this_ptr);
49343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49345         this_ptr_conv.is_owned = false;
49346         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49347         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form);
49348         return ret_arr;
49349 }
49350
49351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49352         LDKHtlcBasepoint this_ptr_conv;
49353         this_ptr_conv.inner = untag_ptr(this_ptr);
49354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49356         this_ptr_conv.is_owned = false;
49357         LDKPublicKey val_ref;
49358         CHECK((*env)->GetArrayLength(env, val) == 33);
49359         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49360         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
49361 }
49362
49363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49364         LDKPublicKey a_arg_ref;
49365         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49366         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49367         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
49368         int64_t ret_ref = 0;
49369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49371         return ret_ref;
49372 }
49373
49374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49375         LDKHtlcBasepoint a_conv;
49376         a_conv.inner = untag_ptr(a);
49377         a_conv.is_owned = ptr_is_owned(a);
49378         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49379         a_conv.is_owned = false;
49380         LDKHtlcBasepoint b_conv;
49381         b_conv.inner = untag_ptr(b);
49382         b_conv.is_owned = ptr_is_owned(b);
49383         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49384         b_conv.is_owned = false;
49385         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
49386         return ret_conv;
49387 }
49388
49389 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
49390         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
49391         int64_t ret_ref = 0;
49392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49394         return ret_ref;
49395 }
49396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49397         LDKHtlcBasepoint arg_conv;
49398         arg_conv.inner = untag_ptr(arg);
49399         arg_conv.is_owned = ptr_is_owned(arg);
49400         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49401         arg_conv.is_owned = false;
49402         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
49403         return ret_conv;
49404 }
49405
49406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49407         LDKHtlcBasepoint orig_conv;
49408         orig_conv.inner = untag_ptr(orig);
49409         orig_conv.is_owned = ptr_is_owned(orig);
49410         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49411         orig_conv.is_owned = false;
49412         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
49413         int64_t ret_ref = 0;
49414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49416         return ret_ref;
49417 }
49418
49419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49420         LDKHtlcBasepoint o_conv;
49421         o_conv.inner = untag_ptr(o);
49422         o_conv.is_owned = ptr_is_owned(o);
49423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49424         o_conv.is_owned = false;
49425         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
49426         return ret_conv;
49427 }
49428
49429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49430         LDKHtlcBasepoint this_arg_conv;
49431         this_arg_conv.inner = untag_ptr(this_arg);
49432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49434         this_arg_conv.is_owned = false;
49435         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49436         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form);
49437         return ret_arr;
49438 }
49439
49440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1derive_1add_1tweak(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray per_commitment_point) {
49441         LDKHtlcBasepoint this_arg_conv;
49442         this_arg_conv.inner = untag_ptr(this_arg);
49443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49445         this_arg_conv.is_owned = false;
49446         LDKPublicKey per_commitment_point_ref;
49447         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49448         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49449         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49450         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data);
49451         return ret_arr;
49452 }
49453
49454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49455         LDKHtlcBasepoint obj_conv;
49456         obj_conv.inner = untag_ptr(obj);
49457         obj_conv.is_owned = ptr_is_owned(obj);
49458         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49459         obj_conv.is_owned = false;
49460         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
49461         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49462         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49463         CVec_u8Z_free(ret_var);
49464         return ret_arr;
49465 }
49466
49467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49468         LDKu8slice ser_ref;
49469         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49470         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49471         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
49472         *ret_conv = HtlcBasepoint_read(ser_ref);
49473         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49474         return tag_ptr(ret_conv, true);
49475 }
49476
49477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49478         LDKHtlcKey this_obj_conv;
49479         this_obj_conv.inner = untag_ptr(this_obj);
49480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49482         HtlcKey_free(this_obj_conv);
49483 }
49484
49485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49486         LDKHtlcKey this_ptr_conv;
49487         this_ptr_conv.inner = untag_ptr(this_ptr);
49488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49490         this_ptr_conv.is_owned = false;
49491         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49492         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_get_a(&this_ptr_conv).compressed_form);
49493         return ret_arr;
49494 }
49495
49496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49497         LDKHtlcKey this_ptr_conv;
49498         this_ptr_conv.inner = untag_ptr(this_ptr);
49499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49501         this_ptr_conv.is_owned = false;
49502         LDKPublicKey val_ref;
49503         CHECK((*env)->GetArrayLength(env, val) == 33);
49504         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49505         HtlcKey_set_a(&this_ptr_conv, val_ref);
49506 }
49507
49508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49509         LDKPublicKey a_arg_ref;
49510         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49511         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49512         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
49513         int64_t ret_ref = 0;
49514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49516         return ret_ref;
49517 }
49518
49519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49520         LDKHtlcKey a_conv;
49521         a_conv.inner = untag_ptr(a);
49522         a_conv.is_owned = ptr_is_owned(a);
49523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49524         a_conv.is_owned = false;
49525         LDKHtlcKey b_conv;
49526         b_conv.inner = untag_ptr(b);
49527         b_conv.is_owned = ptr_is_owned(b);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49529         b_conv.is_owned = false;
49530         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
49531         return ret_conv;
49532 }
49533
49534 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
49535         LDKHtlcKey ret_var = HtlcKey_clone(arg);
49536         int64_t ret_ref = 0;
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49539         return ret_ref;
49540 }
49541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49542         LDKHtlcKey arg_conv;
49543         arg_conv.inner = untag_ptr(arg);
49544         arg_conv.is_owned = ptr_is_owned(arg);
49545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49546         arg_conv.is_owned = false;
49547         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
49548         return ret_conv;
49549 }
49550
49551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49552         LDKHtlcKey orig_conv;
49553         orig_conv.inner = untag_ptr(orig);
49554         orig_conv.is_owned = ptr_is_owned(orig);
49555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49556         orig_conv.is_owned = false;
49557         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
49558         int64_t ret_ref = 0;
49559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49561         return ret_ref;
49562 }
49563
49564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
49565         LDKHtlcBasepoint countersignatory_basepoint_conv;
49566         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
49567         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
49569         countersignatory_basepoint_conv.is_owned = false;
49570         LDKPublicKey per_commitment_point_ref;
49571         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49572         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49573         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
49574         int64_t ret_ref = 0;
49575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49577         return ret_ref;
49578 }
49579
49580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
49581         uint8_t sk_arr[32];
49582         CHECK((*env)->GetArrayLength(env, sk) == 32);
49583         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
49584         uint8_t (*sk_ref)[32] = &sk_arr;
49585         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
49586         int64_t ret_ref = 0;
49587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49589         return ret_ref;
49590 }
49591
49592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49593         LDKHtlcKey this_arg_conv;
49594         this_arg_conv.inner = untag_ptr(this_arg);
49595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49597         this_arg_conv.is_owned = false;
49598         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49599         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_to_public_key(&this_arg_conv).compressed_form);
49600         return ret_arr;
49601 }
49602
49603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
49604         LDKHtlcKey obj_conv;
49605         obj_conv.inner = untag_ptr(obj);
49606         obj_conv.is_owned = ptr_is_owned(obj);
49607         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49608         obj_conv.is_owned = false;
49609         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
49610         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49611         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49612         CVec_u8Z_free(ret_var);
49613         return ret_arr;
49614 }
49615
49616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49617         LDKu8slice ser_ref;
49618         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49619         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49620         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
49621         *ret_conv = HtlcKey_read(ser_ref);
49622         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49623         return tag_ptr(ret_conv, true);
49624 }
49625
49626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_add_1public_1key_1tweak(JNIEnv *env, jclass clz, int8_tArray base_point, int8_tArray tweak) {
49627         LDKPublicKey base_point_ref;
49628         CHECK((*env)->GetArrayLength(env, base_point) == 33);
49629         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
49630         uint8_t tweak_arr[32];
49631         CHECK((*env)->GetArrayLength(env, tweak) == 32);
49632         (*env)->GetByteArrayRegion(env, tweak, 0, 32, tweak_arr);
49633         uint8_t (*tweak_ref)[32] = &tweak_arr;
49634         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49635         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form);
49636         return ret_arr;
49637 }
49638
49639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49640         LDKRevocationBasepoint this_obj_conv;
49641         this_obj_conv.inner = untag_ptr(this_obj);
49642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49644         RevocationBasepoint_free(this_obj_conv);
49645 }
49646
49647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49648         LDKRevocationBasepoint this_ptr_conv;
49649         this_ptr_conv.inner = untag_ptr(this_ptr);
49650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49652         this_ptr_conv.is_owned = false;
49653         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49654         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form);
49655         return ret_arr;
49656 }
49657
49658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49659         LDKRevocationBasepoint this_ptr_conv;
49660         this_ptr_conv.inner = untag_ptr(this_ptr);
49661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49663         this_ptr_conv.is_owned = false;
49664         LDKPublicKey val_ref;
49665         CHECK((*env)->GetArrayLength(env, val) == 33);
49666         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49667         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
49668 }
49669
49670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49671         LDKPublicKey a_arg_ref;
49672         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49673         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49674         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
49675         int64_t ret_ref = 0;
49676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49678         return ret_ref;
49679 }
49680
49681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49682         LDKRevocationBasepoint a_conv;
49683         a_conv.inner = untag_ptr(a);
49684         a_conv.is_owned = ptr_is_owned(a);
49685         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49686         a_conv.is_owned = false;
49687         LDKRevocationBasepoint b_conv;
49688         b_conv.inner = untag_ptr(b);
49689         b_conv.is_owned = ptr_is_owned(b);
49690         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49691         b_conv.is_owned = false;
49692         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
49693         return ret_conv;
49694 }
49695
49696 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
49697         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
49698         int64_t ret_ref = 0;
49699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49701         return ret_ref;
49702 }
49703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49704         LDKRevocationBasepoint arg_conv;
49705         arg_conv.inner = untag_ptr(arg);
49706         arg_conv.is_owned = ptr_is_owned(arg);
49707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49708         arg_conv.is_owned = false;
49709         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
49710         return ret_conv;
49711 }
49712
49713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49714         LDKRevocationBasepoint orig_conv;
49715         orig_conv.inner = untag_ptr(orig);
49716         orig_conv.is_owned = ptr_is_owned(orig);
49717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49718         orig_conv.is_owned = false;
49719         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
49720         int64_t ret_ref = 0;
49721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49723         return ret_ref;
49724 }
49725
49726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49727         LDKRevocationBasepoint o_conv;
49728         o_conv.inner = untag_ptr(o);
49729         o_conv.is_owned = ptr_is_owned(o);
49730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49731         o_conv.is_owned = false;
49732         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
49733         return ret_conv;
49734 }
49735
49736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49737         LDKRevocationBasepoint this_arg_conv;
49738         this_arg_conv.inner = untag_ptr(this_arg);
49739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49741         this_arg_conv.is_owned = false;
49742         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49743         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form);
49744         return ret_arr;
49745 }
49746
49747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49748         LDKRevocationBasepoint obj_conv;
49749         obj_conv.inner = untag_ptr(obj);
49750         obj_conv.is_owned = ptr_is_owned(obj);
49751         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49752         obj_conv.is_owned = false;
49753         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
49754         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49755         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49756         CVec_u8Z_free(ret_var);
49757         return ret_arr;
49758 }
49759
49760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49761         LDKu8slice ser_ref;
49762         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49763         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49764         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
49765         *ret_conv = RevocationBasepoint_read(ser_ref);
49766         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49767         return tag_ptr(ret_conv, true);
49768 }
49769
49770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49771         LDKRevocationKey this_obj_conv;
49772         this_obj_conv.inner = untag_ptr(this_obj);
49773         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49775         RevocationKey_free(this_obj_conv);
49776 }
49777
49778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49779         LDKRevocationKey this_ptr_conv;
49780         this_ptr_conv.inner = untag_ptr(this_ptr);
49781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49783         this_ptr_conv.is_owned = false;
49784         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49785         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_get_a(&this_ptr_conv).compressed_form);
49786         return ret_arr;
49787 }
49788
49789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49790         LDKRevocationKey this_ptr_conv;
49791         this_ptr_conv.inner = untag_ptr(this_ptr);
49792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49794         this_ptr_conv.is_owned = false;
49795         LDKPublicKey val_ref;
49796         CHECK((*env)->GetArrayLength(env, val) == 33);
49797         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49798         RevocationKey_set_a(&this_ptr_conv, val_ref);
49799 }
49800
49801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49802         LDKPublicKey a_arg_ref;
49803         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49804         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49805         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
49806         int64_t ret_ref = 0;
49807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49809         return ret_ref;
49810 }
49811
49812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49813         LDKRevocationKey a_conv;
49814         a_conv.inner = untag_ptr(a);
49815         a_conv.is_owned = ptr_is_owned(a);
49816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49817         a_conv.is_owned = false;
49818         LDKRevocationKey b_conv;
49819         b_conv.inner = untag_ptr(b);
49820         b_conv.is_owned = ptr_is_owned(b);
49821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49822         b_conv.is_owned = false;
49823         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
49824         return ret_conv;
49825 }
49826
49827 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
49828         LDKRevocationKey ret_var = RevocationKey_clone(arg);
49829         int64_t ret_ref = 0;
49830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49832         return ret_ref;
49833 }
49834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49835         LDKRevocationKey arg_conv;
49836         arg_conv.inner = untag_ptr(arg);
49837         arg_conv.is_owned = ptr_is_owned(arg);
49838         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49839         arg_conv.is_owned = false;
49840         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
49841         return ret_conv;
49842 }
49843
49844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49845         LDKRevocationKey orig_conv;
49846         orig_conv.inner = untag_ptr(orig);
49847         orig_conv.is_owned = ptr_is_owned(orig);
49848         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49849         orig_conv.is_owned = false;
49850         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
49851         int64_t ret_ref = 0;
49852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49854         return ret_ref;
49855 }
49856
49857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
49858         LDKRevocationKey o_conv;
49859         o_conv.inner = untag_ptr(o);
49860         o_conv.is_owned = ptr_is_owned(o);
49861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49862         o_conv.is_owned = false;
49863         int64_t ret_conv = RevocationKey_hash(&o_conv);
49864         return ret_conv;
49865 }
49866
49867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
49868         LDKRevocationBasepoint countersignatory_basepoint_conv;
49869         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
49870         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
49871         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
49872         countersignatory_basepoint_conv.is_owned = false;
49873         LDKPublicKey per_commitment_point_ref;
49874         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49875         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49876         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
49877         int64_t ret_ref = 0;
49878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49880         return ret_ref;
49881 }
49882
49883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49884         LDKRevocationKey this_arg_conv;
49885         this_arg_conv.inner = untag_ptr(this_arg);
49886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49888         this_arg_conv.is_owned = false;
49889         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49890         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_to_public_key(&this_arg_conv).compressed_form);
49891         return ret_arr;
49892 }
49893
49894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
49895         LDKRevocationKey obj_conv;
49896         obj_conv.inner = untag_ptr(obj);
49897         obj_conv.is_owned = ptr_is_owned(obj);
49898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49899         obj_conv.is_owned = false;
49900         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
49901         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49902         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49903         CVec_u8Z_free(ret_var);
49904         return ret_arr;
49905 }
49906
49907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49908         LDKu8slice ser_ref;
49909         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49910         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49911         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
49912         *ret_conv = RevocationKey_read(ser_ref);
49913         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49914         return tag_ptr(ret_conv, true);
49915 }
49916
49917 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49918         LDKInboundHTLCStateDetails* orig_conv = (LDKInboundHTLCStateDetails*)untag_ptr(orig);
49919         jclass ret_conv = LDKInboundHTLCStateDetails_to_java(env, InboundHTLCStateDetails_clone(orig_conv));
49920         return ret_conv;
49921 }
49922
49923 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1awaiting_1remote_1revoke_1to_1add(JNIEnv *env, jclass clz) {
49924         jclass ret_conv = LDKInboundHTLCStateDetails_to_java(env, InboundHTLCStateDetails_awaiting_remote_revoke_to_add());
49925         return ret_conv;
49926 }
49927
49928 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1committed(JNIEnv *env, jclass clz) {
49929         jclass ret_conv = LDKInboundHTLCStateDetails_to_java(env, InboundHTLCStateDetails_committed());
49930         return ret_conv;
49931 }
49932
49933 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1awaiting_1remote_1revoke_1to_1remove_1fulfill(JNIEnv *env, jclass clz) {
49934         jclass ret_conv = LDKInboundHTLCStateDetails_to_java(env, InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill());
49935         return ret_conv;
49936 }
49937
49938 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1awaiting_1remote_1revoke_1to_1remove_1fail(JNIEnv *env, jclass clz) {
49939         jclass ret_conv = LDKInboundHTLCStateDetails_to_java(env, InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail());
49940         return ret_conv;
49941 }
49942
49943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
49944         LDKInboundHTLCStateDetails* obj_conv = (LDKInboundHTLCStateDetails*)untag_ptr(obj);
49945         LDKCVec_u8Z ret_var = InboundHTLCStateDetails_write(obj_conv);
49946         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49947         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49948         CVec_u8Z_free(ret_var);
49949         return ret_arr;
49950 }
49951
49952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCStateDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49953         LDKu8slice ser_ref;
49954         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49955         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49956         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
49957         *ret_conv = InboundHTLCStateDetails_read(ser_ref);
49958         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49959         return tag_ptr(ret_conv, true);
49960 }
49961
49962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49963         LDKInboundHTLCDetails this_obj_conv;
49964         this_obj_conv.inner = untag_ptr(this_obj);
49965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49967         InboundHTLCDetails_free(this_obj_conv);
49968 }
49969
49970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49971         LDKInboundHTLCDetails this_ptr_conv;
49972         this_ptr_conv.inner = untag_ptr(this_ptr);
49973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49975         this_ptr_conv.is_owned = false;
49976         int64_t ret_conv = InboundHTLCDetails_get_htlc_id(&this_ptr_conv);
49977         return ret_conv;
49978 }
49979
49980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49981         LDKInboundHTLCDetails this_ptr_conv;
49982         this_ptr_conv.inner = untag_ptr(this_ptr);
49983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49985         this_ptr_conv.is_owned = false;
49986         InboundHTLCDetails_set_htlc_id(&this_ptr_conv, val);
49987 }
49988
49989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49990         LDKInboundHTLCDetails 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         int64_t ret_conv = InboundHTLCDetails_get_amount_msat(&this_ptr_conv);
49996         return ret_conv;
49997 }
49998
49999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50000         LDKInboundHTLCDetails this_ptr_conv;
50001         this_ptr_conv.inner = untag_ptr(this_ptr);
50002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50004         this_ptr_conv.is_owned = false;
50005         InboundHTLCDetails_set_amount_msat(&this_ptr_conv, val);
50006 }
50007
50008 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
50009         LDKInboundHTLCDetails this_ptr_conv;
50010         this_ptr_conv.inner = untag_ptr(this_ptr);
50011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50013         this_ptr_conv.is_owned = false;
50014         int32_t ret_conv = InboundHTLCDetails_get_cltv_expiry(&this_ptr_conv);
50015         return ret_conv;
50016 }
50017
50018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50019         LDKInboundHTLCDetails this_ptr_conv;
50020         this_ptr_conv.inner = untag_ptr(this_ptr);
50021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50023         this_ptr_conv.is_owned = false;
50024         InboundHTLCDetails_set_cltv_expiry(&this_ptr_conv, val);
50025 }
50026
50027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50028         LDKInboundHTLCDetails this_ptr_conv;
50029         this_ptr_conv.inner = untag_ptr(this_ptr);
50030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50032         this_ptr_conv.is_owned = false;
50033         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50034         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InboundHTLCDetails_get_payment_hash(&this_ptr_conv));
50035         return ret_arr;
50036 }
50037
50038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50039         LDKInboundHTLCDetails this_ptr_conv;
50040         this_ptr_conv.inner = untag_ptr(this_ptr);
50041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50043         this_ptr_conv.is_owned = false;
50044         LDKThirtyTwoBytes val_ref;
50045         CHECK((*env)->GetArrayLength(env, val) == 32);
50046         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50047         InboundHTLCDetails_set_payment_hash(&this_ptr_conv, val_ref);
50048 }
50049
50050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1get_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
50051         LDKInboundHTLCDetails this_ptr_conv;
50052         this_ptr_conv.inner = untag_ptr(this_ptr);
50053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50055         this_ptr_conv.is_owned = false;
50056         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
50057         *ret_copy = InboundHTLCDetails_get_state(&this_ptr_conv);
50058         int64_t ret_ref = tag_ptr(ret_copy, true);
50059         return ret_ref;
50060 }
50061
50062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1set_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50063         LDKInboundHTLCDetails this_ptr_conv;
50064         this_ptr_conv.inner = untag_ptr(this_ptr);
50065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50067         this_ptr_conv.is_owned = false;
50068         void* val_ptr = untag_ptr(val);
50069         CHECK_ACCESS(val_ptr);
50070         LDKCOption_InboundHTLCStateDetailsZ val_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(val_ptr);
50071         val_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(val));
50072         InboundHTLCDetails_set_state(&this_ptr_conv, val_conv);
50073 }
50074
50075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1get_1is_1dust(JNIEnv *env, jclass clz, int64_t this_ptr) {
50076         LDKInboundHTLCDetails this_ptr_conv;
50077         this_ptr_conv.inner = untag_ptr(this_ptr);
50078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50080         this_ptr_conv.is_owned = false;
50081         jboolean ret_conv = InboundHTLCDetails_get_is_dust(&this_ptr_conv);
50082         return ret_conv;
50083 }
50084
50085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1set_1is_1dust(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50086         LDKInboundHTLCDetails 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         InboundHTLCDetails_set_is_dust(&this_ptr_conv, val);
50092 }
50093
50094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1new(JNIEnv *env, jclass clz, int64_t htlc_id_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t state_arg, jboolean is_dust_arg) {
50095         LDKThirtyTwoBytes payment_hash_arg_ref;
50096         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
50097         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
50098         void* state_arg_ptr = untag_ptr(state_arg);
50099         CHECK_ACCESS(state_arg_ptr);
50100         LDKCOption_InboundHTLCStateDetailsZ state_arg_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(state_arg_ptr);
50101         state_arg_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(state_arg));
50102         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_new(htlc_id_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, state_arg_conv, is_dust_arg);
50103         int64_t ret_ref = 0;
50104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50106         return ret_ref;
50107 }
50108
50109 static inline uint64_t InboundHTLCDetails_clone_ptr(LDKInboundHTLCDetails *NONNULL_PTR arg) {
50110         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_clone(arg);
50111         int64_t ret_ref = 0;
50112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50114         return ret_ref;
50115 }
50116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50117         LDKInboundHTLCDetails arg_conv;
50118         arg_conv.inner = untag_ptr(arg);
50119         arg_conv.is_owned = ptr_is_owned(arg);
50120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50121         arg_conv.is_owned = false;
50122         int64_t ret_conv = InboundHTLCDetails_clone_ptr(&arg_conv);
50123         return ret_conv;
50124 }
50125
50126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50127         LDKInboundHTLCDetails orig_conv;
50128         orig_conv.inner = untag_ptr(orig);
50129         orig_conv.is_owned = ptr_is_owned(orig);
50130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50131         orig_conv.is_owned = false;
50132         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_clone(&orig_conv);
50133         int64_t ret_ref = 0;
50134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50136         return ret_ref;
50137 }
50138
50139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
50140         LDKInboundHTLCDetails obj_conv;
50141         obj_conv.inner = untag_ptr(obj);
50142         obj_conv.is_owned = ptr_is_owned(obj);
50143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50144         obj_conv.is_owned = false;
50145         LDKCVec_u8Z ret_var = InboundHTLCDetails_write(&obj_conv);
50146         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50147         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50148         CVec_u8Z_free(ret_var);
50149         return ret_arr;
50150 }
50151
50152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50153         LDKu8slice ser_ref;
50154         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50155         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50156         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
50157         *ret_conv = InboundHTLCDetails_read(ser_ref);
50158         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50159         return tag_ptr(ret_conv, true);
50160 }
50161
50162 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50163         LDKOutboundHTLCStateDetails* orig_conv = (LDKOutboundHTLCStateDetails*)untag_ptr(orig);
50164         jclass ret_conv = LDKOutboundHTLCStateDetails_to_java(env, OutboundHTLCStateDetails_clone(orig_conv));
50165         return ret_conv;
50166 }
50167
50168 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1awaiting_1remote_1revoke_1to_1add(JNIEnv *env, jclass clz) {
50169         jclass ret_conv = LDKOutboundHTLCStateDetails_to_java(env, OutboundHTLCStateDetails_awaiting_remote_revoke_to_add());
50170         return ret_conv;
50171 }
50172
50173 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1committed(JNIEnv *env, jclass clz) {
50174         jclass ret_conv = LDKOutboundHTLCStateDetails_to_java(env, OutboundHTLCStateDetails_committed());
50175         return ret_conv;
50176 }
50177
50178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1awaiting_1remote_1revoke_1to_1remove_1success(JNIEnv *env, jclass clz) {
50179         jclass ret_conv = LDKOutboundHTLCStateDetails_to_java(env, OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success());
50180         return ret_conv;
50181 }
50182
50183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1awaiting_1remote_1revoke_1to_1remove_1failure(JNIEnv *env, jclass clz) {
50184         jclass ret_conv = LDKOutboundHTLCStateDetails_to_java(env, OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure());
50185         return ret_conv;
50186 }
50187
50188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
50189         LDKOutboundHTLCStateDetails* obj_conv = (LDKOutboundHTLCStateDetails*)untag_ptr(obj);
50190         LDKCVec_u8Z ret_var = OutboundHTLCStateDetails_write(obj_conv);
50191         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50192         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50193         CVec_u8Z_free(ret_var);
50194         return ret_arr;
50195 }
50196
50197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCStateDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50198         LDKu8slice ser_ref;
50199         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50200         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50201         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
50202         *ret_conv = OutboundHTLCStateDetails_read(ser_ref);
50203         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50204         return tag_ptr(ret_conv, true);
50205 }
50206
50207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50208         LDKOutboundHTLCDetails this_obj_conv;
50209         this_obj_conv.inner = untag_ptr(this_obj);
50210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50212         OutboundHTLCDetails_free(this_obj_conv);
50213 }
50214
50215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50216         LDKOutboundHTLCDetails this_ptr_conv;
50217         this_ptr_conv.inner = untag_ptr(this_ptr);
50218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50220         this_ptr_conv.is_owned = false;
50221         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50222         *ret_copy = OutboundHTLCDetails_get_htlc_id(&this_ptr_conv);
50223         int64_t ret_ref = tag_ptr(ret_copy, true);
50224         return ret_ref;
50225 }
50226
50227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50228         LDKOutboundHTLCDetails this_ptr_conv;
50229         this_ptr_conv.inner = untag_ptr(this_ptr);
50230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50232         this_ptr_conv.is_owned = false;
50233         void* val_ptr = untag_ptr(val);
50234         CHECK_ACCESS(val_ptr);
50235         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50236         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50237         OutboundHTLCDetails_set_htlc_id(&this_ptr_conv, val_conv);
50238 }
50239
50240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50241         LDKOutboundHTLCDetails this_ptr_conv;
50242         this_ptr_conv.inner = untag_ptr(this_ptr);
50243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50245         this_ptr_conv.is_owned = false;
50246         int64_t ret_conv = OutboundHTLCDetails_get_amount_msat(&this_ptr_conv);
50247         return ret_conv;
50248 }
50249
50250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50251         LDKOutboundHTLCDetails this_ptr_conv;
50252         this_ptr_conv.inner = untag_ptr(this_ptr);
50253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50255         this_ptr_conv.is_owned = false;
50256         OutboundHTLCDetails_set_amount_msat(&this_ptr_conv, val);
50257 }
50258
50259 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
50260         LDKOutboundHTLCDetails this_ptr_conv;
50261         this_ptr_conv.inner = untag_ptr(this_ptr);
50262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50264         this_ptr_conv.is_owned = false;
50265         int32_t ret_conv = OutboundHTLCDetails_get_cltv_expiry(&this_ptr_conv);
50266         return ret_conv;
50267 }
50268
50269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50270         LDKOutboundHTLCDetails this_ptr_conv;
50271         this_ptr_conv.inner = untag_ptr(this_ptr);
50272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50274         this_ptr_conv.is_owned = false;
50275         OutboundHTLCDetails_set_cltv_expiry(&this_ptr_conv, val);
50276 }
50277
50278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50279         LDKOutboundHTLCDetails this_ptr_conv;
50280         this_ptr_conv.inner = untag_ptr(this_ptr);
50281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50283         this_ptr_conv.is_owned = false;
50284         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50285         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutboundHTLCDetails_get_payment_hash(&this_ptr_conv));
50286         return ret_arr;
50287 }
50288
50289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50290         LDKOutboundHTLCDetails this_ptr_conv;
50291         this_ptr_conv.inner = untag_ptr(this_ptr);
50292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50294         this_ptr_conv.is_owned = false;
50295         LDKThirtyTwoBytes val_ref;
50296         CHECK((*env)->GetArrayLength(env, val) == 32);
50297         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50298         OutboundHTLCDetails_set_payment_hash(&this_ptr_conv, val_ref);
50299 }
50300
50301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
50302         LDKOutboundHTLCDetails this_ptr_conv;
50303         this_ptr_conv.inner = untag_ptr(this_ptr);
50304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50306         this_ptr_conv.is_owned = false;
50307         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
50308         *ret_copy = OutboundHTLCDetails_get_state(&this_ptr_conv);
50309         int64_t ret_ref = tag_ptr(ret_copy, true);
50310         return ret_ref;
50311 }
50312
50313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50314         LDKOutboundHTLCDetails this_ptr_conv;
50315         this_ptr_conv.inner = untag_ptr(this_ptr);
50316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50318         this_ptr_conv.is_owned = false;
50319         void* val_ptr = untag_ptr(val);
50320         CHECK_ACCESS(val_ptr);
50321         LDKCOption_OutboundHTLCStateDetailsZ val_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(val_ptr);
50322         val_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(val));
50323         OutboundHTLCDetails_set_state(&this_ptr_conv, val_conv);
50324 }
50325
50326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50327         LDKOutboundHTLCDetails this_ptr_conv;
50328         this_ptr_conv.inner = untag_ptr(this_ptr);
50329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50331         this_ptr_conv.is_owned = false;
50332         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50333         *ret_copy = OutboundHTLCDetails_get_skimmed_fee_msat(&this_ptr_conv);
50334         int64_t ret_ref = tag_ptr(ret_copy, true);
50335         return ret_ref;
50336 }
50337
50338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50339         LDKOutboundHTLCDetails this_ptr_conv;
50340         this_ptr_conv.inner = untag_ptr(this_ptr);
50341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50343         this_ptr_conv.is_owned = false;
50344         void* val_ptr = untag_ptr(val);
50345         CHECK_ACCESS(val_ptr);
50346         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50347         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50348         OutboundHTLCDetails_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
50349 }
50350
50351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1get_1is_1dust(JNIEnv *env, jclass clz, int64_t this_ptr) {
50352         LDKOutboundHTLCDetails this_ptr_conv;
50353         this_ptr_conv.inner = untag_ptr(this_ptr);
50354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50356         this_ptr_conv.is_owned = false;
50357         jboolean ret_conv = OutboundHTLCDetails_get_is_dust(&this_ptr_conv);
50358         return ret_conv;
50359 }
50360
50361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1set_1is_1dust(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50362         LDKOutboundHTLCDetails this_ptr_conv;
50363         this_ptr_conv.inner = untag_ptr(this_ptr);
50364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50366         this_ptr_conv.is_owned = false;
50367         OutboundHTLCDetails_set_is_dust(&this_ptr_conv, val);
50368 }
50369
50370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1new(JNIEnv *env, jclass clz, int64_t htlc_id_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t state_arg, int64_t skimmed_fee_msat_arg, jboolean is_dust_arg) {
50371         void* htlc_id_arg_ptr = untag_ptr(htlc_id_arg);
50372         CHECK_ACCESS(htlc_id_arg_ptr);
50373         LDKCOption_u64Z htlc_id_arg_conv = *(LDKCOption_u64Z*)(htlc_id_arg_ptr);
50374         htlc_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_id_arg));
50375         LDKThirtyTwoBytes payment_hash_arg_ref;
50376         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
50377         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
50378         void* state_arg_ptr = untag_ptr(state_arg);
50379         CHECK_ACCESS(state_arg_ptr);
50380         LDKCOption_OutboundHTLCStateDetailsZ state_arg_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(state_arg_ptr);
50381         state_arg_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(state_arg));
50382         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
50383         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
50384         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
50385         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
50386         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_new(htlc_id_arg_conv, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, state_arg_conv, skimmed_fee_msat_arg_conv, is_dust_arg);
50387         int64_t ret_ref = 0;
50388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50390         return ret_ref;
50391 }
50392
50393 static inline uint64_t OutboundHTLCDetails_clone_ptr(LDKOutboundHTLCDetails *NONNULL_PTR arg) {
50394         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_clone(arg);
50395         int64_t ret_ref = 0;
50396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50398         return ret_ref;
50399 }
50400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50401         LDKOutboundHTLCDetails arg_conv;
50402         arg_conv.inner = untag_ptr(arg);
50403         arg_conv.is_owned = ptr_is_owned(arg);
50404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50405         arg_conv.is_owned = false;
50406         int64_t ret_conv = OutboundHTLCDetails_clone_ptr(&arg_conv);
50407         return ret_conv;
50408 }
50409
50410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50411         LDKOutboundHTLCDetails orig_conv;
50412         orig_conv.inner = untag_ptr(orig);
50413         orig_conv.is_owned = ptr_is_owned(orig);
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50415         orig_conv.is_owned = false;
50416         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_clone(&orig_conv);
50417         int64_t ret_ref = 0;
50418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50420         return ret_ref;
50421 }
50422
50423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
50424         LDKOutboundHTLCDetails obj_conv;
50425         obj_conv.inner = untag_ptr(obj);
50426         obj_conv.is_owned = ptr_is_owned(obj);
50427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50428         obj_conv.is_owned = false;
50429         LDKCVec_u8Z ret_var = OutboundHTLCDetails_write(&obj_conv);
50430         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50431         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50432         CVec_u8Z_free(ret_var);
50433         return ret_arr;
50434 }
50435
50436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutboundHTLCDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50437         LDKu8slice ser_ref;
50438         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50439         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50440         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
50441         *ret_conv = OutboundHTLCDetails_read(ser_ref);
50442         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50443         return tag_ptr(ret_conv, true);
50444 }
50445
50446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50447         LDKCounterpartyForwardingInfo this_obj_conv;
50448         this_obj_conv.inner = untag_ptr(this_obj);
50449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50451         CounterpartyForwardingInfo_free(this_obj_conv);
50452 }
50453
50454 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50455         LDKCounterpartyForwardingInfo this_ptr_conv;
50456         this_ptr_conv.inner = untag_ptr(this_ptr);
50457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50459         this_ptr_conv.is_owned = false;
50460         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
50461         return ret_conv;
50462 }
50463
50464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50465         LDKCounterpartyForwardingInfo this_ptr_conv;
50466         this_ptr_conv.inner = untag_ptr(this_ptr);
50467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50469         this_ptr_conv.is_owned = false;
50470         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
50471 }
50472
50473 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
50474         LDKCounterpartyForwardingInfo this_ptr_conv;
50475         this_ptr_conv.inner = untag_ptr(this_ptr);
50476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50478         this_ptr_conv.is_owned = false;
50479         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
50480         return ret_conv;
50481 }
50482
50483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50484         LDKCounterpartyForwardingInfo this_ptr_conv;
50485         this_ptr_conv.inner = untag_ptr(this_ptr);
50486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50488         this_ptr_conv.is_owned = false;
50489         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
50490 }
50491
50492 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
50493         LDKCounterpartyForwardingInfo this_ptr_conv;
50494         this_ptr_conv.inner = untag_ptr(this_ptr);
50495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50497         this_ptr_conv.is_owned = false;
50498         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
50499         return ret_conv;
50500 }
50501
50502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
50503         LDKCounterpartyForwardingInfo this_ptr_conv;
50504         this_ptr_conv.inner = untag_ptr(this_ptr);
50505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50507         this_ptr_conv.is_owned = false;
50508         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
50509 }
50510
50511 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) {
50512         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
50513         int64_t ret_ref = 0;
50514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50516         return ret_ref;
50517 }
50518
50519 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
50520         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
50521         int64_t ret_ref = 0;
50522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50524         return ret_ref;
50525 }
50526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50527         LDKCounterpartyForwardingInfo arg_conv;
50528         arg_conv.inner = untag_ptr(arg);
50529         arg_conv.is_owned = ptr_is_owned(arg);
50530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50531         arg_conv.is_owned = false;
50532         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
50533         return ret_conv;
50534 }
50535
50536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50537         LDKCounterpartyForwardingInfo orig_conv;
50538         orig_conv.inner = untag_ptr(orig);
50539         orig_conv.is_owned = ptr_is_owned(orig);
50540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50541         orig_conv.is_owned = false;
50542         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
50543         int64_t ret_ref = 0;
50544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50546         return ret_ref;
50547 }
50548
50549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
50550         LDKCounterpartyForwardingInfo obj_conv;
50551         obj_conv.inner = untag_ptr(obj);
50552         obj_conv.is_owned = ptr_is_owned(obj);
50553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50554         obj_conv.is_owned = false;
50555         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
50556         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50557         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50558         CVec_u8Z_free(ret_var);
50559         return ret_arr;
50560 }
50561
50562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50563         LDKu8slice ser_ref;
50564         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50565         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50566         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
50567         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
50568         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50569         return tag_ptr(ret_conv, true);
50570 }
50571
50572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50573         LDKChannelCounterparty this_obj_conv;
50574         this_obj_conv.inner = untag_ptr(this_obj);
50575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50577         ChannelCounterparty_free(this_obj_conv);
50578 }
50579
50580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50581         LDKChannelCounterparty this_ptr_conv;
50582         this_ptr_conv.inner = untag_ptr(this_ptr);
50583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50585         this_ptr_conv.is_owned = false;
50586         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50587         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
50588         return ret_arr;
50589 }
50590
50591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50592         LDKChannelCounterparty this_ptr_conv;
50593         this_ptr_conv.inner = untag_ptr(this_ptr);
50594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50596         this_ptr_conv.is_owned = false;
50597         LDKPublicKey val_ref;
50598         CHECK((*env)->GetArrayLength(env, val) == 33);
50599         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50600         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
50601 }
50602
50603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
50604         LDKChannelCounterparty this_ptr_conv;
50605         this_ptr_conv.inner = untag_ptr(this_ptr);
50606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50608         this_ptr_conv.is_owned = false;
50609         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
50610         int64_t ret_ref = 0;
50611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50613         return ret_ref;
50614 }
50615
50616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50617         LDKChannelCounterparty this_ptr_conv;
50618         this_ptr_conv.inner = untag_ptr(this_ptr);
50619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50621         this_ptr_conv.is_owned = false;
50622         LDKInitFeatures val_conv;
50623         val_conv.inner = untag_ptr(val);
50624         val_conv.is_owned = ptr_is_owned(val);
50625         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50626         val_conv = InitFeatures_clone(&val_conv);
50627         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
50628 }
50629
50630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
50631         LDKChannelCounterparty this_ptr_conv;
50632         this_ptr_conv.inner = untag_ptr(this_ptr);
50633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50635         this_ptr_conv.is_owned = false;
50636         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
50637         return ret_conv;
50638 }
50639
50640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50641         LDKChannelCounterparty this_ptr_conv;
50642         this_ptr_conv.inner = untag_ptr(this_ptr);
50643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50645         this_ptr_conv.is_owned = false;
50646         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
50647 }
50648
50649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
50650         LDKChannelCounterparty this_ptr_conv;
50651         this_ptr_conv.inner = untag_ptr(this_ptr);
50652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50654         this_ptr_conv.is_owned = false;
50655         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
50656         int64_t ret_ref = 0;
50657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50659         return ret_ref;
50660 }
50661
50662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50663         LDKChannelCounterparty this_ptr_conv;
50664         this_ptr_conv.inner = untag_ptr(this_ptr);
50665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50667         this_ptr_conv.is_owned = false;
50668         LDKCounterpartyForwardingInfo val_conv;
50669         val_conv.inner = untag_ptr(val);
50670         val_conv.is_owned = ptr_is_owned(val);
50671         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50672         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
50673         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
50674 }
50675
50676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50677         LDKChannelCounterparty this_ptr_conv;
50678         this_ptr_conv.inner = untag_ptr(this_ptr);
50679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50681         this_ptr_conv.is_owned = false;
50682         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50683         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
50684         int64_t ret_ref = tag_ptr(ret_copy, true);
50685         return ret_ref;
50686 }
50687
50688 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) {
50689         LDKChannelCounterparty this_ptr_conv;
50690         this_ptr_conv.inner = untag_ptr(this_ptr);
50691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50693         this_ptr_conv.is_owned = false;
50694         void* val_ptr = untag_ptr(val);
50695         CHECK_ACCESS(val_ptr);
50696         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50697         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50698         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
50699 }
50700
50701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50702         LDKChannelCounterparty this_ptr_conv;
50703         this_ptr_conv.inner = untag_ptr(this_ptr);
50704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50706         this_ptr_conv.is_owned = false;
50707         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50708         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
50709         int64_t ret_ref = tag_ptr(ret_copy, true);
50710         return ret_ref;
50711 }
50712
50713 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) {
50714         LDKChannelCounterparty this_ptr_conv;
50715         this_ptr_conv.inner = untag_ptr(this_ptr);
50716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50718         this_ptr_conv.is_owned = false;
50719         void* val_ptr = untag_ptr(val);
50720         CHECK_ACCESS(val_ptr);
50721         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50722         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50723         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
50724 }
50725
50726 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) {
50727         LDKPublicKey node_id_arg_ref;
50728         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
50729         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
50730         LDKInitFeatures features_arg_conv;
50731         features_arg_conv.inner = untag_ptr(features_arg);
50732         features_arg_conv.is_owned = ptr_is_owned(features_arg);
50733         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
50734         features_arg_conv = InitFeatures_clone(&features_arg_conv);
50735         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
50736         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
50737         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
50738         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
50739         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
50740         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
50741         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
50742         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
50743         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
50744         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
50745         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
50746         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
50747         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
50748         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);
50749         int64_t ret_ref = 0;
50750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50752         return ret_ref;
50753 }
50754
50755 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
50756         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
50757         int64_t ret_ref = 0;
50758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50760         return ret_ref;
50761 }
50762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50763         LDKChannelCounterparty arg_conv;
50764         arg_conv.inner = untag_ptr(arg);
50765         arg_conv.is_owned = ptr_is_owned(arg);
50766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50767         arg_conv.is_owned = false;
50768         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
50769         return ret_conv;
50770 }
50771
50772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50773         LDKChannelCounterparty orig_conv;
50774         orig_conv.inner = untag_ptr(orig);
50775         orig_conv.is_owned = ptr_is_owned(orig);
50776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50777         orig_conv.is_owned = false;
50778         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
50779         int64_t ret_ref = 0;
50780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50782         return ret_ref;
50783 }
50784
50785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
50786         LDKChannelCounterparty obj_conv;
50787         obj_conv.inner = untag_ptr(obj);
50788         obj_conv.is_owned = ptr_is_owned(obj);
50789         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50790         obj_conv.is_owned = false;
50791         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
50792         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50793         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50794         CVec_u8Z_free(ret_var);
50795         return ret_arr;
50796 }
50797
50798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50799         LDKu8slice ser_ref;
50800         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50801         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50802         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
50803         *ret_conv = ChannelCounterparty_read(ser_ref);
50804         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50805         return tag_ptr(ret_conv, true);
50806 }
50807
50808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50809         LDKChannelDetails this_obj_conv;
50810         this_obj_conv.inner = untag_ptr(this_obj);
50811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50813         ChannelDetails_free(this_obj_conv);
50814 }
50815
50816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50817         LDKChannelDetails this_ptr_conv;
50818         this_ptr_conv.inner = untag_ptr(this_ptr);
50819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50821         this_ptr_conv.is_owned = false;
50822         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
50823         int64_t ret_ref = 0;
50824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50826         return ret_ref;
50827 }
50828
50829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50830         LDKChannelDetails this_ptr_conv;
50831         this_ptr_conv.inner = untag_ptr(this_ptr);
50832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50834         this_ptr_conv.is_owned = false;
50835         LDKChannelId val_conv;
50836         val_conv.inner = untag_ptr(val);
50837         val_conv.is_owned = ptr_is_owned(val);
50838         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50839         val_conv = ChannelId_clone(&val_conv);
50840         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
50841 }
50842
50843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
50844         LDKChannelDetails this_ptr_conv;
50845         this_ptr_conv.inner = untag_ptr(this_ptr);
50846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50848         this_ptr_conv.is_owned = false;
50849         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
50850         int64_t ret_ref = 0;
50851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50853         return ret_ref;
50854 }
50855
50856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50857         LDKChannelDetails this_ptr_conv;
50858         this_ptr_conv.inner = untag_ptr(this_ptr);
50859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50861         this_ptr_conv.is_owned = false;
50862         LDKChannelCounterparty val_conv;
50863         val_conv.inner = untag_ptr(val);
50864         val_conv.is_owned = ptr_is_owned(val);
50865         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50866         val_conv = ChannelCounterparty_clone(&val_conv);
50867         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
50868 }
50869
50870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
50871         LDKChannelDetails this_ptr_conv;
50872         this_ptr_conv.inner = untag_ptr(this_ptr);
50873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50875         this_ptr_conv.is_owned = false;
50876         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
50877         int64_t ret_ref = 0;
50878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50880         return ret_ref;
50881 }
50882
50883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50884         LDKChannelDetails this_ptr_conv;
50885         this_ptr_conv.inner = untag_ptr(this_ptr);
50886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50888         this_ptr_conv.is_owned = false;
50889         LDKOutPoint val_conv;
50890         val_conv.inner = untag_ptr(val);
50891         val_conv.is_owned = ptr_is_owned(val);
50892         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50893         val_conv = OutPoint_clone(&val_conv);
50894         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
50895 }
50896
50897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
50898         LDKChannelDetails this_ptr_conv;
50899         this_ptr_conv.inner = untag_ptr(this_ptr);
50900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50902         this_ptr_conv.is_owned = false;
50903         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
50904         int64_t ret_ref = 0;
50905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50907         return ret_ref;
50908 }
50909
50910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50911         LDKChannelDetails this_ptr_conv;
50912         this_ptr_conv.inner = untag_ptr(this_ptr);
50913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50915         this_ptr_conv.is_owned = false;
50916         LDKChannelTypeFeatures val_conv;
50917         val_conv.inner = untag_ptr(val);
50918         val_conv.is_owned = ptr_is_owned(val);
50919         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50920         val_conv = ChannelTypeFeatures_clone(&val_conv);
50921         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
50922 }
50923
50924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50925         LDKChannelDetails this_ptr_conv;
50926         this_ptr_conv.inner = untag_ptr(this_ptr);
50927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50929         this_ptr_conv.is_owned = false;
50930         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50931         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
50932         int64_t ret_ref = tag_ptr(ret_copy, true);
50933         return ret_ref;
50934 }
50935
50936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50937         LDKChannelDetails this_ptr_conv;
50938         this_ptr_conv.inner = untag_ptr(this_ptr);
50939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50941         this_ptr_conv.is_owned = false;
50942         void* val_ptr = untag_ptr(val);
50943         CHECK_ACCESS(val_ptr);
50944         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50945         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50946         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
50947 }
50948
50949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
50950         LDKChannelDetails this_ptr_conv;
50951         this_ptr_conv.inner = untag_ptr(this_ptr);
50952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50954         this_ptr_conv.is_owned = false;
50955         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50956         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
50957         int64_t ret_ref = tag_ptr(ret_copy, true);
50958         return ret_ref;
50959 }
50960
50961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50962         LDKChannelDetails this_ptr_conv;
50963         this_ptr_conv.inner = untag_ptr(this_ptr);
50964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50966         this_ptr_conv.is_owned = false;
50967         void* val_ptr = untag_ptr(val);
50968         CHECK_ACCESS(val_ptr);
50969         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50970         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50971         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
50972 }
50973
50974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
50975         LDKChannelDetails this_ptr_conv;
50976         this_ptr_conv.inner = untag_ptr(this_ptr);
50977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50979         this_ptr_conv.is_owned = false;
50980         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50981         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
50982         int64_t ret_ref = tag_ptr(ret_copy, true);
50983         return ret_ref;
50984 }
50985
50986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50987         LDKChannelDetails this_ptr_conv;
50988         this_ptr_conv.inner = untag_ptr(this_ptr);
50989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50991         this_ptr_conv.is_owned = false;
50992         void* val_ptr = untag_ptr(val);
50993         CHECK_ACCESS(val_ptr);
50994         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50995         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50996         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
50997 }
50998
50999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51000         LDKChannelDetails this_ptr_conv;
51001         this_ptr_conv.inner = untag_ptr(this_ptr);
51002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51004         this_ptr_conv.is_owned = false;
51005         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
51006         return ret_conv;
51007 }
51008
51009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51010         LDKChannelDetails this_ptr_conv;
51011         this_ptr_conv.inner = untag_ptr(this_ptr);
51012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51014         this_ptr_conv.is_owned = false;
51015         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
51016 }
51017
51018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
51019         LDKChannelDetails this_ptr_conv;
51020         this_ptr_conv.inner = untag_ptr(this_ptr);
51021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51023         this_ptr_conv.is_owned = false;
51024         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51025         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
51026         int64_t ret_ref = tag_ptr(ret_copy, true);
51027         return ret_ref;
51028 }
51029
51030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51031         LDKChannelDetails this_ptr_conv;
51032         this_ptr_conv.inner = untag_ptr(this_ptr);
51033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51035         this_ptr_conv.is_owned = false;
51036         void* val_ptr = untag_ptr(val);
51037         CHECK_ACCESS(val_ptr);
51038         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51039         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51040         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
51041 }
51042
51043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51044         LDKChannelDetails this_ptr_conv;
51045         this_ptr_conv.inner = untag_ptr(this_ptr);
51046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51048         this_ptr_conv.is_owned = false;
51049         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
51050         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
51051         return ret_arr;
51052 }
51053
51054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51055         LDKChannelDetails this_ptr_conv;
51056         this_ptr_conv.inner = untag_ptr(this_ptr);
51057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51059         this_ptr_conv.is_owned = false;
51060         LDKU128 val_ref;
51061         CHECK((*env)->GetArrayLength(env, val) == 16);
51062         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
51063         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
51064 }
51065
51066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
51067         LDKChannelDetails this_ptr_conv;
51068         this_ptr_conv.inner = untag_ptr(this_ptr);
51069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51071         this_ptr_conv.is_owned = false;
51072         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
51073         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
51074         int64_t ret_ref = tag_ptr(ret_copy, true);
51075         return ret_ref;
51076 }
51077
51078 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) {
51079         LDKChannelDetails this_ptr_conv;
51080         this_ptr_conv.inner = untag_ptr(this_ptr);
51081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51083         this_ptr_conv.is_owned = false;
51084         void* val_ptr = untag_ptr(val);
51085         CHECK_ACCESS(val_ptr);
51086         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
51087         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
51088         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
51089 }
51090
51091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51092         LDKChannelDetails this_ptr_conv;
51093         this_ptr_conv.inner = untag_ptr(this_ptr);
51094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51096         this_ptr_conv.is_owned = false;
51097         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
51098         return ret_conv;
51099 }
51100
51101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51102         LDKChannelDetails this_ptr_conv;
51103         this_ptr_conv.inner = untag_ptr(this_ptr);
51104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51106         this_ptr_conv.is_owned = false;
51107         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
51108 }
51109
51110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51111         LDKChannelDetails this_ptr_conv;
51112         this_ptr_conv.inner = untag_ptr(this_ptr);
51113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51115         this_ptr_conv.is_owned = false;
51116         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
51117         return ret_conv;
51118 }
51119
51120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51121         LDKChannelDetails this_ptr_conv;
51122         this_ptr_conv.inner = untag_ptr(this_ptr);
51123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51125         this_ptr_conv.is_owned = false;
51126         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
51127 }
51128
51129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51130         LDKChannelDetails this_ptr_conv;
51131         this_ptr_conv.inner = untag_ptr(this_ptr);
51132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51134         this_ptr_conv.is_owned = false;
51135         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
51136         return ret_conv;
51137 }
51138
51139 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) {
51140         LDKChannelDetails this_ptr_conv;
51141         this_ptr_conv.inner = untag_ptr(this_ptr);
51142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51144         this_ptr_conv.is_owned = false;
51145         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
51146 }
51147
51148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51149         LDKChannelDetails this_ptr_conv;
51150         this_ptr_conv.inner = untag_ptr(this_ptr);
51151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51153         this_ptr_conv.is_owned = false;
51154         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
51155         return ret_conv;
51156 }
51157
51158 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) {
51159         LDKChannelDetails this_ptr_conv;
51160         this_ptr_conv.inner = untag_ptr(this_ptr);
51161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51163         this_ptr_conv.is_owned = false;
51164         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
51165 }
51166
51167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51168         LDKChannelDetails this_ptr_conv;
51169         this_ptr_conv.inner = untag_ptr(this_ptr);
51170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51172         this_ptr_conv.is_owned = false;
51173         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
51174         return ret_conv;
51175 }
51176
51177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51178         LDKChannelDetails this_ptr_conv;
51179         this_ptr_conv.inner = untag_ptr(this_ptr);
51180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51182         this_ptr_conv.is_owned = false;
51183         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
51184 }
51185
51186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
51187         LDKChannelDetails this_ptr_conv;
51188         this_ptr_conv.inner = untag_ptr(this_ptr);
51189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51191         this_ptr_conv.is_owned = false;
51192         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
51193         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
51194         int64_t ret_ref = tag_ptr(ret_copy, true);
51195         return ret_ref;
51196 }
51197
51198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51199         LDKChannelDetails this_ptr_conv;
51200         this_ptr_conv.inner = untag_ptr(this_ptr);
51201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51203         this_ptr_conv.is_owned = false;
51204         void* val_ptr = untag_ptr(val);
51205         CHECK_ACCESS(val_ptr);
51206         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
51207         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
51208         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
51209 }
51210
51211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
51212         LDKChannelDetails this_ptr_conv;
51213         this_ptr_conv.inner = untag_ptr(this_ptr);
51214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51216         this_ptr_conv.is_owned = false;
51217         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
51218         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
51219         int64_t ret_ref = tag_ptr(ret_copy, true);
51220         return ret_ref;
51221 }
51222
51223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51224         LDKChannelDetails this_ptr_conv;
51225         this_ptr_conv.inner = untag_ptr(this_ptr);
51226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51228         this_ptr_conv.is_owned = false;
51229         void* val_ptr = untag_ptr(val);
51230         CHECK_ACCESS(val_ptr);
51231         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
51232         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
51233         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
51234 }
51235
51236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
51237         LDKChannelDetails this_ptr_conv;
51238         this_ptr_conv.inner = untag_ptr(this_ptr);
51239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51241         this_ptr_conv.is_owned = false;
51242         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
51243         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
51244         int64_t ret_ref = tag_ptr(ret_copy, true);
51245         return ret_ref;
51246 }
51247
51248 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) {
51249         LDKChannelDetails this_ptr_conv;
51250         this_ptr_conv.inner = untag_ptr(this_ptr);
51251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51253         this_ptr_conv.is_owned = false;
51254         void* val_ptr = untag_ptr(val);
51255         CHECK_ACCESS(val_ptr);
51256         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
51257         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
51258         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
51259 }
51260
51261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
51262         LDKChannelDetails this_ptr_conv;
51263         this_ptr_conv.inner = untag_ptr(this_ptr);
51264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51266         this_ptr_conv.is_owned = false;
51267         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
51268         return ret_conv;
51269 }
51270
51271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
51272         LDKChannelDetails this_ptr_conv;
51273         this_ptr_conv.inner = untag_ptr(this_ptr);
51274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51276         this_ptr_conv.is_owned = false;
51277         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
51278 }
51279
51280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
51281         LDKChannelDetails this_ptr_conv;
51282         this_ptr_conv.inner = untag_ptr(this_ptr);
51283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51285         this_ptr_conv.is_owned = false;
51286         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
51287         return ret_conv;
51288 }
51289
51290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
51291         LDKChannelDetails this_ptr_conv;
51292         this_ptr_conv.inner = untag_ptr(this_ptr);
51293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51295         this_ptr_conv.is_owned = false;
51296         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
51297 }
51298
51299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
51300         LDKChannelDetails this_ptr_conv;
51301         this_ptr_conv.inner = untag_ptr(this_ptr);
51302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51304         this_ptr_conv.is_owned = false;
51305         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
51306         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
51307         int64_t ret_ref = tag_ptr(ret_copy, true);
51308         return ret_ref;
51309 }
51310
51311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51312         LDKChannelDetails this_ptr_conv;
51313         this_ptr_conv.inner = untag_ptr(this_ptr);
51314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51316         this_ptr_conv.is_owned = false;
51317         void* val_ptr = untag_ptr(val);
51318         CHECK_ACCESS(val_ptr);
51319         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
51320         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
51321         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
51322 }
51323
51324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
51325         LDKChannelDetails this_ptr_conv;
51326         this_ptr_conv.inner = untag_ptr(this_ptr);
51327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51329         this_ptr_conv.is_owned = false;
51330         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
51331         return ret_conv;
51332 }
51333
51334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
51335         LDKChannelDetails this_ptr_conv;
51336         this_ptr_conv.inner = untag_ptr(this_ptr);
51337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51339         this_ptr_conv.is_owned = false;
51340         ChannelDetails_set_is_usable(&this_ptr_conv, val);
51341 }
51342
51343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
51344         LDKChannelDetails this_ptr_conv;
51345         this_ptr_conv.inner = untag_ptr(this_ptr);
51346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51348         this_ptr_conv.is_owned = false;
51349         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
51350         return ret_conv;
51351 }
51352
51353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
51354         LDKChannelDetails this_ptr_conv;
51355         this_ptr_conv.inner = untag_ptr(this_ptr);
51356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51358         this_ptr_conv.is_owned = false;
51359         ChannelDetails_set_is_public(&this_ptr_conv, val);
51360 }
51361
51362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51363         LDKChannelDetails this_ptr_conv;
51364         this_ptr_conv.inner = untag_ptr(this_ptr);
51365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51367         this_ptr_conv.is_owned = false;
51368         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51369         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
51370         int64_t ret_ref = tag_ptr(ret_copy, true);
51371         return ret_ref;
51372 }
51373
51374 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) {
51375         LDKChannelDetails this_ptr_conv;
51376         this_ptr_conv.inner = untag_ptr(this_ptr);
51377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51379         this_ptr_conv.is_owned = false;
51380         void* val_ptr = untag_ptr(val);
51381         CHECK_ACCESS(val_ptr);
51382         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51383         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51384         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
51385 }
51386
51387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51388         LDKChannelDetails this_ptr_conv;
51389         this_ptr_conv.inner = untag_ptr(this_ptr);
51390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51392         this_ptr_conv.is_owned = false;
51393         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51394         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
51395         int64_t ret_ref = tag_ptr(ret_copy, true);
51396         return ret_ref;
51397 }
51398
51399 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) {
51400         LDKChannelDetails this_ptr_conv;
51401         this_ptr_conv.inner = untag_ptr(this_ptr);
51402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51404         this_ptr_conv.is_owned = false;
51405         void* val_ptr = untag_ptr(val);
51406         CHECK_ACCESS(val_ptr);
51407         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51408         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51409         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
51410 }
51411
51412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
51413         LDKChannelDetails this_ptr_conv;
51414         this_ptr_conv.inner = untag_ptr(this_ptr);
51415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51417         this_ptr_conv.is_owned = false;
51418         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
51419         int64_t ret_ref = 0;
51420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51422         return ret_ref;
51423 }
51424
51425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51426         LDKChannelDetails this_ptr_conv;
51427         this_ptr_conv.inner = untag_ptr(this_ptr);
51428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51430         this_ptr_conv.is_owned = false;
51431         LDKChannelConfig val_conv;
51432         val_conv.inner = untag_ptr(val);
51433         val_conv.is_owned = ptr_is_owned(val);
51434         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51435         val_conv = ChannelConfig_clone(&val_conv);
51436         ChannelDetails_set_config(&this_ptr_conv, val_conv);
51437 }
51438
51439 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1pending_1inbound_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51440         LDKChannelDetails this_ptr_conv;
51441         this_ptr_conv.inner = untag_ptr(this_ptr);
51442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51444         this_ptr_conv.is_owned = false;
51445         LDKCVec_InboundHTLCDetailsZ ret_var = ChannelDetails_get_pending_inbound_htlcs(&this_ptr_conv);
51446         int64_tArray ret_arr = NULL;
51447         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
51448         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
51449         for (size_t u = 0; u < ret_var.datalen; u++) {
51450                 LDKInboundHTLCDetails ret_conv_20_var = ret_var.data[u];
51451                 int64_t ret_conv_20_ref = 0;
51452                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_20_var);
51453                 ret_conv_20_ref = tag_ptr(ret_conv_20_var.inner, ret_conv_20_var.is_owned);
51454                 ret_arr_ptr[u] = ret_conv_20_ref;
51455         }
51456         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
51457         FREE(ret_var.data);
51458         return ret_arr;
51459 }
51460
51461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1pending_1inbound_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
51462         LDKChannelDetails this_ptr_conv;
51463         this_ptr_conv.inner = untag_ptr(this_ptr);
51464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51466         this_ptr_conv.is_owned = false;
51467         LDKCVec_InboundHTLCDetailsZ val_constr;
51468         val_constr.datalen = (*env)->GetArrayLength(env, val);
51469         if (val_constr.datalen > 0)
51470                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
51471         else
51472                 val_constr.data = NULL;
51473         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
51474         for (size_t u = 0; u < val_constr.datalen; u++) {
51475                 int64_t val_conv_20 = val_vals[u];
51476                 LDKInboundHTLCDetails val_conv_20_conv;
51477                 val_conv_20_conv.inner = untag_ptr(val_conv_20);
51478                 val_conv_20_conv.is_owned = ptr_is_owned(val_conv_20);
51479                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_20_conv);
51480                 val_conv_20_conv = InboundHTLCDetails_clone(&val_conv_20_conv);
51481                 val_constr.data[u] = val_conv_20_conv;
51482         }
51483         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
51484         ChannelDetails_set_pending_inbound_htlcs(&this_ptr_conv, val_constr);
51485 }
51486
51487 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1pending_1outbound_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51488         LDKChannelDetails this_ptr_conv;
51489         this_ptr_conv.inner = untag_ptr(this_ptr);
51490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51492         this_ptr_conv.is_owned = false;
51493         LDKCVec_OutboundHTLCDetailsZ ret_var = ChannelDetails_get_pending_outbound_htlcs(&this_ptr_conv);
51494         int64_tArray ret_arr = NULL;
51495         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
51496         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
51497         for (size_t v = 0; v < ret_var.datalen; v++) {
51498                 LDKOutboundHTLCDetails ret_conv_21_var = ret_var.data[v];
51499                 int64_t ret_conv_21_ref = 0;
51500                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_21_var);
51501                 ret_conv_21_ref = tag_ptr(ret_conv_21_var.inner, ret_conv_21_var.is_owned);
51502                 ret_arr_ptr[v] = ret_conv_21_ref;
51503         }
51504         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
51505         FREE(ret_var.data);
51506         return ret_arr;
51507 }
51508
51509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1pending_1outbound_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
51510         LDKChannelDetails this_ptr_conv;
51511         this_ptr_conv.inner = untag_ptr(this_ptr);
51512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51514         this_ptr_conv.is_owned = false;
51515         LDKCVec_OutboundHTLCDetailsZ val_constr;
51516         val_constr.datalen = (*env)->GetArrayLength(env, val);
51517         if (val_constr.datalen > 0)
51518                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
51519         else
51520                 val_constr.data = NULL;
51521         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
51522         for (size_t v = 0; v < val_constr.datalen; v++) {
51523                 int64_t val_conv_21 = val_vals[v];
51524                 LDKOutboundHTLCDetails val_conv_21_conv;
51525                 val_conv_21_conv.inner = untag_ptr(val_conv_21);
51526                 val_conv_21_conv.is_owned = ptr_is_owned(val_conv_21);
51527                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_21_conv);
51528                 val_conv_21_conv = OutboundHTLCDetails_clone(&val_conv_21_conv);
51529                 val_constr.data[v] = val_conv_21_conv;
51530         }
51531         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
51532         ChannelDetails_set_pending_outbound_htlcs(&this_ptr_conv, val_constr);
51533 }
51534
51535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int64_t 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, int64_tArray pending_inbound_htlcs_arg, int64_tArray pending_outbound_htlcs_arg) {
51536         LDKChannelId channel_id_arg_conv;
51537         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51538         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51539         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51540         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51541         LDKChannelCounterparty counterparty_arg_conv;
51542         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
51543         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
51544         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
51545         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
51546         LDKOutPoint funding_txo_arg_conv;
51547         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
51548         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
51549         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
51550         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
51551         LDKChannelTypeFeatures channel_type_arg_conv;
51552         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
51553         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
51554         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
51555         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
51556         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
51557         CHECK_ACCESS(short_channel_id_arg_ptr);
51558         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
51559         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
51560         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
51561         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
51562         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
51563         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
51564         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
51565         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
51566         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
51567         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
51568         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
51569         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
51570         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
51571         LDKU128 user_channel_id_arg_ref;
51572         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
51573         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
51574         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
51575         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
51576         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
51577         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
51578         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
51579         CHECK_ACCESS(confirmations_required_arg_ptr);
51580         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
51581         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
51582         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
51583         CHECK_ACCESS(confirmations_arg_ptr);
51584         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
51585         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
51586         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
51587         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
51588         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
51589         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
51590         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
51591         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
51592         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
51593         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
51594         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
51595         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
51596         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
51597         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
51598         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
51599         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
51600         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
51601         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
51602         LDKChannelConfig config_arg_conv;
51603         config_arg_conv.inner = untag_ptr(config_arg);
51604         config_arg_conv.is_owned = ptr_is_owned(config_arg);
51605         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
51606         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
51607         LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg_constr;
51608         pending_inbound_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, pending_inbound_htlcs_arg);
51609         if (pending_inbound_htlcs_arg_constr.datalen > 0)
51610                 pending_inbound_htlcs_arg_constr.data = MALLOC(pending_inbound_htlcs_arg_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
51611         else
51612                 pending_inbound_htlcs_arg_constr.data = NULL;
51613         int64_t* pending_inbound_htlcs_arg_vals = (*env)->GetLongArrayElements (env, pending_inbound_htlcs_arg, NULL);
51614         for (size_t u = 0; u < pending_inbound_htlcs_arg_constr.datalen; u++) {
51615                 int64_t pending_inbound_htlcs_arg_conv_20 = pending_inbound_htlcs_arg_vals[u];
51616                 LDKInboundHTLCDetails pending_inbound_htlcs_arg_conv_20_conv;
51617                 pending_inbound_htlcs_arg_conv_20_conv.inner = untag_ptr(pending_inbound_htlcs_arg_conv_20);
51618                 pending_inbound_htlcs_arg_conv_20_conv.is_owned = ptr_is_owned(pending_inbound_htlcs_arg_conv_20);
51619                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_inbound_htlcs_arg_conv_20_conv);
51620                 pending_inbound_htlcs_arg_conv_20_conv = InboundHTLCDetails_clone(&pending_inbound_htlcs_arg_conv_20_conv);
51621                 pending_inbound_htlcs_arg_constr.data[u] = pending_inbound_htlcs_arg_conv_20_conv;
51622         }
51623         (*env)->ReleaseLongArrayElements(env, pending_inbound_htlcs_arg, pending_inbound_htlcs_arg_vals, 0);
51624         LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg_constr;
51625         pending_outbound_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, pending_outbound_htlcs_arg);
51626         if (pending_outbound_htlcs_arg_constr.datalen > 0)
51627                 pending_outbound_htlcs_arg_constr.data = MALLOC(pending_outbound_htlcs_arg_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
51628         else
51629                 pending_outbound_htlcs_arg_constr.data = NULL;
51630         int64_t* pending_outbound_htlcs_arg_vals = (*env)->GetLongArrayElements (env, pending_outbound_htlcs_arg, NULL);
51631         for (size_t v = 0; v < pending_outbound_htlcs_arg_constr.datalen; v++) {
51632                 int64_t pending_outbound_htlcs_arg_conv_21 = pending_outbound_htlcs_arg_vals[v];
51633                 LDKOutboundHTLCDetails pending_outbound_htlcs_arg_conv_21_conv;
51634                 pending_outbound_htlcs_arg_conv_21_conv.inner = untag_ptr(pending_outbound_htlcs_arg_conv_21);
51635                 pending_outbound_htlcs_arg_conv_21_conv.is_owned = ptr_is_owned(pending_outbound_htlcs_arg_conv_21);
51636                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_outbound_htlcs_arg_conv_21_conv);
51637                 pending_outbound_htlcs_arg_conv_21_conv = OutboundHTLCDetails_clone(&pending_outbound_htlcs_arg_conv_21_conv);
51638                 pending_outbound_htlcs_arg_constr.data[v] = pending_outbound_htlcs_arg_conv_21_conv;
51639         }
51640         (*env)->ReleaseLongArrayElements(env, pending_outbound_htlcs_arg, pending_outbound_htlcs_arg_vals, 0);
51641         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_conv, 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, pending_inbound_htlcs_arg_constr, pending_outbound_htlcs_arg_constr);
51642         int64_t ret_ref = 0;
51643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51645         return ret_ref;
51646 }
51647
51648 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
51649         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
51650         int64_t ret_ref = 0;
51651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51653         return ret_ref;
51654 }
51655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51656         LDKChannelDetails arg_conv;
51657         arg_conv.inner = untag_ptr(arg);
51658         arg_conv.is_owned = ptr_is_owned(arg);
51659         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51660         arg_conv.is_owned = false;
51661         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
51662         return ret_conv;
51663 }
51664
51665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51666         LDKChannelDetails orig_conv;
51667         orig_conv.inner = untag_ptr(orig);
51668         orig_conv.is_owned = ptr_is_owned(orig);
51669         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51670         orig_conv.is_owned = false;
51671         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
51672         int64_t ret_ref = 0;
51673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51675         return ret_ref;
51676 }
51677
51678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
51679         LDKChannelDetails this_arg_conv;
51680         this_arg_conv.inner = untag_ptr(this_arg);
51681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51683         this_arg_conv.is_owned = false;
51684         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51685         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
51686         int64_t ret_ref = tag_ptr(ret_copy, true);
51687         return ret_ref;
51688 }
51689
51690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
51691         LDKChannelDetails this_arg_conv;
51692         this_arg_conv.inner = untag_ptr(this_arg);
51693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51695         this_arg_conv.is_owned = false;
51696         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51697         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
51698         int64_t ret_ref = tag_ptr(ret_copy, true);
51699         return ret_ref;
51700 }
51701
51702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
51703         LDKChannelDetails obj_conv;
51704         obj_conv.inner = untag_ptr(obj);
51705         obj_conv.is_owned = ptr_is_owned(obj);
51706         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51707         obj_conv.is_owned = false;
51708         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
51709         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51710         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51711         CVec_u8Z_free(ret_var);
51712         return ret_arr;
51713 }
51714
51715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51716         LDKu8slice ser_ref;
51717         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51718         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51719         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
51720         *ret_conv = ChannelDetails_read(ser_ref);
51721         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51722         return tag_ptr(ret_conv, true);
51723 }
51724
51725 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51726         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
51727         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
51728         return ret_conv;
51729 }
51730
51731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
51732         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
51733         return ret_conv;
51734 }
51735
51736 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
51737         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
51738         return ret_conv;
51739 }
51740
51741 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
51742         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
51743         return ret_conv;
51744 }
51745
51746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
51747         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
51748         return ret_conv;
51749 }
51750
51751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
51752         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
51753         return ret_conv;
51754 }
51755
51756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51757         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
51758         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
51759         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
51760         return ret_conv;
51761 }
51762
51763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
51764         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
51765         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
51766         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51767         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51768         CVec_u8Z_free(ret_var);
51769         return ret_arr;
51770 }
51771
51772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51773         LDKu8slice ser_ref;
51774         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51775         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51776         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
51777         *ret_conv = ChannelShutdownState_read(ser_ref);
51778         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51779         return tag_ptr(ret_conv, true);
51780 }
51781
51782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51783         LDKExpandedKey this_obj_conv;
51784         this_obj_conv.inner = untag_ptr(this_obj);
51785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51787         ExpandedKey_free(this_obj_conv);
51788 }
51789
51790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
51791         uint8_t key_material_arr[32];
51792         CHECK((*env)->GetArrayLength(env, key_material) == 32);
51793         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
51794         uint8_t (*key_material_ref)[32] = &key_material_arr;
51795         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
51796         int64_t ret_ref = 0;
51797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51799         return ret_ref;
51800 }
51801
51802 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) {
51803         LDKExpandedKey keys_conv;
51804         keys_conv.inner = untag_ptr(keys);
51805         keys_conv.is_owned = ptr_is_owned(keys);
51806         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
51807         keys_conv.is_owned = false;
51808         void* min_value_msat_ptr = untag_ptr(min_value_msat);
51809         CHECK_ACCESS(min_value_msat_ptr);
51810         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
51811         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
51812         void* entropy_source_ptr = untag_ptr(entropy_source);
51813         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
51814         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
51815         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
51816         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
51817         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
51818         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
51819         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
51820         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
51821         return tag_ptr(ret_conv, true);
51822 }
51823
51824 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) {
51825         LDKExpandedKey keys_conv;
51826         keys_conv.inner = untag_ptr(keys);
51827         keys_conv.is_owned = ptr_is_owned(keys);
51828         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
51829         keys_conv.is_owned = false;
51830         void* min_value_msat_ptr = untag_ptr(min_value_msat);
51831         CHECK_ACCESS(min_value_msat_ptr);
51832         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
51833         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
51834         LDKThirtyTwoBytes payment_hash_ref;
51835         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
51836         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
51837         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
51838         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
51839         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
51840         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
51841         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
51842         *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);
51843         return tag_ptr(ret_conv, true);
51844 }
51845
51846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51847         if (!ptr_is_owned(this_ptr)) return;
51848         void* this_ptr_ptr = untag_ptr(this_ptr);
51849         CHECK_ACCESS(this_ptr_ptr);
51850         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
51851         FREE(untag_ptr(this_ptr));
51852         DecodeError_free(this_ptr_conv);
51853 }
51854
51855 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
51856         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51857         *ret_copy = DecodeError_clone(arg);
51858         int64_t ret_ref = tag_ptr(ret_copy, true);
51859         return ret_ref;
51860 }
51861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51862         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
51863         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
51864         return ret_conv;
51865 }
51866
51867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51868         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
51869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51870         *ret_copy = DecodeError_clone(orig_conv);
51871         int64_t ret_ref = tag_ptr(ret_copy, true);
51872         return ret_ref;
51873 }
51874
51875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
51876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51877         *ret_copy = DecodeError_unknown_version();
51878         int64_t ret_ref = tag_ptr(ret_copy, true);
51879         return ret_ref;
51880 }
51881
51882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
51883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51884         *ret_copy = DecodeError_unknown_required_feature();
51885         int64_t ret_ref = tag_ptr(ret_copy, true);
51886         return ret_ref;
51887 }
51888
51889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
51890         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51891         *ret_copy = DecodeError_invalid_value();
51892         int64_t ret_ref = tag_ptr(ret_copy, true);
51893         return ret_ref;
51894 }
51895
51896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
51897         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51898         *ret_copy = DecodeError_short_read();
51899         int64_t ret_ref = tag_ptr(ret_copy, true);
51900         return ret_ref;
51901 }
51902
51903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
51904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51905         *ret_copy = DecodeError_bad_length_descriptor();
51906         int64_t ret_ref = tag_ptr(ret_copy, true);
51907         return ret_ref;
51908 }
51909
51910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
51911         LDKIOError a_conv = LDKIOError_from_java(env, a);
51912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51913         *ret_copy = DecodeError_io(a_conv);
51914         int64_t ret_ref = tag_ptr(ret_copy, true);
51915         return ret_ref;
51916 }
51917
51918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
51919         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51920         *ret_copy = DecodeError_unsupported_compression();
51921         int64_t ret_ref = tag_ptr(ret_copy, true);
51922         return ret_ref;
51923 }
51924
51925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1dangerous_1value(JNIEnv *env, jclass clz) {
51926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
51927         *ret_copy = DecodeError_dangerous_value();
51928         int64_t ret_ref = tag_ptr(ret_copy, true);
51929         return ret_ref;
51930 }
51931
51932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1hash(JNIEnv *env, jclass clz, int64_t o) {
51933         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
51934         int64_t ret_conv = DecodeError_hash(o_conv);
51935         return ret_conv;
51936 }
51937
51938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51939         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
51940         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
51941         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
51942         return ret_conv;
51943 }
51944
51945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51946         LDKInit this_obj_conv;
51947         this_obj_conv.inner = untag_ptr(this_obj);
51948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51950         Init_free(this_obj_conv);
51951 }
51952
51953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
51954         LDKInit this_ptr_conv;
51955         this_ptr_conv.inner = untag_ptr(this_ptr);
51956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51958         this_ptr_conv.is_owned = false;
51959         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
51960         int64_t ret_ref = 0;
51961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51963         return ret_ref;
51964 }
51965
51966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51967         LDKInit this_ptr_conv;
51968         this_ptr_conv.inner = untag_ptr(this_ptr);
51969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51971         this_ptr_conv.is_owned = false;
51972         LDKInitFeatures val_conv;
51973         val_conv.inner = untag_ptr(val);
51974         val_conv.is_owned = ptr_is_owned(val);
51975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51976         val_conv = InitFeatures_clone(&val_conv);
51977         Init_set_features(&this_ptr_conv, val_conv);
51978 }
51979
51980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
51981         LDKInit this_ptr_conv;
51982         this_ptr_conv.inner = untag_ptr(this_ptr);
51983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51985         this_ptr_conv.is_owned = false;
51986         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
51987         *ret_copy = Init_get_networks(&this_ptr_conv);
51988         int64_t ret_ref = tag_ptr(ret_copy, true);
51989         return ret_ref;
51990 }
51991
51992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51993         LDKInit this_ptr_conv;
51994         this_ptr_conv.inner = untag_ptr(this_ptr);
51995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51997         this_ptr_conv.is_owned = false;
51998         void* val_ptr = untag_ptr(val);
51999         CHECK_ACCESS(val_ptr);
52000         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
52001         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
52002         Init_set_networks(&this_ptr_conv, val_conv);
52003 }
52004
52005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
52006         LDKInit this_ptr_conv;
52007         this_ptr_conv.inner = untag_ptr(this_ptr);
52008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52010         this_ptr_conv.is_owned = false;
52011         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
52012         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
52013         int64_t ret_ref = tag_ptr(ret_copy, true);
52014         return ret_ref;
52015 }
52016
52017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52018         LDKInit this_ptr_conv;
52019         this_ptr_conv.inner = untag_ptr(this_ptr);
52020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52022         this_ptr_conv.is_owned = false;
52023         void* val_ptr = untag_ptr(val);
52024         CHECK_ACCESS(val_ptr);
52025         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
52026         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
52027         Init_set_remote_network_address(&this_ptr_conv, val_conv);
52028 }
52029
52030 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) {
52031         LDKInitFeatures features_arg_conv;
52032         features_arg_conv.inner = untag_ptr(features_arg);
52033         features_arg_conv.is_owned = ptr_is_owned(features_arg);
52034         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
52035         features_arg_conv = InitFeatures_clone(&features_arg_conv);
52036         void* networks_arg_ptr = untag_ptr(networks_arg);
52037         CHECK_ACCESS(networks_arg_ptr);
52038         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
52039         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
52040         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
52041         CHECK_ACCESS(remote_network_address_arg_ptr);
52042         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
52043         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
52044         int64_t ret_ref = 0;
52045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52047         return ret_ref;
52048 }
52049
52050 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
52051         LDKInit ret_var = Init_clone(arg);
52052         int64_t ret_ref = 0;
52053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52055         return ret_ref;
52056 }
52057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52058         LDKInit arg_conv;
52059         arg_conv.inner = untag_ptr(arg);
52060         arg_conv.is_owned = ptr_is_owned(arg);
52061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52062         arg_conv.is_owned = false;
52063         int64_t ret_conv = Init_clone_ptr(&arg_conv);
52064         return ret_conv;
52065 }
52066
52067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52068         LDKInit orig_conv;
52069         orig_conv.inner = untag_ptr(orig);
52070         orig_conv.is_owned = ptr_is_owned(orig);
52071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52072         orig_conv.is_owned = false;
52073         LDKInit ret_var = Init_clone(&orig_conv);
52074         int64_t ret_ref = 0;
52075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52077         return ret_ref;
52078 }
52079
52080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1hash(JNIEnv *env, jclass clz, int64_t o) {
52081         LDKInit o_conv;
52082         o_conv.inner = untag_ptr(o);
52083         o_conv.is_owned = ptr_is_owned(o);
52084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52085         o_conv.is_owned = false;
52086         int64_t ret_conv = Init_hash(&o_conv);
52087         return ret_conv;
52088 }
52089
52090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52091         LDKInit a_conv;
52092         a_conv.inner = untag_ptr(a);
52093         a_conv.is_owned = ptr_is_owned(a);
52094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52095         a_conv.is_owned = false;
52096         LDKInit b_conv;
52097         b_conv.inner = untag_ptr(b);
52098         b_conv.is_owned = ptr_is_owned(b);
52099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52100         b_conv.is_owned = false;
52101         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
52102         return ret_conv;
52103 }
52104
52105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52106         LDKErrorMessage this_obj_conv;
52107         this_obj_conv.inner = untag_ptr(this_obj);
52108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52110         ErrorMessage_free(this_obj_conv);
52111 }
52112
52113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52114         LDKErrorMessage this_ptr_conv;
52115         this_ptr_conv.inner = untag_ptr(this_ptr);
52116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52118         this_ptr_conv.is_owned = false;
52119         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
52120         int64_t ret_ref = 0;
52121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52123         return ret_ref;
52124 }
52125
52126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52127         LDKErrorMessage this_ptr_conv;
52128         this_ptr_conv.inner = untag_ptr(this_ptr);
52129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52131         this_ptr_conv.is_owned = false;
52132         LDKChannelId val_conv;
52133         val_conv.inner = untag_ptr(val);
52134         val_conv.is_owned = ptr_is_owned(val);
52135         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52136         val_conv = ChannelId_clone(&val_conv);
52137         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
52138 }
52139
52140 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
52141         LDKErrorMessage this_ptr_conv;
52142         this_ptr_conv.inner = untag_ptr(this_ptr);
52143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52145         this_ptr_conv.is_owned = false;
52146         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
52147         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
52148         Str_free(ret_str);
52149         return ret_conv;
52150 }
52151
52152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
52153         LDKErrorMessage this_ptr_conv;
52154         this_ptr_conv.inner = untag_ptr(this_ptr);
52155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52157         this_ptr_conv.is_owned = false;
52158         LDKStr val_conv = java_to_owned_str(env, val);
52159         ErrorMessage_set_data(&this_ptr_conv, val_conv);
52160 }
52161
52162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, jstring data_arg) {
52163         LDKChannelId channel_id_arg_conv;
52164         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52165         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52166         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52167         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52168         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
52169         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
52170         int64_t ret_ref = 0;
52171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52173         return ret_ref;
52174 }
52175
52176 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
52177         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
52178         int64_t ret_ref = 0;
52179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52181         return ret_ref;
52182 }
52183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52184         LDKErrorMessage arg_conv;
52185         arg_conv.inner = untag_ptr(arg);
52186         arg_conv.is_owned = ptr_is_owned(arg);
52187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52188         arg_conv.is_owned = false;
52189         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
52190         return ret_conv;
52191 }
52192
52193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52194         LDKErrorMessage orig_conv;
52195         orig_conv.inner = untag_ptr(orig);
52196         orig_conv.is_owned = ptr_is_owned(orig);
52197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52198         orig_conv.is_owned = false;
52199         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
52200         int64_t ret_ref = 0;
52201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52203         return ret_ref;
52204 }
52205
52206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
52207         LDKErrorMessage o_conv;
52208         o_conv.inner = untag_ptr(o);
52209         o_conv.is_owned = ptr_is_owned(o);
52210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52211         o_conv.is_owned = false;
52212         int64_t ret_conv = ErrorMessage_hash(&o_conv);
52213         return ret_conv;
52214 }
52215
52216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52217         LDKErrorMessage a_conv;
52218         a_conv.inner = untag_ptr(a);
52219         a_conv.is_owned = ptr_is_owned(a);
52220         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52221         a_conv.is_owned = false;
52222         LDKErrorMessage b_conv;
52223         b_conv.inner = untag_ptr(b);
52224         b_conv.is_owned = ptr_is_owned(b);
52225         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52226         b_conv.is_owned = false;
52227         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
52228         return ret_conv;
52229 }
52230
52231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52232         LDKWarningMessage this_obj_conv;
52233         this_obj_conv.inner = untag_ptr(this_obj);
52234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52236         WarningMessage_free(this_obj_conv);
52237 }
52238
52239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52240         LDKWarningMessage this_ptr_conv;
52241         this_ptr_conv.inner = untag_ptr(this_ptr);
52242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52244         this_ptr_conv.is_owned = false;
52245         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
52246         int64_t ret_ref = 0;
52247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52249         return ret_ref;
52250 }
52251
52252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52253         LDKWarningMessage this_ptr_conv;
52254         this_ptr_conv.inner = untag_ptr(this_ptr);
52255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52257         this_ptr_conv.is_owned = false;
52258         LDKChannelId val_conv;
52259         val_conv.inner = untag_ptr(val);
52260         val_conv.is_owned = ptr_is_owned(val);
52261         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52262         val_conv = ChannelId_clone(&val_conv);
52263         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
52264 }
52265
52266 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
52267         LDKWarningMessage this_ptr_conv;
52268         this_ptr_conv.inner = untag_ptr(this_ptr);
52269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52271         this_ptr_conv.is_owned = false;
52272         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
52273         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
52274         Str_free(ret_str);
52275         return ret_conv;
52276 }
52277
52278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
52279         LDKWarningMessage this_ptr_conv;
52280         this_ptr_conv.inner = untag_ptr(this_ptr);
52281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52283         this_ptr_conv.is_owned = false;
52284         LDKStr val_conv = java_to_owned_str(env, val);
52285         WarningMessage_set_data(&this_ptr_conv, val_conv);
52286 }
52287
52288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, jstring data_arg) {
52289         LDKChannelId channel_id_arg_conv;
52290         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52291         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52292         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52293         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52294         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
52295         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
52296         int64_t ret_ref = 0;
52297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52299         return ret_ref;
52300 }
52301
52302 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
52303         LDKWarningMessage ret_var = WarningMessage_clone(arg);
52304         int64_t ret_ref = 0;
52305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52307         return ret_ref;
52308 }
52309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52310         LDKWarningMessage arg_conv;
52311         arg_conv.inner = untag_ptr(arg);
52312         arg_conv.is_owned = ptr_is_owned(arg);
52313         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52314         arg_conv.is_owned = false;
52315         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
52316         return ret_conv;
52317 }
52318
52319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52320         LDKWarningMessage orig_conv;
52321         orig_conv.inner = untag_ptr(orig);
52322         orig_conv.is_owned = ptr_is_owned(orig);
52323         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52324         orig_conv.is_owned = false;
52325         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
52326         int64_t ret_ref = 0;
52327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52329         return ret_ref;
52330 }
52331
52332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
52333         LDKWarningMessage o_conv;
52334         o_conv.inner = untag_ptr(o);
52335         o_conv.is_owned = ptr_is_owned(o);
52336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52337         o_conv.is_owned = false;
52338         int64_t ret_conv = WarningMessage_hash(&o_conv);
52339         return ret_conv;
52340 }
52341
52342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52343         LDKWarningMessage a_conv;
52344         a_conv.inner = untag_ptr(a);
52345         a_conv.is_owned = ptr_is_owned(a);
52346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52347         a_conv.is_owned = false;
52348         LDKWarningMessage b_conv;
52349         b_conv.inner = untag_ptr(b);
52350         b_conv.is_owned = ptr_is_owned(b);
52351         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52352         b_conv.is_owned = false;
52353         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
52354         return ret_conv;
52355 }
52356
52357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52358         LDKPing this_obj_conv;
52359         this_obj_conv.inner = untag_ptr(this_obj);
52360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52362         Ping_free(this_obj_conv);
52363 }
52364
52365 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
52366         LDKPing this_ptr_conv;
52367         this_ptr_conv.inner = untag_ptr(this_ptr);
52368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52370         this_ptr_conv.is_owned = false;
52371         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
52372         return ret_conv;
52373 }
52374
52375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52376         LDKPing this_ptr_conv;
52377         this_ptr_conv.inner = untag_ptr(this_ptr);
52378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52380         this_ptr_conv.is_owned = false;
52381         Ping_set_ponglen(&this_ptr_conv, val);
52382 }
52383
52384 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
52385         LDKPing this_ptr_conv;
52386         this_ptr_conv.inner = untag_ptr(this_ptr);
52387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52389         this_ptr_conv.is_owned = false;
52390         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
52391         return ret_conv;
52392 }
52393
52394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52395         LDKPing this_ptr_conv;
52396         this_ptr_conv.inner = untag_ptr(this_ptr);
52397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52399         this_ptr_conv.is_owned = false;
52400         Ping_set_byteslen(&this_ptr_conv, val);
52401 }
52402
52403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
52404         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
52405         int64_t ret_ref = 0;
52406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52408         return ret_ref;
52409 }
52410
52411 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
52412         LDKPing ret_var = Ping_clone(arg);
52413         int64_t ret_ref = 0;
52414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52416         return ret_ref;
52417 }
52418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52419         LDKPing arg_conv;
52420         arg_conv.inner = untag_ptr(arg);
52421         arg_conv.is_owned = ptr_is_owned(arg);
52422         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52423         arg_conv.is_owned = false;
52424         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
52425         return ret_conv;
52426 }
52427
52428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52429         LDKPing orig_conv;
52430         orig_conv.inner = untag_ptr(orig);
52431         orig_conv.is_owned = ptr_is_owned(orig);
52432         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52433         orig_conv.is_owned = false;
52434         LDKPing ret_var = Ping_clone(&orig_conv);
52435         int64_t ret_ref = 0;
52436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52438         return ret_ref;
52439 }
52440
52441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1hash(JNIEnv *env, jclass clz, int64_t o) {
52442         LDKPing o_conv;
52443         o_conv.inner = untag_ptr(o);
52444         o_conv.is_owned = ptr_is_owned(o);
52445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52446         o_conv.is_owned = false;
52447         int64_t ret_conv = Ping_hash(&o_conv);
52448         return ret_conv;
52449 }
52450
52451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52452         LDKPing a_conv;
52453         a_conv.inner = untag_ptr(a);
52454         a_conv.is_owned = ptr_is_owned(a);
52455         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52456         a_conv.is_owned = false;
52457         LDKPing b_conv;
52458         b_conv.inner = untag_ptr(b);
52459         b_conv.is_owned = ptr_is_owned(b);
52460         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52461         b_conv.is_owned = false;
52462         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
52463         return ret_conv;
52464 }
52465
52466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52467         LDKPong this_obj_conv;
52468         this_obj_conv.inner = untag_ptr(this_obj);
52469         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52471         Pong_free(this_obj_conv);
52472 }
52473
52474 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
52475         LDKPong this_ptr_conv;
52476         this_ptr_conv.inner = untag_ptr(this_ptr);
52477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52479         this_ptr_conv.is_owned = false;
52480         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
52481         return ret_conv;
52482 }
52483
52484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52485         LDKPong this_ptr_conv;
52486         this_ptr_conv.inner = untag_ptr(this_ptr);
52487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52489         this_ptr_conv.is_owned = false;
52490         Pong_set_byteslen(&this_ptr_conv, val);
52491 }
52492
52493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
52494         LDKPong ret_var = Pong_new(byteslen_arg);
52495         int64_t ret_ref = 0;
52496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52498         return ret_ref;
52499 }
52500
52501 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
52502         LDKPong ret_var = Pong_clone(arg);
52503         int64_t ret_ref = 0;
52504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52506         return ret_ref;
52507 }
52508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52509         LDKPong arg_conv;
52510         arg_conv.inner = untag_ptr(arg);
52511         arg_conv.is_owned = ptr_is_owned(arg);
52512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52513         arg_conv.is_owned = false;
52514         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
52515         return ret_conv;
52516 }
52517
52518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52519         LDKPong orig_conv;
52520         orig_conv.inner = untag_ptr(orig);
52521         orig_conv.is_owned = ptr_is_owned(orig);
52522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52523         orig_conv.is_owned = false;
52524         LDKPong ret_var = Pong_clone(&orig_conv);
52525         int64_t ret_ref = 0;
52526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52528         return ret_ref;
52529 }
52530
52531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1hash(JNIEnv *env, jclass clz, int64_t o) {
52532         LDKPong o_conv;
52533         o_conv.inner = untag_ptr(o);
52534         o_conv.is_owned = ptr_is_owned(o);
52535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52536         o_conv.is_owned = false;
52537         int64_t ret_conv = Pong_hash(&o_conv);
52538         return ret_conv;
52539 }
52540
52541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52542         LDKPong a_conv;
52543         a_conv.inner = untag_ptr(a);
52544         a_conv.is_owned = ptr_is_owned(a);
52545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52546         a_conv.is_owned = false;
52547         LDKPong b_conv;
52548         b_conv.inner = untag_ptr(b);
52549         b_conv.is_owned = ptr_is_owned(b);
52550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52551         b_conv.is_owned = false;
52552         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
52553         return ret_conv;
52554 }
52555
52556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52557         LDKCommonOpenChannelFields this_obj_conv;
52558         this_obj_conv.inner = untag_ptr(this_obj);
52559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52561         CommonOpenChannelFields_free(this_obj_conv);
52562 }
52563
52564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
52565         LDKCommonOpenChannelFields this_ptr_conv;
52566         this_ptr_conv.inner = untag_ptr(this_ptr);
52567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52569         this_ptr_conv.is_owned = false;
52570         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52571         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv));
52572         return ret_arr;
52573 }
52574
52575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52576         LDKCommonOpenChannelFields this_ptr_conv;
52577         this_ptr_conv.inner = untag_ptr(this_ptr);
52578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52580         this_ptr_conv.is_owned = false;
52581         LDKThirtyTwoBytes val_ref;
52582         CHECK((*env)->GetArrayLength(env, val) == 32);
52583         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52584         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
52585 }
52586
52587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52588         LDKCommonOpenChannelFields this_ptr_conv;
52589         this_ptr_conv.inner = untag_ptr(this_ptr);
52590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52592         this_ptr_conv.is_owned = false;
52593         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
52594         int64_t ret_ref = 0;
52595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52597         return ret_ref;
52598 }
52599
52600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52601         LDKCommonOpenChannelFields this_ptr_conv;
52602         this_ptr_conv.inner = untag_ptr(this_ptr);
52603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52605         this_ptr_conv.is_owned = false;
52606         LDKChannelId val_conv;
52607         val_conv.inner = untag_ptr(val);
52608         val_conv.is_owned = ptr_is_owned(val);
52609         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52610         val_conv = ChannelId_clone(&val_conv);
52611         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
52612 }
52613
52614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52615         LDKCommonOpenChannelFields this_ptr_conv;
52616         this_ptr_conv.inner = untag_ptr(this_ptr);
52617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52619         this_ptr_conv.is_owned = false;
52620         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
52621         return ret_conv;
52622 }
52623
52624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52625         LDKCommonOpenChannelFields this_ptr_conv;
52626         this_ptr_conv.inner = untag_ptr(this_ptr);
52627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52629         this_ptr_conv.is_owned = false;
52630         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
52631 }
52632
52633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52634         LDKCommonOpenChannelFields this_ptr_conv;
52635         this_ptr_conv.inner = untag_ptr(this_ptr);
52636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52638         this_ptr_conv.is_owned = false;
52639         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
52640         return ret_conv;
52641 }
52642
52643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52644         LDKCommonOpenChannelFields this_ptr_conv;
52645         this_ptr_conv.inner = untag_ptr(this_ptr);
52646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52648         this_ptr_conv.is_owned = false;
52649         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
52650 }
52651
52652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52653         LDKCommonOpenChannelFields this_ptr_conv;
52654         this_ptr_conv.inner = untag_ptr(this_ptr);
52655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52657         this_ptr_conv.is_owned = false;
52658         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
52659         return ret_conv;
52660 }
52661
52662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52663         LDKCommonOpenChannelFields this_ptr_conv;
52664         this_ptr_conv.inner = untag_ptr(this_ptr);
52665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52667         this_ptr_conv.is_owned = false;
52668         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
52669 }
52670
52671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52672         LDKCommonOpenChannelFields this_ptr_conv;
52673         this_ptr_conv.inner = untag_ptr(this_ptr);
52674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52676         this_ptr_conv.is_owned = false;
52677         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
52678         return ret_conv;
52679 }
52680
52681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52682         LDKCommonOpenChannelFields this_ptr_conv;
52683         this_ptr_conv.inner = untag_ptr(this_ptr);
52684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52686         this_ptr_conv.is_owned = false;
52687         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
52688 }
52689
52690 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
52691         LDKCommonOpenChannelFields this_ptr_conv;
52692         this_ptr_conv.inner = untag_ptr(this_ptr);
52693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52695         this_ptr_conv.is_owned = false;
52696         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
52697         return ret_conv;
52698 }
52699
52700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52701         LDKCommonOpenChannelFields this_ptr_conv;
52702         this_ptr_conv.inner = untag_ptr(this_ptr);
52703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52705         this_ptr_conv.is_owned = false;
52706         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
52707 }
52708
52709 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
52710         LDKCommonOpenChannelFields this_ptr_conv;
52711         this_ptr_conv.inner = untag_ptr(this_ptr);
52712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52714         this_ptr_conv.is_owned = false;
52715         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
52716         return ret_conv;
52717 }
52718
52719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52720         LDKCommonOpenChannelFields this_ptr_conv;
52721         this_ptr_conv.inner = untag_ptr(this_ptr);
52722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52724         this_ptr_conv.is_owned = false;
52725         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
52726 }
52727
52728 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
52729         LDKCommonOpenChannelFields this_ptr_conv;
52730         this_ptr_conv.inner = untag_ptr(this_ptr);
52731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52733         this_ptr_conv.is_owned = false;
52734         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
52735         return ret_conv;
52736 }
52737
52738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52739         LDKCommonOpenChannelFields this_ptr_conv;
52740         this_ptr_conv.inner = untag_ptr(this_ptr);
52741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52743         this_ptr_conv.is_owned = false;
52744         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
52745 }
52746
52747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52748         LDKCommonOpenChannelFields this_ptr_conv;
52749         this_ptr_conv.inner = untag_ptr(this_ptr);
52750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52752         this_ptr_conv.is_owned = false;
52753         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52754         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form);
52755         return ret_arr;
52756 }
52757
52758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52759         LDKCommonOpenChannelFields this_ptr_conv;
52760         this_ptr_conv.inner = untag_ptr(this_ptr);
52761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52763         this_ptr_conv.is_owned = false;
52764         LDKPublicKey val_ref;
52765         CHECK((*env)->GetArrayLength(env, val) == 33);
52766         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52767         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
52768 }
52769
52770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52771         LDKCommonOpenChannelFields this_ptr_conv;
52772         this_ptr_conv.inner = untag_ptr(this_ptr);
52773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52775         this_ptr_conv.is_owned = false;
52776         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52777         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form);
52778         return ret_arr;
52779 }
52780
52781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52782         LDKCommonOpenChannelFields this_ptr_conv;
52783         this_ptr_conv.inner = untag_ptr(this_ptr);
52784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52786         this_ptr_conv.is_owned = false;
52787         LDKPublicKey val_ref;
52788         CHECK((*env)->GetArrayLength(env, val) == 33);
52789         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52790         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
52791 }
52792
52793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52794         LDKCommonOpenChannelFields this_ptr_conv;
52795         this_ptr_conv.inner = untag_ptr(this_ptr);
52796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52798         this_ptr_conv.is_owned = false;
52799         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52800         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form);
52801         return ret_arr;
52802 }
52803
52804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52805         LDKCommonOpenChannelFields this_ptr_conv;
52806         this_ptr_conv.inner = untag_ptr(this_ptr);
52807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52809         this_ptr_conv.is_owned = false;
52810         LDKPublicKey val_ref;
52811         CHECK((*env)->GetArrayLength(env, val) == 33);
52812         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52813         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
52814 }
52815
52816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52817         LDKCommonOpenChannelFields this_ptr_conv;
52818         this_ptr_conv.inner = untag_ptr(this_ptr);
52819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52821         this_ptr_conv.is_owned = false;
52822         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52823         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
52824         return ret_arr;
52825 }
52826
52827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52828         LDKCommonOpenChannelFields this_ptr_conv;
52829         this_ptr_conv.inner = untag_ptr(this_ptr);
52830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52832         this_ptr_conv.is_owned = false;
52833         LDKPublicKey val_ref;
52834         CHECK((*env)->GetArrayLength(env, val) == 33);
52835         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52836         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
52837 }
52838
52839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52840         LDKCommonOpenChannelFields this_ptr_conv;
52841         this_ptr_conv.inner = untag_ptr(this_ptr);
52842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52844         this_ptr_conv.is_owned = false;
52845         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form);
52847         return ret_arr;
52848 }
52849
52850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52851         LDKCommonOpenChannelFields 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         LDKPublicKey val_ref;
52857         CHECK((*env)->GetArrayLength(env, val) == 33);
52858         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52859         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
52860 }
52861
52862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52863         LDKCommonOpenChannelFields this_ptr_conv;
52864         this_ptr_conv.inner = untag_ptr(this_ptr);
52865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52867         this_ptr_conv.is_owned = false;
52868         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52869         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
52870         return ret_arr;
52871 }
52872
52873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52874         LDKCommonOpenChannelFields this_ptr_conv;
52875         this_ptr_conv.inner = untag_ptr(this_ptr);
52876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52878         this_ptr_conv.is_owned = false;
52879         LDKPublicKey val_ref;
52880         CHECK((*env)->GetArrayLength(env, val) == 33);
52881         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52882         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
52883 }
52884
52885 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
52886         LDKCommonOpenChannelFields this_ptr_conv;
52887         this_ptr_conv.inner = untag_ptr(this_ptr);
52888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52890         this_ptr_conv.is_owned = false;
52891         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
52892         return ret_conv;
52893 }
52894
52895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
52896         LDKCommonOpenChannelFields this_ptr_conv;
52897         this_ptr_conv.inner = untag_ptr(this_ptr);
52898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52900         this_ptr_conv.is_owned = false;
52901         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
52902 }
52903
52904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52905         LDKCommonOpenChannelFields 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52911         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
52912         int64_t ret_ref = tag_ptr(ret_copy, true);
52913         return ret_ref;
52914 }
52915
52916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52917         LDKCommonOpenChannelFields this_ptr_conv;
52918         this_ptr_conv.inner = untag_ptr(this_ptr);
52919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52921         this_ptr_conv.is_owned = false;
52922         void* val_ptr = untag_ptr(val);
52923         CHECK_ACCESS(val_ptr);
52924         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
52925         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
52926         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
52927 }
52928
52929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
52930         LDKCommonOpenChannelFields this_ptr_conv;
52931         this_ptr_conv.inner = untag_ptr(this_ptr);
52932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52934         this_ptr_conv.is_owned = false;
52935         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
52936         int64_t ret_ref = 0;
52937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52939         return ret_ref;
52940 }
52941
52942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52943         LDKCommonOpenChannelFields this_ptr_conv;
52944         this_ptr_conv.inner = untag_ptr(this_ptr);
52945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52947         this_ptr_conv.is_owned = false;
52948         LDKChannelTypeFeatures val_conv;
52949         val_conv.inner = untag_ptr(val);
52950         val_conv.is_owned = ptr_is_owned(val);
52951         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52952         val_conv = ChannelTypeFeatures_clone(&val_conv);
52953         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
52954 }
52955
52956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t 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 commitment_feerate_sat_per_1000_weight_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_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
52957         LDKThirtyTwoBytes chain_hash_arg_ref;
52958         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
52959         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
52960         LDKChannelId temporary_channel_id_arg_conv;
52961         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
52962         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
52963         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
52964         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
52965         LDKPublicKey funding_pubkey_arg_ref;
52966         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
52967         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
52968         LDKPublicKey revocation_basepoint_arg_ref;
52969         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
52970         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
52971         LDKPublicKey payment_basepoint_arg_ref;
52972         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
52973         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
52974         LDKPublicKey delayed_payment_basepoint_arg_ref;
52975         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
52976         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
52977         LDKPublicKey htlc_basepoint_arg_ref;
52978         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
52979         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
52980         LDKPublicKey first_per_commitment_point_arg_ref;
52981         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
52982         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
52983         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
52984         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
52985         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
52986         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
52987         LDKChannelTypeFeatures channel_type_arg_conv;
52988         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
52989         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
52990         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
52991         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
52992         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_new(chain_hash_arg_ref, temporary_channel_id_arg_conv, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_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, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
52993         int64_t ret_ref = 0;
52994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52996         return ret_ref;
52997 }
52998
52999 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
53000         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
53001         int64_t ret_ref = 0;
53002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53004         return ret_ref;
53005 }
53006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53007         LDKCommonOpenChannelFields arg_conv;
53008         arg_conv.inner = untag_ptr(arg);
53009         arg_conv.is_owned = ptr_is_owned(arg);
53010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53011         arg_conv.is_owned = false;
53012         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
53013         return ret_conv;
53014 }
53015
53016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53017         LDKCommonOpenChannelFields orig_conv;
53018         orig_conv.inner = untag_ptr(orig);
53019         orig_conv.is_owned = ptr_is_owned(orig);
53020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53021         orig_conv.is_owned = false;
53022         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
53023         int64_t ret_ref = 0;
53024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53026         return ret_ref;
53027 }
53028
53029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1hash(JNIEnv *env, jclass clz, int64_t o) {
53030         LDKCommonOpenChannelFields o_conv;
53031         o_conv.inner = untag_ptr(o);
53032         o_conv.is_owned = ptr_is_owned(o);
53033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53034         o_conv.is_owned = false;
53035         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
53036         return ret_conv;
53037 }
53038
53039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53040         LDKCommonOpenChannelFields a_conv;
53041         a_conv.inner = untag_ptr(a);
53042         a_conv.is_owned = ptr_is_owned(a);
53043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53044         a_conv.is_owned = false;
53045         LDKCommonOpenChannelFields b_conv;
53046         b_conv.inner = untag_ptr(b);
53047         b_conv.is_owned = ptr_is_owned(b);
53048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53049         b_conv.is_owned = false;
53050         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
53051         return ret_conv;
53052 }
53053
53054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53055         LDKOpenChannel this_obj_conv;
53056         this_obj_conv.inner = untag_ptr(this_obj);
53057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53059         OpenChannel_free(this_obj_conv);
53060 }
53061
53062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
53063         LDKOpenChannel this_ptr_conv;
53064         this_ptr_conv.inner = untag_ptr(this_ptr);
53065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53067         this_ptr_conv.is_owned = false;
53068         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
53069         int64_t ret_ref = 0;
53070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53072         return ret_ref;
53073 }
53074
53075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53076         LDKOpenChannel this_ptr_conv;
53077         this_ptr_conv.inner = untag_ptr(this_ptr);
53078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53080         this_ptr_conv.is_owned = false;
53081         LDKCommonOpenChannelFields val_conv;
53082         val_conv.inner = untag_ptr(val);
53083         val_conv.is_owned = ptr_is_owned(val);
53084         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53085         val_conv = CommonOpenChannelFields_clone(&val_conv);
53086         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
53087 }
53088
53089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
53090         LDKOpenChannel this_ptr_conv;
53091         this_ptr_conv.inner = untag_ptr(this_ptr);
53092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53094         this_ptr_conv.is_owned = false;
53095         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
53096         return ret_conv;
53097 }
53098
53099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53100         LDKOpenChannel this_ptr_conv;
53101         this_ptr_conv.inner = untag_ptr(this_ptr);
53102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53104         this_ptr_conv.is_owned = false;
53105         OpenChannel_set_push_msat(&this_ptr_conv, val);
53106 }
53107
53108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53109         LDKOpenChannel this_ptr_conv;
53110         this_ptr_conv.inner = untag_ptr(this_ptr);
53111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53113         this_ptr_conv.is_owned = false;
53114         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
53115         return ret_conv;
53116 }
53117
53118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53119         LDKOpenChannel this_ptr_conv;
53120         this_ptr_conv.inner = untag_ptr(this_ptr);
53121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53123         this_ptr_conv.is_owned = false;
53124         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
53125 }
53126
53127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t push_msat_arg, int64_t channel_reserve_satoshis_arg) {
53128         LDKCommonOpenChannelFields common_fields_arg_conv;
53129         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
53130         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
53131         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
53132         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
53133         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
53134         int64_t ret_ref = 0;
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53137         return ret_ref;
53138 }
53139
53140 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
53141         LDKOpenChannel ret_var = OpenChannel_clone(arg);
53142         int64_t ret_ref = 0;
53143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53145         return ret_ref;
53146 }
53147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53148         LDKOpenChannel arg_conv;
53149         arg_conv.inner = untag_ptr(arg);
53150         arg_conv.is_owned = ptr_is_owned(arg);
53151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53152         arg_conv.is_owned = false;
53153         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
53154         return ret_conv;
53155 }
53156
53157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53158         LDKOpenChannel orig_conv;
53159         orig_conv.inner = untag_ptr(orig);
53160         orig_conv.is_owned = ptr_is_owned(orig);
53161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53162         orig_conv.is_owned = false;
53163         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
53164         int64_t ret_ref = 0;
53165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53167         return ret_ref;
53168 }
53169
53170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
53171         LDKOpenChannel o_conv;
53172         o_conv.inner = untag_ptr(o);
53173         o_conv.is_owned = ptr_is_owned(o);
53174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53175         o_conv.is_owned = false;
53176         int64_t ret_conv = OpenChannel_hash(&o_conv);
53177         return ret_conv;
53178 }
53179
53180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53181         LDKOpenChannel a_conv;
53182         a_conv.inner = untag_ptr(a);
53183         a_conv.is_owned = ptr_is_owned(a);
53184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53185         a_conv.is_owned = false;
53186         LDKOpenChannel b_conv;
53187         b_conv.inner = untag_ptr(b);
53188         b_conv.is_owned = ptr_is_owned(b);
53189         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53190         b_conv.is_owned = false;
53191         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
53192         return ret_conv;
53193 }
53194
53195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53196         LDKOpenChannelV2 this_obj_conv;
53197         this_obj_conv.inner = untag_ptr(this_obj);
53198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53200         OpenChannelV2_free(this_obj_conv);
53201 }
53202
53203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
53204         LDKOpenChannelV2 this_ptr_conv;
53205         this_ptr_conv.inner = untag_ptr(this_ptr);
53206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53208         this_ptr_conv.is_owned = false;
53209         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
53210         int64_t ret_ref = 0;
53211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53213         return ret_ref;
53214 }
53215
53216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53217         LDKOpenChannelV2 this_ptr_conv;
53218         this_ptr_conv.inner = untag_ptr(this_ptr);
53219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53221         this_ptr_conv.is_owned = false;
53222         LDKCommonOpenChannelFields val_conv;
53223         val_conv.inner = untag_ptr(val);
53224         val_conv.is_owned = ptr_is_owned(val);
53225         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53226         val_conv = CommonOpenChannelFields_clone(&val_conv);
53227         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
53228 }
53229
53230 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) {
53231         LDKOpenChannelV2 this_ptr_conv;
53232         this_ptr_conv.inner = untag_ptr(this_ptr);
53233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53235         this_ptr_conv.is_owned = false;
53236         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
53237         return ret_conv;
53238 }
53239
53240 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) {
53241         LDKOpenChannelV2 this_ptr_conv;
53242         this_ptr_conv.inner = untag_ptr(this_ptr);
53243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53245         this_ptr_conv.is_owned = false;
53246         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
53247 }
53248
53249 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
53250         LDKOpenChannelV2 this_ptr_conv;
53251         this_ptr_conv.inner = untag_ptr(this_ptr);
53252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53254         this_ptr_conv.is_owned = false;
53255         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
53256         return ret_conv;
53257 }
53258
53259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53260         LDKOpenChannelV2 this_ptr_conv;
53261         this_ptr_conv.inner = untag_ptr(this_ptr);
53262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53264         this_ptr_conv.is_owned = false;
53265         OpenChannelV2_set_locktime(&this_ptr_conv, val);
53266 }
53267
53268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53269         LDKOpenChannelV2 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53275         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
53276         return ret_arr;
53277 }
53278
53279 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) {
53280         LDKOpenChannelV2 this_ptr_conv;
53281         this_ptr_conv.inner = untag_ptr(this_ptr);
53282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53284         this_ptr_conv.is_owned = false;
53285         LDKPublicKey val_ref;
53286         CHECK((*env)->GetArrayLength(env, val) == 33);
53287         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53288         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
53289 }
53290
53291 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
53292         LDKOpenChannelV2 this_ptr_conv;
53293         this_ptr_conv.inner = untag_ptr(this_ptr);
53294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53296         this_ptr_conv.is_owned = false;
53297         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
53298         return ret_conv;
53299 }
53300
53301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
53302         LDKOpenChannelV2 this_ptr_conv;
53303         this_ptr_conv.inner = untag_ptr(this_ptr);
53304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53306         this_ptr_conv.is_owned = false;
53307         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
53308         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
53309 }
53310
53311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t locktime_arg, int8_tArray second_per_commitment_point_arg, jclass require_confirmed_inputs_arg) {
53312         LDKCommonOpenChannelFields common_fields_arg_conv;
53313         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
53314         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
53315         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
53316         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
53317         LDKPublicKey second_per_commitment_point_arg_ref;
53318         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
53319         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
53320         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
53321         LDKOpenChannelV2 ret_var = OpenChannelV2_new(common_fields_arg_conv, funding_feerate_sat_per_1000_weight_arg, locktime_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
53322         int64_t ret_ref = 0;
53323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53325         return ret_ref;
53326 }
53327
53328 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
53329         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
53330         int64_t ret_ref = 0;
53331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53333         return ret_ref;
53334 }
53335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53336         LDKOpenChannelV2 arg_conv;
53337         arg_conv.inner = untag_ptr(arg);
53338         arg_conv.is_owned = ptr_is_owned(arg);
53339         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53340         arg_conv.is_owned = false;
53341         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
53342         return ret_conv;
53343 }
53344
53345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53346         LDKOpenChannelV2 orig_conv;
53347         orig_conv.inner = untag_ptr(orig);
53348         orig_conv.is_owned = ptr_is_owned(orig);
53349         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53350         orig_conv.is_owned = false;
53351         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
53352         int64_t ret_ref = 0;
53353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53355         return ret_ref;
53356 }
53357
53358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
53359         LDKOpenChannelV2 o_conv;
53360         o_conv.inner = untag_ptr(o);
53361         o_conv.is_owned = ptr_is_owned(o);
53362         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53363         o_conv.is_owned = false;
53364         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
53365         return ret_conv;
53366 }
53367
53368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53369         LDKOpenChannelV2 a_conv;
53370         a_conv.inner = untag_ptr(a);
53371         a_conv.is_owned = ptr_is_owned(a);
53372         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53373         a_conv.is_owned = false;
53374         LDKOpenChannelV2 b_conv;
53375         b_conv.inner = untag_ptr(b);
53376         b_conv.is_owned = ptr_is_owned(b);
53377         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53378         b_conv.is_owned = false;
53379         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
53380         return ret_conv;
53381 }
53382
53383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53384         LDKCommonAcceptChannelFields this_obj_conv;
53385         this_obj_conv.inner = untag_ptr(this_obj);
53386         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53388         CommonAcceptChannelFields_free(this_obj_conv);
53389 }
53390
53391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53392         LDKCommonAcceptChannelFields this_ptr_conv;
53393         this_ptr_conv.inner = untag_ptr(this_ptr);
53394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53396         this_ptr_conv.is_owned = false;
53397         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
53398         int64_t ret_ref = 0;
53399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53401         return ret_ref;
53402 }
53403
53404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53405         LDKCommonAcceptChannelFields this_ptr_conv;
53406         this_ptr_conv.inner = untag_ptr(this_ptr);
53407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53409         this_ptr_conv.is_owned = false;
53410         LDKChannelId val_conv;
53411         val_conv.inner = untag_ptr(val);
53412         val_conv.is_owned = ptr_is_owned(val);
53413         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53414         val_conv = ChannelId_clone(&val_conv);
53415         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
53416 }
53417
53418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53419         LDKCommonAcceptChannelFields this_ptr_conv;
53420         this_ptr_conv.inner = untag_ptr(this_ptr);
53421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53423         this_ptr_conv.is_owned = false;
53424         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
53425         return ret_conv;
53426 }
53427
53428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53429         LDKCommonAcceptChannelFields this_ptr_conv;
53430         this_ptr_conv.inner = untag_ptr(this_ptr);
53431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53433         this_ptr_conv.is_owned = false;
53434         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
53435 }
53436
53437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
53438         LDKCommonAcceptChannelFields this_ptr_conv;
53439         this_ptr_conv.inner = untag_ptr(this_ptr);
53440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53442         this_ptr_conv.is_owned = false;
53443         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
53444         return ret_conv;
53445 }
53446
53447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53448         LDKCommonAcceptChannelFields this_ptr_conv;
53449         this_ptr_conv.inner = untag_ptr(this_ptr);
53450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53452         this_ptr_conv.is_owned = false;
53453         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
53454 }
53455
53456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
53457         LDKCommonAcceptChannelFields this_ptr_conv;
53458         this_ptr_conv.inner = untag_ptr(this_ptr);
53459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53461         this_ptr_conv.is_owned = false;
53462         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
53463         return ret_conv;
53464 }
53465
53466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53467         LDKCommonAcceptChannelFields this_ptr_conv;
53468         this_ptr_conv.inner = untag_ptr(this_ptr);
53469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53471         this_ptr_conv.is_owned = false;
53472         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
53473 }
53474
53475 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
53476         LDKCommonAcceptChannelFields this_ptr_conv;
53477         this_ptr_conv.inner = untag_ptr(this_ptr);
53478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53480         this_ptr_conv.is_owned = false;
53481         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
53482         return ret_conv;
53483 }
53484
53485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53486         LDKCommonAcceptChannelFields this_ptr_conv;
53487         this_ptr_conv.inner = untag_ptr(this_ptr);
53488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53490         this_ptr_conv.is_owned = false;
53491         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
53492 }
53493
53494 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53495         LDKCommonAcceptChannelFields this_ptr_conv;
53496         this_ptr_conv.inner = untag_ptr(this_ptr);
53497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53499         this_ptr_conv.is_owned = false;
53500         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
53501         return ret_conv;
53502 }
53503
53504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
53505         LDKCommonAcceptChannelFields this_ptr_conv;
53506         this_ptr_conv.inner = untag_ptr(this_ptr);
53507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53509         this_ptr_conv.is_owned = false;
53510         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
53511 }
53512
53513 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
53514         LDKCommonAcceptChannelFields this_ptr_conv;
53515         this_ptr_conv.inner = untag_ptr(this_ptr);
53516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53518         this_ptr_conv.is_owned = false;
53519         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
53520         return ret_conv;
53521 }
53522
53523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
53524         LDKCommonAcceptChannelFields this_ptr_conv;
53525         this_ptr_conv.inner = untag_ptr(this_ptr);
53526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53528         this_ptr_conv.is_owned = false;
53529         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
53530 }
53531
53532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53533         LDKCommonAcceptChannelFields this_ptr_conv;
53534         this_ptr_conv.inner = untag_ptr(this_ptr);
53535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53537         this_ptr_conv.is_owned = false;
53538         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53539         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form);
53540         return ret_arr;
53541 }
53542
53543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53544         LDKCommonAcceptChannelFields this_ptr_conv;
53545         this_ptr_conv.inner = untag_ptr(this_ptr);
53546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53548         this_ptr_conv.is_owned = false;
53549         LDKPublicKey val_ref;
53550         CHECK((*env)->GetArrayLength(env, val) == 33);
53551         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53552         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
53553 }
53554
53555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53556         LDKCommonAcceptChannelFields this_ptr_conv;
53557         this_ptr_conv.inner = untag_ptr(this_ptr);
53558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53560         this_ptr_conv.is_owned = false;
53561         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53562         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form);
53563         return ret_arr;
53564 }
53565
53566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53567         LDKCommonAcceptChannelFields this_ptr_conv;
53568         this_ptr_conv.inner = untag_ptr(this_ptr);
53569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53571         this_ptr_conv.is_owned = false;
53572         LDKPublicKey val_ref;
53573         CHECK((*env)->GetArrayLength(env, val) == 33);
53574         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53575         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
53576 }
53577
53578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53579         LDKCommonAcceptChannelFields this_ptr_conv;
53580         this_ptr_conv.inner = untag_ptr(this_ptr);
53581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53583         this_ptr_conv.is_owned = false;
53584         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53585         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form);
53586         return ret_arr;
53587 }
53588
53589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53590         LDKCommonAcceptChannelFields this_ptr_conv;
53591         this_ptr_conv.inner = untag_ptr(this_ptr);
53592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53594         this_ptr_conv.is_owned = false;
53595         LDKPublicKey val_ref;
53596         CHECK((*env)->GetArrayLength(env, val) == 33);
53597         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53598         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
53599 }
53600
53601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53602         LDKCommonAcceptChannelFields this_ptr_conv;
53603         this_ptr_conv.inner = untag_ptr(this_ptr);
53604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53606         this_ptr_conv.is_owned = false;
53607         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53608         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
53609         return ret_arr;
53610 }
53611
53612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53613         LDKCommonAcceptChannelFields this_ptr_conv;
53614         this_ptr_conv.inner = untag_ptr(this_ptr);
53615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53617         this_ptr_conv.is_owned = false;
53618         LDKPublicKey val_ref;
53619         CHECK((*env)->GetArrayLength(env, val) == 33);
53620         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53621         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
53622 }
53623
53624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53625         LDKCommonAcceptChannelFields this_ptr_conv;
53626         this_ptr_conv.inner = untag_ptr(this_ptr);
53627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53629         this_ptr_conv.is_owned = false;
53630         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53631         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form);
53632         return ret_arr;
53633 }
53634
53635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53636         LDKCommonAcceptChannelFields this_ptr_conv;
53637         this_ptr_conv.inner = untag_ptr(this_ptr);
53638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53640         this_ptr_conv.is_owned = false;
53641         LDKPublicKey val_ref;
53642         CHECK((*env)->GetArrayLength(env, val) == 33);
53643         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53644         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
53645 }
53646
53647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53648         LDKCommonAcceptChannelFields this_ptr_conv;
53649         this_ptr_conv.inner = untag_ptr(this_ptr);
53650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53652         this_ptr_conv.is_owned = false;
53653         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53654         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
53655         return ret_arr;
53656 }
53657
53658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53659         LDKCommonAcceptChannelFields this_ptr_conv;
53660         this_ptr_conv.inner = untag_ptr(this_ptr);
53661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53663         this_ptr_conv.is_owned = false;
53664         LDKPublicKey val_ref;
53665         CHECK((*env)->GetArrayLength(env, val) == 33);
53666         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53667         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
53668 }
53669
53670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53671         LDKCommonAcceptChannelFields this_ptr_conv;
53672         this_ptr_conv.inner = untag_ptr(this_ptr);
53673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53675         this_ptr_conv.is_owned = false;
53676         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
53677         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
53678         int64_t ret_ref = tag_ptr(ret_copy, true);
53679         return ret_ref;
53680 }
53681
53682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53683         LDKCommonAcceptChannelFields this_ptr_conv;
53684         this_ptr_conv.inner = untag_ptr(this_ptr);
53685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53687         this_ptr_conv.is_owned = false;
53688         void* val_ptr = untag_ptr(val);
53689         CHECK_ACCESS(val_ptr);
53690         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
53691         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
53692         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
53693 }
53694
53695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
53696         LDKCommonAcceptChannelFields this_ptr_conv;
53697         this_ptr_conv.inner = untag_ptr(this_ptr);
53698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53700         this_ptr_conv.is_owned = false;
53701         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
53702         int64_t ret_ref = 0;
53703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53705         return ret_ref;
53706 }
53707
53708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53709         LDKCommonAcceptChannelFields this_ptr_conv;
53710         this_ptr_conv.inner = untag_ptr(this_ptr);
53711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53713         this_ptr_conv.is_owned = false;
53714         LDKChannelTypeFeatures val_conv;
53715         val_conv.inner = untag_ptr(val);
53716         val_conv.is_owned = ptr_is_owned(val);
53717         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53718         val_conv = ChannelTypeFeatures_clone(&val_conv);
53719         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
53720 }
53721
53722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1new(JNIEnv *env, jclass clz, int64_t temporary_channel_id_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, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
53723         LDKChannelId temporary_channel_id_arg_conv;
53724         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
53725         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
53726         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
53727         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
53728         LDKPublicKey funding_pubkey_arg_ref;
53729         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53730         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53731         LDKPublicKey revocation_basepoint_arg_ref;
53732         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
53733         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
53734         LDKPublicKey payment_basepoint_arg_ref;
53735         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
53736         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
53737         LDKPublicKey delayed_payment_basepoint_arg_ref;
53738         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
53739         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
53740         LDKPublicKey htlc_basepoint_arg_ref;
53741         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
53742         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
53743         LDKPublicKey first_per_commitment_point_arg_ref;
53744         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
53745         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
53746         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
53747         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
53748         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
53749         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
53750         LDKChannelTypeFeatures channel_type_arg_conv;
53751         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
53752         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
53753         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
53754         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
53755         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_new(temporary_channel_id_arg_conv, 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, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
53756         int64_t ret_ref = 0;
53757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53759         return ret_ref;
53760 }
53761
53762 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
53763         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
53764         int64_t ret_ref = 0;
53765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53767         return ret_ref;
53768 }
53769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53770         LDKCommonAcceptChannelFields arg_conv;
53771         arg_conv.inner = untag_ptr(arg);
53772         arg_conv.is_owned = ptr_is_owned(arg);
53773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53774         arg_conv.is_owned = false;
53775         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
53776         return ret_conv;
53777 }
53778
53779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53780         LDKCommonAcceptChannelFields orig_conv;
53781         orig_conv.inner = untag_ptr(orig);
53782         orig_conv.is_owned = ptr_is_owned(orig);
53783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53784         orig_conv.is_owned = false;
53785         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
53786         int64_t ret_ref = 0;
53787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53789         return ret_ref;
53790 }
53791
53792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1hash(JNIEnv *env, jclass clz, int64_t o) {
53793         LDKCommonAcceptChannelFields o_conv;
53794         o_conv.inner = untag_ptr(o);
53795         o_conv.is_owned = ptr_is_owned(o);
53796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53797         o_conv.is_owned = false;
53798         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
53799         return ret_conv;
53800 }
53801
53802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53803         LDKCommonAcceptChannelFields a_conv;
53804         a_conv.inner = untag_ptr(a);
53805         a_conv.is_owned = ptr_is_owned(a);
53806         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53807         a_conv.is_owned = false;
53808         LDKCommonAcceptChannelFields b_conv;
53809         b_conv.inner = untag_ptr(b);
53810         b_conv.is_owned = ptr_is_owned(b);
53811         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53812         b_conv.is_owned = false;
53813         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
53814         return ret_conv;
53815 }
53816
53817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53818         LDKAcceptChannel this_obj_conv;
53819         this_obj_conv.inner = untag_ptr(this_obj);
53820         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53822         AcceptChannel_free(this_obj_conv);
53823 }
53824
53825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
53826         LDKAcceptChannel this_ptr_conv;
53827         this_ptr_conv.inner = untag_ptr(this_ptr);
53828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53830         this_ptr_conv.is_owned = false;
53831         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
53832         int64_t ret_ref = 0;
53833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53835         return ret_ref;
53836 }
53837
53838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53839         LDKAcceptChannel this_ptr_conv;
53840         this_ptr_conv.inner = untag_ptr(this_ptr);
53841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53843         this_ptr_conv.is_owned = false;
53844         LDKCommonAcceptChannelFields val_conv;
53845         val_conv.inner = untag_ptr(val);
53846         val_conv.is_owned = ptr_is_owned(val);
53847         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53848         val_conv = CommonAcceptChannelFields_clone(&val_conv);
53849         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
53850 }
53851
53852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53853         LDKAcceptChannel this_ptr_conv;
53854         this_ptr_conv.inner = untag_ptr(this_ptr);
53855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53857         this_ptr_conv.is_owned = false;
53858         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
53859         return ret_conv;
53860 }
53861
53862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53863         LDKAcceptChannel this_ptr_conv;
53864         this_ptr_conv.inner = untag_ptr(this_ptr);
53865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53867         this_ptr_conv.is_owned = false;
53868         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
53869 }
53870
53871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
53872         LDKCommonAcceptChannelFields common_fields_arg_conv;
53873         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
53874         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
53875         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
53876         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
53877         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
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 AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
53885         LDKAcceptChannel ret_var = AcceptChannel_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_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53892         LDKAcceptChannel 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 = AcceptChannel_clone_ptr(&arg_conv);
53898         return ret_conv;
53899 }
53900
53901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53902         LDKAcceptChannel 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         LDKAcceptChannel ret_var = AcceptChannel_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 int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
53915         LDKAcceptChannel o_conv;
53916         o_conv.inner = untag_ptr(o);
53917         o_conv.is_owned = ptr_is_owned(o);
53918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53919         o_conv.is_owned = false;
53920         int64_t ret_conv = AcceptChannel_hash(&o_conv);
53921         return ret_conv;
53922 }
53923
53924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53925         LDKAcceptChannel a_conv;
53926         a_conv.inner = untag_ptr(a);
53927         a_conv.is_owned = ptr_is_owned(a);
53928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53929         a_conv.is_owned = false;
53930         LDKAcceptChannel b_conv;
53931         b_conv.inner = untag_ptr(b);
53932         b_conv.is_owned = ptr_is_owned(b);
53933         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53934         b_conv.is_owned = false;
53935         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
53936         return ret_conv;
53937 }
53938
53939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53940         LDKAcceptChannelV2 this_obj_conv;
53941         this_obj_conv.inner = untag_ptr(this_obj);
53942         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53944         AcceptChannelV2_free(this_obj_conv);
53945 }
53946
53947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
53948         LDKAcceptChannelV2 this_ptr_conv;
53949         this_ptr_conv.inner = untag_ptr(this_ptr);
53950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53952         this_ptr_conv.is_owned = false;
53953         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
53954         int64_t ret_ref = 0;
53955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53957         return ret_ref;
53958 }
53959
53960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53961         LDKAcceptChannelV2 this_ptr_conv;
53962         this_ptr_conv.inner = untag_ptr(this_ptr);
53963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53965         this_ptr_conv.is_owned = false;
53966         LDKCommonAcceptChannelFields val_conv;
53967         val_conv.inner = untag_ptr(val);
53968         val_conv.is_owned = ptr_is_owned(val);
53969         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53970         val_conv = CommonAcceptChannelFields_clone(&val_conv);
53971         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
53972 }
53973
53974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53975         LDKAcceptChannelV2 this_ptr_conv;
53976         this_ptr_conv.inner = untag_ptr(this_ptr);
53977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53979         this_ptr_conv.is_owned = false;
53980         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
53981         return ret_conv;
53982 }
53983
53984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53985         LDKAcceptChannelV2 this_ptr_conv;
53986         this_ptr_conv.inner = untag_ptr(this_ptr);
53987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53989         this_ptr_conv.is_owned = false;
53990         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
53991 }
53992
53993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53994         LDKAcceptChannelV2 this_ptr_conv;
53995         this_ptr_conv.inner = untag_ptr(this_ptr);
53996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53998         this_ptr_conv.is_owned = false;
53999         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54000         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
54001         return ret_arr;
54002 }
54003
54004 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) {
54005         LDKAcceptChannelV2 this_ptr_conv;
54006         this_ptr_conv.inner = untag_ptr(this_ptr);
54007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54009         this_ptr_conv.is_owned = false;
54010         LDKPublicKey val_ref;
54011         CHECK((*env)->GetArrayLength(env, val) == 33);
54012         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
54013         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
54014 }
54015
54016 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
54017         LDKAcceptChannelV2 this_ptr_conv;
54018         this_ptr_conv.inner = untag_ptr(this_ptr);
54019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54021         this_ptr_conv.is_owned = false;
54022         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
54023         return ret_conv;
54024 }
54025
54026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
54027         LDKAcceptChannelV2 this_ptr_conv;
54028         this_ptr_conv.inner = untag_ptr(this_ptr);
54029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54031         this_ptr_conv.is_owned = false;
54032         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
54033         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
54034 }
54035
54036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t funding_satoshis_arg, int8_tArray second_per_commitment_point_arg, jclass require_confirmed_inputs_arg) {
54037         LDKCommonAcceptChannelFields common_fields_arg_conv;
54038         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
54039         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
54040         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
54041         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
54042         LDKPublicKey second_per_commitment_point_arg_ref;
54043         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
54044         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
54045         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
54046         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
54047         int64_t ret_ref = 0;
54048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54050         return ret_ref;
54051 }
54052
54053 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
54054         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
54055         int64_t ret_ref = 0;
54056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54058         return ret_ref;
54059 }
54060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54061         LDKAcceptChannelV2 arg_conv;
54062         arg_conv.inner = untag_ptr(arg);
54063         arg_conv.is_owned = ptr_is_owned(arg);
54064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54065         arg_conv.is_owned = false;
54066         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
54067         return ret_conv;
54068 }
54069
54070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54071         LDKAcceptChannelV2 orig_conv;
54072         orig_conv.inner = untag_ptr(orig);
54073         orig_conv.is_owned = ptr_is_owned(orig);
54074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54075         orig_conv.is_owned = false;
54076         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
54077         int64_t ret_ref = 0;
54078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54080         return ret_ref;
54081 }
54082
54083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
54084         LDKAcceptChannelV2 o_conv;
54085         o_conv.inner = untag_ptr(o);
54086         o_conv.is_owned = ptr_is_owned(o);
54087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54088         o_conv.is_owned = false;
54089         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
54090         return ret_conv;
54091 }
54092
54093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54094         LDKAcceptChannelV2 a_conv;
54095         a_conv.inner = untag_ptr(a);
54096         a_conv.is_owned = ptr_is_owned(a);
54097         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54098         a_conv.is_owned = false;
54099         LDKAcceptChannelV2 b_conv;
54100         b_conv.inner = untag_ptr(b);
54101         b_conv.is_owned = ptr_is_owned(b);
54102         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54103         b_conv.is_owned = false;
54104         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
54105         return ret_conv;
54106 }
54107
54108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54109         LDKFundingCreated this_obj_conv;
54110         this_obj_conv.inner = untag_ptr(this_obj);
54111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54113         FundingCreated_free(this_obj_conv);
54114 }
54115
54116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54117         LDKFundingCreated this_ptr_conv;
54118         this_ptr_conv.inner = untag_ptr(this_ptr);
54119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54121         this_ptr_conv.is_owned = false;
54122         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
54123         int64_t ret_ref = 0;
54124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54126         return ret_ref;
54127 }
54128
54129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54130         LDKFundingCreated this_ptr_conv;
54131         this_ptr_conv.inner = untag_ptr(this_ptr);
54132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54134         this_ptr_conv.is_owned = false;
54135         LDKChannelId val_conv;
54136         val_conv.inner = untag_ptr(val);
54137         val_conv.is_owned = ptr_is_owned(val);
54138         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54139         val_conv = ChannelId_clone(&val_conv);
54140         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
54141 }
54142
54143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
54144         LDKFundingCreated this_ptr_conv;
54145         this_ptr_conv.inner = untag_ptr(this_ptr);
54146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54148         this_ptr_conv.is_owned = false;
54149         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54150         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
54151         return ret_arr;
54152 }
54153
54154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54155         LDKFundingCreated this_ptr_conv;
54156         this_ptr_conv.inner = untag_ptr(this_ptr);
54157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54159         this_ptr_conv.is_owned = false;
54160         LDKThirtyTwoBytes val_ref;
54161         CHECK((*env)->GetArrayLength(env, val) == 32);
54162         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54163         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
54164 }
54165
54166 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
54167         LDKFundingCreated this_ptr_conv;
54168         this_ptr_conv.inner = untag_ptr(this_ptr);
54169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54171         this_ptr_conv.is_owned = false;
54172         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
54173         return ret_conv;
54174 }
54175
54176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
54177         LDKFundingCreated this_ptr_conv;
54178         this_ptr_conv.inner = untag_ptr(this_ptr);
54179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54181         this_ptr_conv.is_owned = false;
54182         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
54183 }
54184
54185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
54186         LDKFundingCreated this_ptr_conv;
54187         this_ptr_conv.inner = untag_ptr(this_ptr);
54188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54190         this_ptr_conv.is_owned = false;
54191         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54192         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
54193         return ret_arr;
54194 }
54195
54196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54197         LDKFundingCreated this_ptr_conv;
54198         this_ptr_conv.inner = untag_ptr(this_ptr);
54199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54201         this_ptr_conv.is_owned = false;
54202         LDKECDSASignature val_ref;
54203         CHECK((*env)->GetArrayLength(env, val) == 64);
54204         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54205         FundingCreated_set_signature(&this_ptr_conv, val_ref);
54206 }
54207
54208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int64_t temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
54209         LDKChannelId temporary_channel_id_arg_conv;
54210         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
54211         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
54212         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
54213         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
54214         LDKThirtyTwoBytes funding_txid_arg_ref;
54215         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
54216         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
54217         LDKECDSASignature signature_arg_ref;
54218         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
54219         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
54220         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
54221         int64_t ret_ref = 0;
54222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54224         return ret_ref;
54225 }
54226
54227 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
54228         LDKFundingCreated ret_var = FundingCreated_clone(arg);
54229         int64_t ret_ref = 0;
54230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54232         return ret_ref;
54233 }
54234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54235         LDKFundingCreated arg_conv;
54236         arg_conv.inner = untag_ptr(arg);
54237         arg_conv.is_owned = ptr_is_owned(arg);
54238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54239         arg_conv.is_owned = false;
54240         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
54241         return ret_conv;
54242 }
54243
54244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54245         LDKFundingCreated orig_conv;
54246         orig_conv.inner = untag_ptr(orig);
54247         orig_conv.is_owned = ptr_is_owned(orig);
54248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54249         orig_conv.is_owned = false;
54250         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
54251         int64_t ret_ref = 0;
54252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54254         return ret_ref;
54255 }
54256
54257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1hash(JNIEnv *env, jclass clz, int64_t o) {
54258         LDKFundingCreated o_conv;
54259         o_conv.inner = untag_ptr(o);
54260         o_conv.is_owned = ptr_is_owned(o);
54261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54262         o_conv.is_owned = false;
54263         int64_t ret_conv = FundingCreated_hash(&o_conv);
54264         return ret_conv;
54265 }
54266
54267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54268         LDKFundingCreated a_conv;
54269         a_conv.inner = untag_ptr(a);
54270         a_conv.is_owned = ptr_is_owned(a);
54271         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54272         a_conv.is_owned = false;
54273         LDKFundingCreated b_conv;
54274         b_conv.inner = untag_ptr(b);
54275         b_conv.is_owned = ptr_is_owned(b);
54276         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54277         b_conv.is_owned = false;
54278         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
54279         return ret_conv;
54280 }
54281
54282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54283         LDKFundingSigned this_obj_conv;
54284         this_obj_conv.inner = untag_ptr(this_obj);
54285         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54287         FundingSigned_free(this_obj_conv);
54288 }
54289
54290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54291         LDKFundingSigned this_ptr_conv;
54292         this_ptr_conv.inner = untag_ptr(this_ptr);
54293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54295         this_ptr_conv.is_owned = false;
54296         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
54297         int64_t ret_ref = 0;
54298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54300         return ret_ref;
54301 }
54302
54303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54304         LDKFundingSigned this_ptr_conv;
54305         this_ptr_conv.inner = untag_ptr(this_ptr);
54306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54308         this_ptr_conv.is_owned = false;
54309         LDKChannelId val_conv;
54310         val_conv.inner = untag_ptr(val);
54311         val_conv.is_owned = ptr_is_owned(val);
54312         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54313         val_conv = ChannelId_clone(&val_conv);
54314         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
54315 }
54316
54317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
54318         LDKFundingSigned this_ptr_conv;
54319         this_ptr_conv.inner = untag_ptr(this_ptr);
54320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54322         this_ptr_conv.is_owned = false;
54323         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54324         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
54325         return ret_arr;
54326 }
54327
54328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54329         LDKFundingSigned this_ptr_conv;
54330         this_ptr_conv.inner = untag_ptr(this_ptr);
54331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54333         this_ptr_conv.is_owned = false;
54334         LDKECDSASignature val_ref;
54335         CHECK((*env)->GetArrayLength(env, val) == 64);
54336         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54337         FundingSigned_set_signature(&this_ptr_conv, val_ref);
54338 }
54339
54340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray signature_arg) {
54341         LDKChannelId channel_id_arg_conv;
54342         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54343         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54344         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54345         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54346         LDKECDSASignature signature_arg_ref;
54347         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
54348         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
54349         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
54350         int64_t ret_ref = 0;
54351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54353         return ret_ref;
54354 }
54355
54356 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
54357         LDKFundingSigned ret_var = FundingSigned_clone(arg);
54358         int64_t ret_ref = 0;
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54361         return ret_ref;
54362 }
54363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54364         LDKFundingSigned arg_conv;
54365         arg_conv.inner = untag_ptr(arg);
54366         arg_conv.is_owned = ptr_is_owned(arg);
54367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54368         arg_conv.is_owned = false;
54369         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
54370         return ret_conv;
54371 }
54372
54373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54374         LDKFundingSigned orig_conv;
54375         orig_conv.inner = untag_ptr(orig);
54376         orig_conv.is_owned = ptr_is_owned(orig);
54377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54378         orig_conv.is_owned = false;
54379         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
54380         int64_t ret_ref = 0;
54381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54383         return ret_ref;
54384 }
54385
54386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
54387         LDKFundingSigned o_conv;
54388         o_conv.inner = untag_ptr(o);
54389         o_conv.is_owned = ptr_is_owned(o);
54390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54391         o_conv.is_owned = false;
54392         int64_t ret_conv = FundingSigned_hash(&o_conv);
54393         return ret_conv;
54394 }
54395
54396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54397         LDKFundingSigned a_conv;
54398         a_conv.inner = untag_ptr(a);
54399         a_conv.is_owned = ptr_is_owned(a);
54400         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54401         a_conv.is_owned = false;
54402         LDKFundingSigned b_conv;
54403         b_conv.inner = untag_ptr(b);
54404         b_conv.is_owned = ptr_is_owned(b);
54405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54406         b_conv.is_owned = false;
54407         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
54408         return ret_conv;
54409 }
54410
54411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54412         LDKChannelReady this_obj_conv;
54413         this_obj_conv.inner = untag_ptr(this_obj);
54414         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54416         ChannelReady_free(this_obj_conv);
54417 }
54418
54419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54420         LDKChannelReady this_ptr_conv;
54421         this_ptr_conv.inner = untag_ptr(this_ptr);
54422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54424         this_ptr_conv.is_owned = false;
54425         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
54426         int64_t ret_ref = 0;
54427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54429         return ret_ref;
54430 }
54431
54432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54433         LDKChannelReady this_ptr_conv;
54434         this_ptr_conv.inner = untag_ptr(this_ptr);
54435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54437         this_ptr_conv.is_owned = false;
54438         LDKChannelId val_conv;
54439         val_conv.inner = untag_ptr(val);
54440         val_conv.is_owned = ptr_is_owned(val);
54441         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54442         val_conv = ChannelId_clone(&val_conv);
54443         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
54444 }
54445
54446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
54447         LDKChannelReady this_ptr_conv;
54448         this_ptr_conv.inner = untag_ptr(this_ptr);
54449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54451         this_ptr_conv.is_owned = false;
54452         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54453         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
54454         return ret_arr;
54455 }
54456
54457 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) {
54458         LDKChannelReady this_ptr_conv;
54459         this_ptr_conv.inner = untag_ptr(this_ptr);
54460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54462         this_ptr_conv.is_owned = false;
54463         LDKPublicKey val_ref;
54464         CHECK((*env)->GetArrayLength(env, val) == 33);
54465         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
54466         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
54467 }
54468
54469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
54470         LDKChannelReady this_ptr_conv;
54471         this_ptr_conv.inner = untag_ptr(this_ptr);
54472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54474         this_ptr_conv.is_owned = false;
54475         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
54476         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
54477         int64_t ret_ref = tag_ptr(ret_copy, true);
54478         return ret_ref;
54479 }
54480
54481 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) {
54482         LDKChannelReady this_ptr_conv;
54483         this_ptr_conv.inner = untag_ptr(this_ptr);
54484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54486         this_ptr_conv.is_owned = false;
54487         void* val_ptr = untag_ptr(val);
54488         CHECK_ACCESS(val_ptr);
54489         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
54490         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
54491         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
54492 }
54493
54494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
54495         LDKChannelId channel_id_arg_conv;
54496         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54497         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54498         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54499         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54500         LDKPublicKey next_per_commitment_point_arg_ref;
54501         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
54502         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
54503         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
54504         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
54505         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
54506         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
54507         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
54508         int64_t ret_ref = 0;
54509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54511         return ret_ref;
54512 }
54513
54514 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
54515         LDKChannelReady ret_var = ChannelReady_clone(arg);
54516         int64_t ret_ref = 0;
54517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54519         return ret_ref;
54520 }
54521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54522         LDKChannelReady arg_conv;
54523         arg_conv.inner = untag_ptr(arg);
54524         arg_conv.is_owned = ptr_is_owned(arg);
54525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54526         arg_conv.is_owned = false;
54527         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
54528         return ret_conv;
54529 }
54530
54531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54532         LDKChannelReady orig_conv;
54533         orig_conv.inner = untag_ptr(orig);
54534         orig_conv.is_owned = ptr_is_owned(orig);
54535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54536         orig_conv.is_owned = false;
54537         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
54538         int64_t ret_ref = 0;
54539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54541         return ret_ref;
54542 }
54543
54544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1hash(JNIEnv *env, jclass clz, int64_t o) {
54545         LDKChannelReady o_conv;
54546         o_conv.inner = untag_ptr(o);
54547         o_conv.is_owned = ptr_is_owned(o);
54548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54549         o_conv.is_owned = false;
54550         int64_t ret_conv = ChannelReady_hash(&o_conv);
54551         return ret_conv;
54552 }
54553
54554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54555         LDKChannelReady 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         LDKChannelReady 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 = ChannelReady_eq(&a_conv, &b_conv);
54566         return ret_conv;
54567 }
54568
54569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54570         LDKStfu this_obj_conv;
54571         this_obj_conv.inner = untag_ptr(this_obj);
54572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54574         Stfu_free(this_obj_conv);
54575 }
54576
54577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54578         LDKStfu this_ptr_conv;
54579         this_ptr_conv.inner = untag_ptr(this_ptr);
54580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54582         this_ptr_conv.is_owned = false;
54583         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
54584         int64_t ret_ref = 0;
54585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54587         return ret_ref;
54588 }
54589
54590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54591         LDKStfu this_ptr_conv;
54592         this_ptr_conv.inner = untag_ptr(this_ptr);
54593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54595         this_ptr_conv.is_owned = false;
54596         LDKChannelId val_conv;
54597         val_conv.inner = untag_ptr(val);
54598         val_conv.is_owned = ptr_is_owned(val);
54599         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54600         val_conv = ChannelId_clone(&val_conv);
54601         Stfu_set_channel_id(&this_ptr_conv, val_conv);
54602 }
54603
54604 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr) {
54605         LDKStfu this_ptr_conv;
54606         this_ptr_conv.inner = untag_ptr(this_ptr);
54607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54609         this_ptr_conv.is_owned = false;
54610         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
54611         return ret_conv;
54612 }
54613
54614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
54615         LDKStfu this_ptr_conv;
54616         this_ptr_conv.inner = untag_ptr(this_ptr);
54617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54619         this_ptr_conv.is_owned = false;
54620         Stfu_set_initiator(&this_ptr_conv, val);
54621 }
54622
54623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_t initiator_arg) {
54624         LDKChannelId channel_id_arg_conv;
54625         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54626         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54627         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54628         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54629         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
54630         int64_t ret_ref = 0;
54631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54633         return ret_ref;
54634 }
54635
54636 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
54637         LDKStfu ret_var = Stfu_clone(arg);
54638         int64_t ret_ref = 0;
54639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54641         return ret_ref;
54642 }
54643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54644         LDKStfu arg_conv;
54645         arg_conv.inner = untag_ptr(arg);
54646         arg_conv.is_owned = ptr_is_owned(arg);
54647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54648         arg_conv.is_owned = false;
54649         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
54650         return ret_conv;
54651 }
54652
54653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54654         LDKStfu orig_conv;
54655         orig_conv.inner = untag_ptr(orig);
54656         orig_conv.is_owned = ptr_is_owned(orig);
54657         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54658         orig_conv.is_owned = false;
54659         LDKStfu ret_var = Stfu_clone(&orig_conv);
54660         int64_t ret_ref = 0;
54661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54663         return ret_ref;
54664 }
54665
54666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Stfu_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54667         LDKStfu a_conv;
54668         a_conv.inner = untag_ptr(a);
54669         a_conv.is_owned = ptr_is_owned(a);
54670         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54671         a_conv.is_owned = false;
54672         LDKStfu b_conv;
54673         b_conv.inner = untag_ptr(b);
54674         b_conv.is_owned = ptr_is_owned(b);
54675         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54676         b_conv.is_owned = false;
54677         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
54678         return ret_conv;
54679 }
54680
54681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54682         LDKSplice this_obj_conv;
54683         this_obj_conv.inner = untag_ptr(this_obj);
54684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54686         Splice_free(this_obj_conv);
54687 }
54688
54689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54690         LDKSplice this_ptr_conv;
54691         this_ptr_conv.inner = untag_ptr(this_ptr);
54692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54694         this_ptr_conv.is_owned = false;
54695         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
54696         int64_t ret_ref = 0;
54697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54699         return ret_ref;
54700 }
54701
54702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54703         LDKSplice this_ptr_conv;
54704         this_ptr_conv.inner = untag_ptr(this_ptr);
54705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54707         this_ptr_conv.is_owned = false;
54708         LDKChannelId val_conv;
54709         val_conv.inner = untag_ptr(val);
54710         val_conv.is_owned = ptr_is_owned(val);
54711         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54712         val_conv = ChannelId_clone(&val_conv);
54713         Splice_set_channel_id(&this_ptr_conv, val_conv);
54714 }
54715
54716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54717         LDKSplice this_ptr_conv;
54718         this_ptr_conv.inner = untag_ptr(this_ptr);
54719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54721         this_ptr_conv.is_owned = false;
54722         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54723         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_chain_hash(&this_ptr_conv));
54724         return ret_arr;
54725 }
54726
54727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54728         LDKSplice this_ptr_conv;
54729         this_ptr_conv.inner = untag_ptr(this_ptr);
54730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54732         this_ptr_conv.is_owned = false;
54733         LDKThirtyTwoBytes val_ref;
54734         CHECK((*env)->GetArrayLength(env, val) == 32);
54735         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54736         Splice_set_chain_hash(&this_ptr_conv, val_ref);
54737 }
54738
54739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
54740         LDKSplice this_ptr_conv;
54741         this_ptr_conv.inner = untag_ptr(this_ptr);
54742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54744         this_ptr_conv.is_owned = false;
54745         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
54746         return ret_conv;
54747 }
54748
54749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54750         LDKSplice this_ptr_conv;
54751         this_ptr_conv.inner = untag_ptr(this_ptr);
54752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54754         this_ptr_conv.is_owned = false;
54755         Splice_set_relative_satoshis(&this_ptr_conv, val);
54756 }
54757
54758 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr) {
54759         LDKSplice this_ptr_conv;
54760         this_ptr_conv.inner = untag_ptr(this_ptr);
54761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54763         this_ptr_conv.is_owned = false;
54764         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
54765         return ret_conv;
54766 }
54767
54768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54769         LDKSplice this_ptr_conv;
54770         this_ptr_conv.inner = untag_ptr(this_ptr);
54771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54773         this_ptr_conv.is_owned = false;
54774         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
54775 }
54776
54777 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
54778         LDKSplice this_ptr_conv;
54779         this_ptr_conv.inner = untag_ptr(this_ptr);
54780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54782         this_ptr_conv.is_owned = false;
54783         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
54784         return ret_conv;
54785 }
54786
54787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54788         LDKSplice this_ptr_conv;
54789         this_ptr_conv.inner = untag_ptr(this_ptr);
54790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54792         this_ptr_conv.is_owned = false;
54793         Splice_set_locktime(&this_ptr_conv, val);
54794 }
54795
54796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
54797         LDKSplice this_ptr_conv;
54798         this_ptr_conv.inner = untag_ptr(this_ptr);
54799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54801         this_ptr_conv.is_owned = false;
54802         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54803         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form);
54804         return ret_arr;
54805 }
54806
54807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54808         LDKSplice this_ptr_conv;
54809         this_ptr_conv.inner = untag_ptr(this_ptr);
54810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54812         this_ptr_conv.is_owned = false;
54813         LDKPublicKey val_ref;
54814         CHECK((*env)->GetArrayLength(env, val) == 33);
54815         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
54816         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
54817 }
54818
54819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
54820         LDKChannelId channel_id_arg_conv;
54821         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54822         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54823         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54824         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54825         LDKThirtyTwoBytes chain_hash_arg_ref;
54826         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54827         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54828         LDKPublicKey funding_pubkey_arg_ref;
54829         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
54830         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
54831         LDKSplice ret_var = Splice_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
54832         int64_t ret_ref = 0;
54833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54835         return ret_ref;
54836 }
54837
54838 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
54839         LDKSplice ret_var = Splice_clone(arg);
54840         int64_t ret_ref = 0;
54841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54843         return ret_ref;
54844 }
54845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54846         LDKSplice arg_conv;
54847         arg_conv.inner = untag_ptr(arg);
54848         arg_conv.is_owned = ptr_is_owned(arg);
54849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54850         arg_conv.is_owned = false;
54851         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
54852         return ret_conv;
54853 }
54854
54855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54856         LDKSplice orig_conv;
54857         orig_conv.inner = untag_ptr(orig);
54858         orig_conv.is_owned = ptr_is_owned(orig);
54859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54860         orig_conv.is_owned = false;
54861         LDKSplice ret_var = Splice_clone(&orig_conv);
54862         int64_t ret_ref = 0;
54863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54865         return ret_ref;
54866 }
54867
54868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Splice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54869         LDKSplice a_conv;
54870         a_conv.inner = untag_ptr(a);
54871         a_conv.is_owned = ptr_is_owned(a);
54872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54873         a_conv.is_owned = false;
54874         LDKSplice b_conv;
54875         b_conv.inner = untag_ptr(b);
54876         b_conv.is_owned = ptr_is_owned(b);
54877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54878         b_conv.is_owned = false;
54879         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
54880         return ret_conv;
54881 }
54882
54883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54884         LDKSpliceAck this_obj_conv;
54885         this_obj_conv.inner = untag_ptr(this_obj);
54886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54888         SpliceAck_free(this_obj_conv);
54889 }
54890
54891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54892         LDKSpliceAck this_ptr_conv;
54893         this_ptr_conv.inner = untag_ptr(this_ptr);
54894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54896         this_ptr_conv.is_owned = false;
54897         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
54898         int64_t ret_ref = 0;
54899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54901         return ret_ref;
54902 }
54903
54904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54905         LDKSpliceAck this_ptr_conv;
54906         this_ptr_conv.inner = untag_ptr(this_ptr);
54907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54909         this_ptr_conv.is_owned = false;
54910         LDKChannelId val_conv;
54911         val_conv.inner = untag_ptr(val);
54912         val_conv.is_owned = ptr_is_owned(val);
54913         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54914         val_conv = ChannelId_clone(&val_conv);
54915         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
54916 }
54917
54918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54919         LDKSpliceAck this_ptr_conv;
54920         this_ptr_conv.inner = untag_ptr(this_ptr);
54921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54923         this_ptr_conv.is_owned = false;
54924         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54925         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_chain_hash(&this_ptr_conv));
54926         return ret_arr;
54927 }
54928
54929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54930         LDKSpliceAck this_ptr_conv;
54931         this_ptr_conv.inner = untag_ptr(this_ptr);
54932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54934         this_ptr_conv.is_owned = false;
54935         LDKThirtyTwoBytes val_ref;
54936         CHECK((*env)->GetArrayLength(env, val) == 32);
54937         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54938         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
54939 }
54940
54941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
54942         LDKSpliceAck this_ptr_conv;
54943         this_ptr_conv.inner = untag_ptr(this_ptr);
54944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54946         this_ptr_conv.is_owned = false;
54947         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
54948         return ret_conv;
54949 }
54950
54951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54952         LDKSpliceAck this_ptr_conv;
54953         this_ptr_conv.inner = untag_ptr(this_ptr);
54954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54956         this_ptr_conv.is_owned = false;
54957         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
54958 }
54959
54960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
54961         LDKSpliceAck this_ptr_conv;
54962         this_ptr_conv.inner = untag_ptr(this_ptr);
54963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54965         this_ptr_conv.is_owned = false;
54966         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54967         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form);
54968         return ret_arr;
54969 }
54970
54971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54972         LDKSpliceAck this_ptr_conv;
54973         this_ptr_conv.inner = untag_ptr(this_ptr);
54974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54976         this_ptr_conv.is_owned = false;
54977         LDKPublicKey val_ref;
54978         CHECK((*env)->GetArrayLength(env, val) == 33);
54979         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
54980         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
54981 }
54982
54983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
54984         LDKChannelId channel_id_arg_conv;
54985         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54986         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54987         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54988         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54989         LDKThirtyTwoBytes chain_hash_arg_ref;
54990         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54991         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54992         LDKPublicKey funding_pubkey_arg_ref;
54993         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
54994         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
54995         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
54996         int64_t ret_ref = 0;
54997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54999         return ret_ref;
55000 }
55001
55002 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
55003         LDKSpliceAck ret_var = SpliceAck_clone(arg);
55004         int64_t ret_ref = 0;
55005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55007         return ret_ref;
55008 }
55009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55010         LDKSpliceAck arg_conv;
55011         arg_conv.inner = untag_ptr(arg);
55012         arg_conv.is_owned = ptr_is_owned(arg);
55013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55014         arg_conv.is_owned = false;
55015         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
55016         return ret_conv;
55017 }
55018
55019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55020         LDKSpliceAck orig_conv;
55021         orig_conv.inner = untag_ptr(orig);
55022         orig_conv.is_owned = ptr_is_owned(orig);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55024         orig_conv.is_owned = false;
55025         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
55026         int64_t ret_ref = 0;
55027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55029         return ret_ref;
55030 }
55031
55032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceAck_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55033         LDKSpliceAck a_conv;
55034         a_conv.inner = untag_ptr(a);
55035         a_conv.is_owned = ptr_is_owned(a);
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55037         a_conv.is_owned = false;
55038         LDKSpliceAck b_conv;
55039         b_conv.inner = untag_ptr(b);
55040         b_conv.is_owned = ptr_is_owned(b);
55041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55042         b_conv.is_owned = false;
55043         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
55044         return ret_conv;
55045 }
55046
55047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55048         LDKSpliceLocked this_obj_conv;
55049         this_obj_conv.inner = untag_ptr(this_obj);
55050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55052         SpliceLocked_free(this_obj_conv);
55053 }
55054
55055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55056         LDKSpliceLocked this_ptr_conv;
55057         this_ptr_conv.inner = untag_ptr(this_ptr);
55058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55060         this_ptr_conv.is_owned = false;
55061         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
55062         int64_t ret_ref = 0;
55063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55065         return ret_ref;
55066 }
55067
55068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55069         LDKSpliceLocked this_ptr_conv;
55070         this_ptr_conv.inner = untag_ptr(this_ptr);
55071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55073         this_ptr_conv.is_owned = false;
55074         LDKChannelId val_conv;
55075         val_conv.inner = untag_ptr(val);
55076         val_conv.is_owned = ptr_is_owned(val);
55077         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55078         val_conv = ChannelId_clone(&val_conv);
55079         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
55080 }
55081
55082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg) {
55083         LDKChannelId channel_id_arg_conv;
55084         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55085         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55086         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55087         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55088         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
55089         int64_t ret_ref = 0;
55090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55092         return ret_ref;
55093 }
55094
55095 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
55096         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55103         LDKSpliceLocked arg_conv;
55104         arg_conv.inner = untag_ptr(arg);
55105         arg_conv.is_owned = ptr_is_owned(arg);
55106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55107         arg_conv.is_owned = false;
55108         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
55109         return ret_conv;
55110 }
55111
55112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55113         LDKSpliceLocked orig_conv;
55114         orig_conv.inner = untag_ptr(orig);
55115         orig_conv.is_owned = ptr_is_owned(orig);
55116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55117         orig_conv.is_owned = false;
55118         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
55119         int64_t ret_ref = 0;
55120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55122         return ret_ref;
55123 }
55124
55125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55126         LDKSpliceLocked a_conv;
55127         a_conv.inner = untag_ptr(a);
55128         a_conv.is_owned = ptr_is_owned(a);
55129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55130         a_conv.is_owned = false;
55131         LDKSpliceLocked b_conv;
55132         b_conv.inner = untag_ptr(b);
55133         b_conv.is_owned = ptr_is_owned(b);
55134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55135         b_conv.is_owned = false;
55136         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
55137         return ret_conv;
55138 }
55139
55140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55141         LDKTxAddInput this_obj_conv;
55142         this_obj_conv.inner = untag_ptr(this_obj);
55143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55145         TxAddInput_free(this_obj_conv);
55146 }
55147
55148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55149         LDKTxAddInput this_ptr_conv;
55150         this_ptr_conv.inner = untag_ptr(this_ptr);
55151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55153         this_ptr_conv.is_owned = false;
55154         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
55155         int64_t ret_ref = 0;
55156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55158         return ret_ref;
55159 }
55160
55161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55162         LDKTxAddInput this_ptr_conv;
55163         this_ptr_conv.inner = untag_ptr(this_ptr);
55164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55166         this_ptr_conv.is_owned = false;
55167         LDKChannelId val_conv;
55168         val_conv.inner = untag_ptr(val);
55169         val_conv.is_owned = ptr_is_owned(val);
55170         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55171         val_conv = ChannelId_clone(&val_conv);
55172         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
55173 }
55174
55175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55176         LDKTxAddInput this_ptr_conv;
55177         this_ptr_conv.inner = untag_ptr(this_ptr);
55178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55180         this_ptr_conv.is_owned = false;
55181         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
55182         return ret_conv;
55183 }
55184
55185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55186         LDKTxAddInput this_ptr_conv;
55187         this_ptr_conv.inner = untag_ptr(this_ptr);
55188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55190         this_ptr_conv.is_owned = false;
55191         TxAddInput_set_serial_id(&this_ptr_conv, val);
55192 }
55193
55194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
55195         LDKTxAddInput this_ptr_conv;
55196         this_ptr_conv.inner = untag_ptr(this_ptr);
55197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55199         this_ptr_conv.is_owned = false;
55200         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
55201         int64_t ret_ref = 0;
55202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55204         return ret_ref;
55205 }
55206
55207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55208         LDKTxAddInput this_ptr_conv;
55209         this_ptr_conv.inner = untag_ptr(this_ptr);
55210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55212         this_ptr_conv.is_owned = false;
55213         LDKTransactionU16LenLimited val_conv;
55214         val_conv.inner = untag_ptr(val);
55215         val_conv.is_owned = ptr_is_owned(val);
55216         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55217         val_conv = TransactionU16LenLimited_clone(&val_conv);
55218         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
55219 }
55220
55221 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
55222         LDKTxAddInput this_ptr_conv;
55223         this_ptr_conv.inner = untag_ptr(this_ptr);
55224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55226         this_ptr_conv.is_owned = false;
55227         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
55228         return ret_conv;
55229 }
55230
55231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55232         LDKTxAddInput this_ptr_conv;
55233         this_ptr_conv.inner = untag_ptr(this_ptr);
55234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55236         this_ptr_conv.is_owned = false;
55237         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
55238 }
55239
55240 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
55241         LDKTxAddInput this_ptr_conv;
55242         this_ptr_conv.inner = untag_ptr(this_ptr);
55243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55245         this_ptr_conv.is_owned = false;
55246         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
55247         return ret_conv;
55248 }
55249
55250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55251         LDKTxAddInput this_ptr_conv;
55252         this_ptr_conv.inner = untag_ptr(this_ptr);
55253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55255         this_ptr_conv.is_owned = false;
55256         TxAddInput_set_sequence(&this_ptr_conv, val);
55257 }
55258
55259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
55260         LDKChannelId channel_id_arg_conv;
55261         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55262         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55263         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55264         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55265         LDKTransactionU16LenLimited prevtx_arg_conv;
55266         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
55267         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
55268         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
55269         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
55270         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
55271         int64_t ret_ref = 0;
55272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55274         return ret_ref;
55275 }
55276
55277 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
55278         LDKTxAddInput ret_var = TxAddInput_clone(arg);
55279         int64_t ret_ref = 0;
55280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55282         return ret_ref;
55283 }
55284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55285         LDKTxAddInput arg_conv;
55286         arg_conv.inner = untag_ptr(arg);
55287         arg_conv.is_owned = ptr_is_owned(arg);
55288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55289         arg_conv.is_owned = false;
55290         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
55291         return ret_conv;
55292 }
55293
55294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55295         LDKTxAddInput orig_conv;
55296         orig_conv.inner = untag_ptr(orig);
55297         orig_conv.is_owned = ptr_is_owned(orig);
55298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55299         orig_conv.is_owned = false;
55300         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
55301         int64_t ret_ref = 0;
55302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55304         return ret_ref;
55305 }
55306
55307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
55308         LDKTxAddInput o_conv;
55309         o_conv.inner = untag_ptr(o);
55310         o_conv.is_owned = ptr_is_owned(o);
55311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55312         o_conv.is_owned = false;
55313         int64_t ret_conv = TxAddInput_hash(&o_conv);
55314         return ret_conv;
55315 }
55316
55317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55318         LDKTxAddInput a_conv;
55319         a_conv.inner = untag_ptr(a);
55320         a_conv.is_owned = ptr_is_owned(a);
55321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55322         a_conv.is_owned = false;
55323         LDKTxAddInput b_conv;
55324         b_conv.inner = untag_ptr(b);
55325         b_conv.is_owned = ptr_is_owned(b);
55326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55327         b_conv.is_owned = false;
55328         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
55329         return ret_conv;
55330 }
55331
55332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55333         LDKTxAddOutput this_obj_conv;
55334         this_obj_conv.inner = untag_ptr(this_obj);
55335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55337         TxAddOutput_free(this_obj_conv);
55338 }
55339
55340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55341         LDKTxAddOutput this_ptr_conv;
55342         this_ptr_conv.inner = untag_ptr(this_ptr);
55343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55345         this_ptr_conv.is_owned = false;
55346         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
55347         int64_t ret_ref = 0;
55348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55350         return ret_ref;
55351 }
55352
55353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55354         LDKTxAddOutput this_ptr_conv;
55355         this_ptr_conv.inner = untag_ptr(this_ptr);
55356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55358         this_ptr_conv.is_owned = false;
55359         LDKChannelId val_conv;
55360         val_conv.inner = untag_ptr(val);
55361         val_conv.is_owned = ptr_is_owned(val);
55362         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55363         val_conv = ChannelId_clone(&val_conv);
55364         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
55365 }
55366
55367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55368         LDKTxAddOutput this_ptr_conv;
55369         this_ptr_conv.inner = untag_ptr(this_ptr);
55370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55372         this_ptr_conv.is_owned = false;
55373         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
55374         return ret_conv;
55375 }
55376
55377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55378         LDKTxAddOutput this_ptr_conv;
55379         this_ptr_conv.inner = untag_ptr(this_ptr);
55380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55382         this_ptr_conv.is_owned = false;
55383         TxAddOutput_set_serial_id(&this_ptr_conv, val);
55384 }
55385
55386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
55387         LDKTxAddOutput this_ptr_conv;
55388         this_ptr_conv.inner = untag_ptr(this_ptr);
55389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55391         this_ptr_conv.is_owned = false;
55392         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
55393         return ret_conv;
55394 }
55395
55396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55397         LDKTxAddOutput this_ptr_conv;
55398         this_ptr_conv.inner = untag_ptr(this_ptr);
55399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55401         this_ptr_conv.is_owned = false;
55402         TxAddOutput_set_sats(&this_ptr_conv, val);
55403 }
55404
55405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
55406         LDKTxAddOutput this_ptr_conv;
55407         this_ptr_conv.inner = untag_ptr(this_ptr);
55408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55410         this_ptr_conv.is_owned = false;
55411         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
55412         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55413         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55414         CVec_u8Z_free(ret_var);
55415         return ret_arr;
55416 }
55417
55418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55419         LDKTxAddOutput this_ptr_conv;
55420         this_ptr_conv.inner = untag_ptr(this_ptr);
55421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55423         this_ptr_conv.is_owned = false;
55424         LDKCVec_u8Z val_ref;
55425         val_ref.datalen = (*env)->GetArrayLength(env, val);
55426         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
55427         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
55428         TxAddOutput_set_script(&this_ptr_conv, val_ref);
55429 }
55430
55431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
55432         LDKChannelId channel_id_arg_conv;
55433         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55434         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55435         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55436         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55437         LDKCVec_u8Z script_arg_ref;
55438         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
55439         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
55440         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
55441         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
55442         int64_t ret_ref = 0;
55443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55445         return ret_ref;
55446 }
55447
55448 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
55449         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
55450         int64_t ret_ref = 0;
55451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55453         return ret_ref;
55454 }
55455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55456         LDKTxAddOutput arg_conv;
55457         arg_conv.inner = untag_ptr(arg);
55458         arg_conv.is_owned = ptr_is_owned(arg);
55459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55460         arg_conv.is_owned = false;
55461         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
55462         return ret_conv;
55463 }
55464
55465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55466         LDKTxAddOutput orig_conv;
55467         orig_conv.inner = untag_ptr(orig);
55468         orig_conv.is_owned = ptr_is_owned(orig);
55469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55470         orig_conv.is_owned = false;
55471         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
55472         int64_t ret_ref = 0;
55473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55475         return ret_ref;
55476 }
55477
55478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
55479         LDKTxAddOutput o_conv;
55480         o_conv.inner = untag_ptr(o);
55481         o_conv.is_owned = ptr_is_owned(o);
55482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55483         o_conv.is_owned = false;
55484         int64_t ret_conv = TxAddOutput_hash(&o_conv);
55485         return ret_conv;
55486 }
55487
55488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55489         LDKTxAddOutput a_conv;
55490         a_conv.inner = untag_ptr(a);
55491         a_conv.is_owned = ptr_is_owned(a);
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55493         a_conv.is_owned = false;
55494         LDKTxAddOutput b_conv;
55495         b_conv.inner = untag_ptr(b);
55496         b_conv.is_owned = ptr_is_owned(b);
55497         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55498         b_conv.is_owned = false;
55499         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
55500         return ret_conv;
55501 }
55502
55503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55504         LDKTxRemoveInput this_obj_conv;
55505         this_obj_conv.inner = untag_ptr(this_obj);
55506         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55508         TxRemoveInput_free(this_obj_conv);
55509 }
55510
55511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55512         LDKTxRemoveInput this_ptr_conv;
55513         this_ptr_conv.inner = untag_ptr(this_ptr);
55514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55516         this_ptr_conv.is_owned = false;
55517         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
55518         int64_t ret_ref = 0;
55519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55521         return ret_ref;
55522 }
55523
55524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55525         LDKTxRemoveInput this_ptr_conv;
55526         this_ptr_conv.inner = untag_ptr(this_ptr);
55527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55529         this_ptr_conv.is_owned = false;
55530         LDKChannelId val_conv;
55531         val_conv.inner = untag_ptr(val);
55532         val_conv.is_owned = ptr_is_owned(val);
55533         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55534         val_conv = ChannelId_clone(&val_conv);
55535         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
55536 }
55537
55538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55539         LDKTxRemoveInput this_ptr_conv;
55540         this_ptr_conv.inner = untag_ptr(this_ptr);
55541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55543         this_ptr_conv.is_owned = false;
55544         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
55545         return ret_conv;
55546 }
55547
55548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55549         LDKTxRemoveInput this_ptr_conv;
55550         this_ptr_conv.inner = untag_ptr(this_ptr);
55551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55553         this_ptr_conv.is_owned = false;
55554         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
55555 }
55556
55557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg) {
55558         LDKChannelId channel_id_arg_conv;
55559         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55560         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55561         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55562         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55563         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
55564         int64_t ret_ref = 0;
55565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55567         return ret_ref;
55568 }
55569
55570 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
55571         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
55572         int64_t ret_ref = 0;
55573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55575         return ret_ref;
55576 }
55577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55578         LDKTxRemoveInput arg_conv;
55579         arg_conv.inner = untag_ptr(arg);
55580         arg_conv.is_owned = ptr_is_owned(arg);
55581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55582         arg_conv.is_owned = false;
55583         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
55584         return ret_conv;
55585 }
55586
55587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55588         LDKTxRemoveInput orig_conv;
55589         orig_conv.inner = untag_ptr(orig);
55590         orig_conv.is_owned = ptr_is_owned(orig);
55591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55592         orig_conv.is_owned = false;
55593         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
55594         int64_t ret_ref = 0;
55595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55597         return ret_ref;
55598 }
55599
55600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
55601         LDKTxRemoveInput o_conv;
55602         o_conv.inner = untag_ptr(o);
55603         o_conv.is_owned = ptr_is_owned(o);
55604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55605         o_conv.is_owned = false;
55606         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
55607         return ret_conv;
55608 }
55609
55610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55611         LDKTxRemoveInput a_conv;
55612         a_conv.inner = untag_ptr(a);
55613         a_conv.is_owned = ptr_is_owned(a);
55614         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55615         a_conv.is_owned = false;
55616         LDKTxRemoveInput b_conv;
55617         b_conv.inner = untag_ptr(b);
55618         b_conv.is_owned = ptr_is_owned(b);
55619         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55620         b_conv.is_owned = false;
55621         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
55622         return ret_conv;
55623 }
55624
55625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55626         LDKTxRemoveOutput this_obj_conv;
55627         this_obj_conv.inner = untag_ptr(this_obj);
55628         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55630         TxRemoveOutput_free(this_obj_conv);
55631 }
55632
55633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55634         LDKTxRemoveOutput this_ptr_conv;
55635         this_ptr_conv.inner = untag_ptr(this_ptr);
55636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55638         this_ptr_conv.is_owned = false;
55639         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
55640         int64_t ret_ref = 0;
55641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55643         return ret_ref;
55644 }
55645
55646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55647         LDKTxRemoveOutput this_ptr_conv;
55648         this_ptr_conv.inner = untag_ptr(this_ptr);
55649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55651         this_ptr_conv.is_owned = false;
55652         LDKChannelId val_conv;
55653         val_conv.inner = untag_ptr(val);
55654         val_conv.is_owned = ptr_is_owned(val);
55655         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55656         val_conv = ChannelId_clone(&val_conv);
55657         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
55658 }
55659
55660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55661         LDKTxRemoveOutput this_ptr_conv;
55662         this_ptr_conv.inner = untag_ptr(this_ptr);
55663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55665         this_ptr_conv.is_owned = false;
55666         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
55667         return ret_conv;
55668 }
55669
55670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55671         LDKTxRemoveOutput this_ptr_conv;
55672         this_ptr_conv.inner = untag_ptr(this_ptr);
55673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55675         this_ptr_conv.is_owned = false;
55676         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
55677 }
55678
55679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg) {
55680         LDKChannelId channel_id_arg_conv;
55681         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55682         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55683         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55684         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55685         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
55686         int64_t ret_ref = 0;
55687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55689         return ret_ref;
55690 }
55691
55692 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
55693         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
55694         int64_t ret_ref = 0;
55695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55697         return ret_ref;
55698 }
55699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55700         LDKTxRemoveOutput arg_conv;
55701         arg_conv.inner = untag_ptr(arg);
55702         arg_conv.is_owned = ptr_is_owned(arg);
55703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55704         arg_conv.is_owned = false;
55705         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
55706         return ret_conv;
55707 }
55708
55709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55710         LDKTxRemoveOutput orig_conv;
55711         orig_conv.inner = untag_ptr(orig);
55712         orig_conv.is_owned = ptr_is_owned(orig);
55713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55714         orig_conv.is_owned = false;
55715         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
55716         int64_t ret_ref = 0;
55717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55719         return ret_ref;
55720 }
55721
55722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
55723         LDKTxRemoveOutput o_conv;
55724         o_conv.inner = untag_ptr(o);
55725         o_conv.is_owned = ptr_is_owned(o);
55726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55727         o_conv.is_owned = false;
55728         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
55729         return ret_conv;
55730 }
55731
55732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55733         LDKTxRemoveOutput a_conv;
55734         a_conv.inner = untag_ptr(a);
55735         a_conv.is_owned = ptr_is_owned(a);
55736         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55737         a_conv.is_owned = false;
55738         LDKTxRemoveOutput b_conv;
55739         b_conv.inner = untag_ptr(b);
55740         b_conv.is_owned = ptr_is_owned(b);
55741         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55742         b_conv.is_owned = false;
55743         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
55744         return ret_conv;
55745 }
55746
55747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55748         LDKTxComplete this_obj_conv;
55749         this_obj_conv.inner = untag_ptr(this_obj);
55750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55752         TxComplete_free(this_obj_conv);
55753 }
55754
55755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55756         LDKTxComplete this_ptr_conv;
55757         this_ptr_conv.inner = untag_ptr(this_ptr);
55758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55760         this_ptr_conv.is_owned = false;
55761         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
55762         int64_t ret_ref = 0;
55763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55765         return ret_ref;
55766 }
55767
55768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55769         LDKTxComplete this_ptr_conv;
55770         this_ptr_conv.inner = untag_ptr(this_ptr);
55771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55773         this_ptr_conv.is_owned = false;
55774         LDKChannelId val_conv;
55775         val_conv.inner = untag_ptr(val);
55776         val_conv.is_owned = ptr_is_owned(val);
55777         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55778         val_conv = ChannelId_clone(&val_conv);
55779         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
55780 }
55781
55782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg) {
55783         LDKChannelId channel_id_arg_conv;
55784         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55785         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55786         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55787         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55788         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
55789         int64_t ret_ref = 0;
55790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55792         return ret_ref;
55793 }
55794
55795 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
55796         LDKTxComplete ret_var = TxComplete_clone(arg);
55797         int64_t ret_ref = 0;
55798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55800         return ret_ref;
55801 }
55802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55803         LDKTxComplete arg_conv;
55804         arg_conv.inner = untag_ptr(arg);
55805         arg_conv.is_owned = ptr_is_owned(arg);
55806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55807         arg_conv.is_owned = false;
55808         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
55809         return ret_conv;
55810 }
55811
55812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55813         LDKTxComplete orig_conv;
55814         orig_conv.inner = untag_ptr(orig);
55815         orig_conv.is_owned = ptr_is_owned(orig);
55816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55817         orig_conv.is_owned = false;
55818         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
55819         int64_t ret_ref = 0;
55820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55822         return ret_ref;
55823 }
55824
55825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1hash(JNIEnv *env, jclass clz, int64_t o) {
55826         LDKTxComplete o_conv;
55827         o_conv.inner = untag_ptr(o);
55828         o_conv.is_owned = ptr_is_owned(o);
55829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55830         o_conv.is_owned = false;
55831         int64_t ret_conv = TxComplete_hash(&o_conv);
55832         return ret_conv;
55833 }
55834
55835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55836         LDKTxComplete a_conv;
55837         a_conv.inner = untag_ptr(a);
55838         a_conv.is_owned = ptr_is_owned(a);
55839         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55840         a_conv.is_owned = false;
55841         LDKTxComplete b_conv;
55842         b_conv.inner = untag_ptr(b);
55843         b_conv.is_owned = ptr_is_owned(b);
55844         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55845         b_conv.is_owned = false;
55846         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
55847         return ret_conv;
55848 }
55849
55850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55851         LDKTxSignatures this_obj_conv;
55852         this_obj_conv.inner = untag_ptr(this_obj);
55853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55855         TxSignatures_free(this_obj_conv);
55856 }
55857
55858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55859         LDKTxSignatures this_ptr_conv;
55860         this_ptr_conv.inner = untag_ptr(this_ptr);
55861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55863         this_ptr_conv.is_owned = false;
55864         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
55865         int64_t ret_ref = 0;
55866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55868         return ret_ref;
55869 }
55870
55871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55872         LDKTxSignatures this_ptr_conv;
55873         this_ptr_conv.inner = untag_ptr(this_ptr);
55874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55876         this_ptr_conv.is_owned = false;
55877         LDKChannelId val_conv;
55878         val_conv.inner = untag_ptr(val);
55879         val_conv.is_owned = ptr_is_owned(val);
55880         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55881         val_conv = ChannelId_clone(&val_conv);
55882         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
55883 }
55884
55885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55886         LDKTxSignatures this_ptr_conv;
55887         this_ptr_conv.inner = untag_ptr(this_ptr);
55888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55890         this_ptr_conv.is_owned = false;
55891         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55892         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
55893         return ret_arr;
55894 }
55895
55896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55897         LDKTxSignatures this_ptr_conv;
55898         this_ptr_conv.inner = untag_ptr(this_ptr);
55899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55901         this_ptr_conv.is_owned = false;
55902         LDKThirtyTwoBytes val_ref;
55903         CHECK((*env)->GetArrayLength(env, val) == 32);
55904         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55905         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
55906 }
55907
55908 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
55909         LDKTxSignatures this_ptr_conv;
55910         this_ptr_conv.inner = untag_ptr(this_ptr);
55911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55913         this_ptr_conv.is_owned = false;
55914         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
55915         jobjectArray ret_arr = NULL;
55916         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
55917         ;
55918         for (size_t i = 0; i < ret_var.datalen; i++) {
55919                 LDKWitness ret_conv_8_var = ret_var.data[i];
55920                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
55921                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
55922                 Witness_free(ret_conv_8_var);
55923                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
55924         }
55925         
55926         FREE(ret_var.data);
55927         return ret_arr;
55928 }
55929
55930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
55931         LDKTxSignatures this_ptr_conv;
55932         this_ptr_conv.inner = untag_ptr(this_ptr);
55933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55935         this_ptr_conv.is_owned = false;
55936         LDKCVec_WitnessZ val_constr;
55937         val_constr.datalen = (*env)->GetArrayLength(env, val);
55938         if (val_constr.datalen > 0)
55939                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
55940         else
55941                 val_constr.data = NULL;
55942         for (size_t i = 0; i < val_constr.datalen; i++) {
55943                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
55944                 LDKWitness val_conv_8_ref;
55945                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
55946                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
55947                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
55948                 val_conv_8_ref.data_is_owned = true;
55949                 val_constr.data[i] = val_conv_8_ref;
55950         }
55951         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
55952 }
55953
55954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1funding_1outpoint_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
55955         LDKTxSignatures this_ptr_conv;
55956         this_ptr_conv.inner = untag_ptr(this_ptr);
55957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55959         this_ptr_conv.is_owned = false;
55960         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
55961         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
55962         int64_t ret_ref = tag_ptr(ret_copy, true);
55963         return ret_ref;
55964 }
55965
55966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1funding_1outpoint_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55967         LDKTxSignatures this_ptr_conv;
55968         this_ptr_conv.inner = untag_ptr(this_ptr);
55969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55971         this_ptr_conv.is_owned = false;
55972         void* val_ptr = untag_ptr(val);
55973         CHECK_ACCESS(val_ptr);
55974         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
55975         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
55976         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
55977 }
55978
55979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg, int64_t funding_outpoint_sig_arg) {
55980         LDKChannelId channel_id_arg_conv;
55981         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55982         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55983         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55984         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55985         LDKThirtyTwoBytes tx_hash_arg_ref;
55986         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
55987         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
55988         LDKCVec_WitnessZ witnesses_arg_constr;
55989         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
55990         if (witnesses_arg_constr.datalen > 0)
55991                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
55992         else
55993                 witnesses_arg_constr.data = NULL;
55994         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
55995                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
55996                 LDKWitness witnesses_arg_conv_8_ref;
55997                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
55998                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
55999                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
56000                 witnesses_arg_conv_8_ref.data_is_owned = true;
56001                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
56002         }
56003         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
56004         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
56005         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
56006         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
56007         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
56008         int64_t ret_ref = 0;
56009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56011         return ret_ref;
56012 }
56013
56014 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
56015         LDKTxSignatures ret_var = TxSignatures_clone(arg);
56016         int64_t ret_ref = 0;
56017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56019         return ret_ref;
56020 }
56021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56022         LDKTxSignatures arg_conv;
56023         arg_conv.inner = untag_ptr(arg);
56024         arg_conv.is_owned = ptr_is_owned(arg);
56025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56026         arg_conv.is_owned = false;
56027         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
56028         return ret_conv;
56029 }
56030
56031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56032         LDKTxSignatures orig_conv;
56033         orig_conv.inner = untag_ptr(orig);
56034         orig_conv.is_owned = ptr_is_owned(orig);
56035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56036         orig_conv.is_owned = false;
56037         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
56038         int64_t ret_ref = 0;
56039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56041         return ret_ref;
56042 }
56043
56044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
56045         LDKTxSignatures o_conv;
56046         o_conv.inner = untag_ptr(o);
56047         o_conv.is_owned = ptr_is_owned(o);
56048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56049         o_conv.is_owned = false;
56050         int64_t ret_conv = TxSignatures_hash(&o_conv);
56051         return ret_conv;
56052 }
56053
56054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56055         LDKTxSignatures a_conv;
56056         a_conv.inner = untag_ptr(a);
56057         a_conv.is_owned = ptr_is_owned(a);
56058         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56059         a_conv.is_owned = false;
56060         LDKTxSignatures b_conv;
56061         b_conv.inner = untag_ptr(b);
56062         b_conv.is_owned = ptr_is_owned(b);
56063         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56064         b_conv.is_owned = false;
56065         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
56066         return ret_conv;
56067 }
56068
56069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56070         LDKTxInitRbf this_obj_conv;
56071         this_obj_conv.inner = untag_ptr(this_obj);
56072         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56074         TxInitRbf_free(this_obj_conv);
56075 }
56076
56077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56078         LDKTxInitRbf this_ptr_conv;
56079         this_ptr_conv.inner = untag_ptr(this_ptr);
56080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56082         this_ptr_conv.is_owned = false;
56083         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
56084         int64_t ret_ref = 0;
56085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56087         return ret_ref;
56088 }
56089
56090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56091         LDKTxInitRbf this_ptr_conv;
56092         this_ptr_conv.inner = untag_ptr(this_ptr);
56093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56095         this_ptr_conv.is_owned = false;
56096         LDKChannelId val_conv;
56097         val_conv.inner = untag_ptr(val);
56098         val_conv.is_owned = ptr_is_owned(val);
56099         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56100         val_conv = ChannelId_clone(&val_conv);
56101         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
56102 }
56103
56104 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
56105         LDKTxInitRbf this_ptr_conv;
56106         this_ptr_conv.inner = untag_ptr(this_ptr);
56107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56109         this_ptr_conv.is_owned = false;
56110         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
56111         return ret_conv;
56112 }
56113
56114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
56115         LDKTxInitRbf this_ptr_conv;
56116         this_ptr_conv.inner = untag_ptr(this_ptr);
56117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56119         this_ptr_conv.is_owned = false;
56120         TxInitRbf_set_locktime(&this_ptr_conv, val);
56121 }
56122
56123 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
56124         LDKTxInitRbf this_ptr_conv;
56125         this_ptr_conv.inner = untag_ptr(this_ptr);
56126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56128         this_ptr_conv.is_owned = false;
56129         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
56130         return ret_conv;
56131 }
56132
56133 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) {
56134         LDKTxInitRbf this_ptr_conv;
56135         this_ptr_conv.inner = untag_ptr(this_ptr);
56136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56138         this_ptr_conv.is_owned = false;
56139         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
56140 }
56141
56142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
56143         LDKTxInitRbf this_ptr_conv;
56144         this_ptr_conv.inner = untag_ptr(this_ptr);
56145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56147         this_ptr_conv.is_owned = false;
56148         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
56149         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
56150         int64_t ret_ref = tag_ptr(ret_copy, true);
56151         return ret_ref;
56152 }
56153
56154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56155         LDKTxInitRbf this_ptr_conv;
56156         this_ptr_conv.inner = untag_ptr(this_ptr);
56157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56159         this_ptr_conv.is_owned = false;
56160         void* val_ptr = untag_ptr(val);
56161         CHECK_ACCESS(val_ptr);
56162         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
56163         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
56164         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
56165 }
56166
56167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
56168         LDKChannelId channel_id_arg_conv;
56169         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56170         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56171         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56172         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56173         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
56174         CHECK_ACCESS(funding_output_contribution_arg_ptr);
56175         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
56176         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
56177         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
56178         int64_t ret_ref = 0;
56179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56181         return ret_ref;
56182 }
56183
56184 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
56185         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
56186         int64_t ret_ref = 0;
56187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56189         return ret_ref;
56190 }
56191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56192         LDKTxInitRbf arg_conv;
56193         arg_conv.inner = untag_ptr(arg);
56194         arg_conv.is_owned = ptr_is_owned(arg);
56195         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56196         arg_conv.is_owned = false;
56197         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
56198         return ret_conv;
56199 }
56200
56201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56202         LDKTxInitRbf orig_conv;
56203         orig_conv.inner = untag_ptr(orig);
56204         orig_conv.is_owned = ptr_is_owned(orig);
56205         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56206         orig_conv.is_owned = false;
56207         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
56208         int64_t ret_ref = 0;
56209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56211         return ret_ref;
56212 }
56213
56214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
56215         LDKTxInitRbf o_conv;
56216         o_conv.inner = untag_ptr(o);
56217         o_conv.is_owned = ptr_is_owned(o);
56218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56219         o_conv.is_owned = false;
56220         int64_t ret_conv = TxInitRbf_hash(&o_conv);
56221         return ret_conv;
56222 }
56223
56224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56225         LDKTxInitRbf a_conv;
56226         a_conv.inner = untag_ptr(a);
56227         a_conv.is_owned = ptr_is_owned(a);
56228         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56229         a_conv.is_owned = false;
56230         LDKTxInitRbf b_conv;
56231         b_conv.inner = untag_ptr(b);
56232         b_conv.is_owned = ptr_is_owned(b);
56233         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56234         b_conv.is_owned = false;
56235         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
56236         return ret_conv;
56237 }
56238
56239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56240         LDKTxAckRbf this_obj_conv;
56241         this_obj_conv.inner = untag_ptr(this_obj);
56242         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56244         TxAckRbf_free(this_obj_conv);
56245 }
56246
56247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56248         LDKTxAckRbf this_ptr_conv;
56249         this_ptr_conv.inner = untag_ptr(this_ptr);
56250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56252         this_ptr_conv.is_owned = false;
56253         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
56254         int64_t ret_ref = 0;
56255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56257         return ret_ref;
56258 }
56259
56260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56261         LDKTxAckRbf this_ptr_conv;
56262         this_ptr_conv.inner = untag_ptr(this_ptr);
56263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56265         this_ptr_conv.is_owned = false;
56266         LDKChannelId val_conv;
56267         val_conv.inner = untag_ptr(val);
56268         val_conv.is_owned = ptr_is_owned(val);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56270         val_conv = ChannelId_clone(&val_conv);
56271         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
56272 }
56273
56274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
56275         LDKTxAckRbf this_ptr_conv;
56276         this_ptr_conv.inner = untag_ptr(this_ptr);
56277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56279         this_ptr_conv.is_owned = false;
56280         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
56281         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
56282         int64_t ret_ref = tag_ptr(ret_copy, true);
56283         return ret_ref;
56284 }
56285
56286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56287         LDKTxAckRbf this_ptr_conv;
56288         this_ptr_conv.inner = untag_ptr(this_ptr);
56289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56291         this_ptr_conv.is_owned = false;
56292         void* val_ptr = untag_ptr(val);
56293         CHECK_ACCESS(val_ptr);
56294         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
56295         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
56296         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
56297 }
56298
56299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t funding_output_contribution_arg) {
56300         LDKChannelId channel_id_arg_conv;
56301         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56302         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56303         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56304         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56305         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
56306         CHECK_ACCESS(funding_output_contribution_arg_ptr);
56307         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
56308         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
56309         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
56310         int64_t ret_ref = 0;
56311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56313         return ret_ref;
56314 }
56315
56316 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
56317         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
56318         int64_t ret_ref = 0;
56319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56321         return ret_ref;
56322 }
56323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56324         LDKTxAckRbf arg_conv;
56325         arg_conv.inner = untag_ptr(arg);
56326         arg_conv.is_owned = ptr_is_owned(arg);
56327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56328         arg_conv.is_owned = false;
56329         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
56330         return ret_conv;
56331 }
56332
56333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56334         LDKTxAckRbf orig_conv;
56335         orig_conv.inner = untag_ptr(orig);
56336         orig_conv.is_owned = ptr_is_owned(orig);
56337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56338         orig_conv.is_owned = false;
56339         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
56340         int64_t ret_ref = 0;
56341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56343         return ret_ref;
56344 }
56345
56346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
56347         LDKTxAckRbf o_conv;
56348         o_conv.inner = untag_ptr(o);
56349         o_conv.is_owned = ptr_is_owned(o);
56350         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56351         o_conv.is_owned = false;
56352         int64_t ret_conv = TxAckRbf_hash(&o_conv);
56353         return ret_conv;
56354 }
56355
56356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56357         LDKTxAckRbf a_conv;
56358         a_conv.inner = untag_ptr(a);
56359         a_conv.is_owned = ptr_is_owned(a);
56360         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56361         a_conv.is_owned = false;
56362         LDKTxAckRbf b_conv;
56363         b_conv.inner = untag_ptr(b);
56364         b_conv.is_owned = ptr_is_owned(b);
56365         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56366         b_conv.is_owned = false;
56367         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
56368         return ret_conv;
56369 }
56370
56371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56372         LDKTxAbort this_obj_conv;
56373         this_obj_conv.inner = untag_ptr(this_obj);
56374         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56376         TxAbort_free(this_obj_conv);
56377 }
56378
56379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56380         LDKTxAbort this_ptr_conv;
56381         this_ptr_conv.inner = untag_ptr(this_ptr);
56382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56384         this_ptr_conv.is_owned = false;
56385         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
56386         int64_t ret_ref = 0;
56387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56389         return ret_ref;
56390 }
56391
56392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56393         LDKTxAbort this_ptr_conv;
56394         this_ptr_conv.inner = untag_ptr(this_ptr);
56395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56397         this_ptr_conv.is_owned = false;
56398         LDKChannelId val_conv;
56399         val_conv.inner = untag_ptr(val);
56400         val_conv.is_owned = ptr_is_owned(val);
56401         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56402         val_conv = ChannelId_clone(&val_conv);
56403         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
56404 }
56405
56406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
56407         LDKTxAbort this_ptr_conv;
56408         this_ptr_conv.inner = untag_ptr(this_ptr);
56409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56411         this_ptr_conv.is_owned = false;
56412         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
56413         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56414         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56415         CVec_u8Z_free(ret_var);
56416         return ret_arr;
56417 }
56418
56419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56420         LDKTxAbort this_ptr_conv;
56421         this_ptr_conv.inner = untag_ptr(this_ptr);
56422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56424         this_ptr_conv.is_owned = false;
56425         LDKCVec_u8Z val_ref;
56426         val_ref.datalen = (*env)->GetArrayLength(env, val);
56427         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
56428         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
56429         TxAbort_set_data(&this_ptr_conv, val_ref);
56430 }
56431
56432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray data_arg) {
56433         LDKChannelId channel_id_arg_conv;
56434         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56435         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56436         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56437         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56438         LDKCVec_u8Z data_arg_ref;
56439         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
56440         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
56441         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
56442         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
56443         int64_t ret_ref = 0;
56444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56446         return ret_ref;
56447 }
56448
56449 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
56450         LDKTxAbort ret_var = TxAbort_clone(arg);
56451         int64_t ret_ref = 0;
56452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56454         return ret_ref;
56455 }
56456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56457         LDKTxAbort arg_conv;
56458         arg_conv.inner = untag_ptr(arg);
56459         arg_conv.is_owned = ptr_is_owned(arg);
56460         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56461         arg_conv.is_owned = false;
56462         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
56463         return ret_conv;
56464 }
56465
56466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56467         LDKTxAbort orig_conv;
56468         orig_conv.inner = untag_ptr(orig);
56469         orig_conv.is_owned = ptr_is_owned(orig);
56470         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56471         orig_conv.is_owned = false;
56472         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
56473         int64_t ret_ref = 0;
56474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56476         return ret_ref;
56477 }
56478
56479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1hash(JNIEnv *env, jclass clz, int64_t o) {
56480         LDKTxAbort o_conv;
56481         o_conv.inner = untag_ptr(o);
56482         o_conv.is_owned = ptr_is_owned(o);
56483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56484         o_conv.is_owned = false;
56485         int64_t ret_conv = TxAbort_hash(&o_conv);
56486         return ret_conv;
56487 }
56488
56489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56490         LDKTxAbort a_conv;
56491         a_conv.inner = untag_ptr(a);
56492         a_conv.is_owned = ptr_is_owned(a);
56493         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56494         a_conv.is_owned = false;
56495         LDKTxAbort b_conv;
56496         b_conv.inner = untag_ptr(b);
56497         b_conv.is_owned = ptr_is_owned(b);
56498         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56499         b_conv.is_owned = false;
56500         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
56501         return ret_conv;
56502 }
56503
56504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56505         LDKShutdown this_obj_conv;
56506         this_obj_conv.inner = untag_ptr(this_obj);
56507         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56509         Shutdown_free(this_obj_conv);
56510 }
56511
56512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56513         LDKShutdown this_ptr_conv;
56514         this_ptr_conv.inner = untag_ptr(this_ptr);
56515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56517         this_ptr_conv.is_owned = false;
56518         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
56519         int64_t ret_ref = 0;
56520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56522         return ret_ref;
56523 }
56524
56525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56526         LDKShutdown this_ptr_conv;
56527         this_ptr_conv.inner = untag_ptr(this_ptr);
56528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56530         this_ptr_conv.is_owned = false;
56531         LDKChannelId val_conv;
56532         val_conv.inner = untag_ptr(val);
56533         val_conv.is_owned = ptr_is_owned(val);
56534         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56535         val_conv = ChannelId_clone(&val_conv);
56536         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
56537 }
56538
56539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
56540         LDKShutdown this_ptr_conv;
56541         this_ptr_conv.inner = untag_ptr(this_ptr);
56542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56544         this_ptr_conv.is_owned = false;
56545         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
56546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56548         CVec_u8Z_free(ret_var);
56549         return ret_arr;
56550 }
56551
56552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56553         LDKShutdown this_ptr_conv;
56554         this_ptr_conv.inner = untag_ptr(this_ptr);
56555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56557         this_ptr_conv.is_owned = false;
56558         LDKCVec_u8Z val_ref;
56559         val_ref.datalen = (*env)->GetArrayLength(env, val);
56560         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
56561         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
56562         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
56563 }
56564
56565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
56566         LDKChannelId channel_id_arg_conv;
56567         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56568         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56569         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56570         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56571         LDKCVec_u8Z scriptpubkey_arg_ref;
56572         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
56573         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
56574         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
56575         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
56576         int64_t ret_ref = 0;
56577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56579         return ret_ref;
56580 }
56581
56582 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
56583         LDKShutdown ret_var = Shutdown_clone(arg);
56584         int64_t ret_ref = 0;
56585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56587         return ret_ref;
56588 }
56589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56590         LDKShutdown arg_conv;
56591         arg_conv.inner = untag_ptr(arg);
56592         arg_conv.is_owned = ptr_is_owned(arg);
56593         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56594         arg_conv.is_owned = false;
56595         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
56596         return ret_conv;
56597 }
56598
56599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56600         LDKShutdown orig_conv;
56601         orig_conv.inner = untag_ptr(orig);
56602         orig_conv.is_owned = ptr_is_owned(orig);
56603         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56604         orig_conv.is_owned = false;
56605         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
56606         int64_t ret_ref = 0;
56607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56609         return ret_ref;
56610 }
56611
56612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1hash(JNIEnv *env, jclass clz, int64_t o) {
56613         LDKShutdown o_conv;
56614         o_conv.inner = untag_ptr(o);
56615         o_conv.is_owned = ptr_is_owned(o);
56616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56617         o_conv.is_owned = false;
56618         int64_t ret_conv = Shutdown_hash(&o_conv);
56619         return ret_conv;
56620 }
56621
56622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56623         LDKShutdown a_conv;
56624         a_conv.inner = untag_ptr(a);
56625         a_conv.is_owned = ptr_is_owned(a);
56626         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56627         a_conv.is_owned = false;
56628         LDKShutdown b_conv;
56629         b_conv.inner = untag_ptr(b);
56630         b_conv.is_owned = ptr_is_owned(b);
56631         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56632         b_conv.is_owned = false;
56633         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
56634         return ret_conv;
56635 }
56636
56637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56638         LDKClosingSignedFeeRange this_obj_conv;
56639         this_obj_conv.inner = untag_ptr(this_obj);
56640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56642         ClosingSignedFeeRange_free(this_obj_conv);
56643 }
56644
56645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
56646         LDKClosingSignedFeeRange this_ptr_conv;
56647         this_ptr_conv.inner = untag_ptr(this_ptr);
56648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56650         this_ptr_conv.is_owned = false;
56651         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
56652         return ret_conv;
56653 }
56654
56655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56656         LDKClosingSignedFeeRange this_ptr_conv;
56657         this_ptr_conv.inner = untag_ptr(this_ptr);
56658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56660         this_ptr_conv.is_owned = false;
56661         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
56662 }
56663
56664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
56665         LDKClosingSignedFeeRange this_ptr_conv;
56666         this_ptr_conv.inner = untag_ptr(this_ptr);
56667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56669         this_ptr_conv.is_owned = false;
56670         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
56671         return ret_conv;
56672 }
56673
56674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56675         LDKClosingSignedFeeRange this_ptr_conv;
56676         this_ptr_conv.inner = untag_ptr(this_ptr);
56677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56679         this_ptr_conv.is_owned = false;
56680         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
56681 }
56682
56683 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) {
56684         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
56685         int64_t ret_ref = 0;
56686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56688         return ret_ref;
56689 }
56690
56691 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
56692         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
56693         int64_t ret_ref = 0;
56694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56696         return ret_ref;
56697 }
56698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56699         LDKClosingSignedFeeRange arg_conv;
56700         arg_conv.inner = untag_ptr(arg);
56701         arg_conv.is_owned = ptr_is_owned(arg);
56702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56703         arg_conv.is_owned = false;
56704         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
56705         return ret_conv;
56706 }
56707
56708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56709         LDKClosingSignedFeeRange orig_conv;
56710         orig_conv.inner = untag_ptr(orig);
56711         orig_conv.is_owned = ptr_is_owned(orig);
56712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56713         orig_conv.is_owned = false;
56714         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
56715         int64_t ret_ref = 0;
56716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56718         return ret_ref;
56719 }
56720
56721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
56722         LDKClosingSignedFeeRange o_conv;
56723         o_conv.inner = untag_ptr(o);
56724         o_conv.is_owned = ptr_is_owned(o);
56725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56726         o_conv.is_owned = false;
56727         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
56728         return ret_conv;
56729 }
56730
56731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56732         LDKClosingSignedFeeRange a_conv;
56733         a_conv.inner = untag_ptr(a);
56734         a_conv.is_owned = ptr_is_owned(a);
56735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56736         a_conv.is_owned = false;
56737         LDKClosingSignedFeeRange b_conv;
56738         b_conv.inner = untag_ptr(b);
56739         b_conv.is_owned = ptr_is_owned(b);
56740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56741         b_conv.is_owned = false;
56742         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
56743         return ret_conv;
56744 }
56745
56746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56747         LDKClosingSigned this_obj_conv;
56748         this_obj_conv.inner = untag_ptr(this_obj);
56749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56751         ClosingSigned_free(this_obj_conv);
56752 }
56753
56754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56755         LDKClosingSigned this_ptr_conv;
56756         this_ptr_conv.inner = untag_ptr(this_ptr);
56757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56759         this_ptr_conv.is_owned = false;
56760         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
56761         int64_t ret_ref = 0;
56762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56764         return ret_ref;
56765 }
56766
56767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56768         LDKClosingSigned this_ptr_conv;
56769         this_ptr_conv.inner = untag_ptr(this_ptr);
56770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56772         this_ptr_conv.is_owned = false;
56773         LDKChannelId val_conv;
56774         val_conv.inner = untag_ptr(val);
56775         val_conv.is_owned = ptr_is_owned(val);
56776         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56777         val_conv = ChannelId_clone(&val_conv);
56778         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
56779 }
56780
56781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
56782         LDKClosingSigned this_ptr_conv;
56783         this_ptr_conv.inner = untag_ptr(this_ptr);
56784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56786         this_ptr_conv.is_owned = false;
56787         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
56788         return ret_conv;
56789 }
56790
56791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56792         LDKClosingSigned this_ptr_conv;
56793         this_ptr_conv.inner = untag_ptr(this_ptr);
56794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56796         this_ptr_conv.is_owned = false;
56797         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
56798 }
56799
56800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
56801         LDKClosingSigned this_ptr_conv;
56802         this_ptr_conv.inner = untag_ptr(this_ptr);
56803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56805         this_ptr_conv.is_owned = false;
56806         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
56807         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
56808         return ret_arr;
56809 }
56810
56811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56812         LDKClosingSigned this_ptr_conv;
56813         this_ptr_conv.inner = untag_ptr(this_ptr);
56814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56816         this_ptr_conv.is_owned = false;
56817         LDKECDSASignature val_ref;
56818         CHECK((*env)->GetArrayLength(env, val) == 64);
56819         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
56820         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
56821 }
56822
56823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
56824         LDKClosingSigned this_ptr_conv;
56825         this_ptr_conv.inner = untag_ptr(this_ptr);
56826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56828         this_ptr_conv.is_owned = false;
56829         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
56830         int64_t ret_ref = 0;
56831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56833         return ret_ref;
56834 }
56835
56836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56837         LDKClosingSigned this_ptr_conv;
56838         this_ptr_conv.inner = untag_ptr(this_ptr);
56839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56841         this_ptr_conv.is_owned = false;
56842         LDKClosingSignedFeeRange val_conv;
56843         val_conv.inner = untag_ptr(val);
56844         val_conv.is_owned = ptr_is_owned(val);
56845         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56846         val_conv = ClosingSignedFeeRange_clone(&val_conv);
56847         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
56848 }
56849
56850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
56851         LDKChannelId channel_id_arg_conv;
56852         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56853         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56854         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56855         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56856         LDKECDSASignature signature_arg_ref;
56857         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
56858         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
56859         LDKClosingSignedFeeRange fee_range_arg_conv;
56860         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
56861         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
56862         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
56863         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
56864         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
56865         int64_t ret_ref = 0;
56866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56868         return ret_ref;
56869 }
56870
56871 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
56872         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
56873         int64_t ret_ref = 0;
56874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56876         return ret_ref;
56877 }
56878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56879         LDKClosingSigned arg_conv;
56880         arg_conv.inner = untag_ptr(arg);
56881         arg_conv.is_owned = ptr_is_owned(arg);
56882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56883         arg_conv.is_owned = false;
56884         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
56885         return ret_conv;
56886 }
56887
56888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56889         LDKClosingSigned orig_conv;
56890         orig_conv.inner = untag_ptr(orig);
56891         orig_conv.is_owned = ptr_is_owned(orig);
56892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56893         orig_conv.is_owned = false;
56894         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
56895         int64_t ret_ref = 0;
56896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56898         return ret_ref;
56899 }
56900
56901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
56902         LDKClosingSigned o_conv;
56903         o_conv.inner = untag_ptr(o);
56904         o_conv.is_owned = ptr_is_owned(o);
56905         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56906         o_conv.is_owned = false;
56907         int64_t ret_conv = ClosingSigned_hash(&o_conv);
56908         return ret_conv;
56909 }
56910
56911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56912         LDKClosingSigned a_conv;
56913         a_conv.inner = untag_ptr(a);
56914         a_conv.is_owned = ptr_is_owned(a);
56915         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56916         a_conv.is_owned = false;
56917         LDKClosingSigned b_conv;
56918         b_conv.inner = untag_ptr(b);
56919         b_conv.is_owned = ptr_is_owned(b);
56920         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56921         b_conv.is_owned = false;
56922         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
56923         return ret_conv;
56924 }
56925
56926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56927         LDKUpdateAddHTLC this_obj_conv;
56928         this_obj_conv.inner = untag_ptr(this_obj);
56929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56931         UpdateAddHTLC_free(this_obj_conv);
56932 }
56933
56934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56935         LDKUpdateAddHTLC this_ptr_conv;
56936         this_ptr_conv.inner = untag_ptr(this_ptr);
56937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56939         this_ptr_conv.is_owned = false;
56940         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
56941         int64_t ret_ref = 0;
56942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56944         return ret_ref;
56945 }
56946
56947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56948         LDKUpdateAddHTLC this_ptr_conv;
56949         this_ptr_conv.inner = untag_ptr(this_ptr);
56950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56952         this_ptr_conv.is_owned = false;
56953         LDKChannelId val_conv;
56954         val_conv.inner = untag_ptr(val);
56955         val_conv.is_owned = ptr_is_owned(val);
56956         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56957         val_conv = ChannelId_clone(&val_conv);
56958         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
56959 }
56960
56961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56962         LDKUpdateAddHTLC this_ptr_conv;
56963         this_ptr_conv.inner = untag_ptr(this_ptr);
56964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56966         this_ptr_conv.is_owned = false;
56967         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
56968         return ret_conv;
56969 }
56970
56971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56972         LDKUpdateAddHTLC this_ptr_conv;
56973         this_ptr_conv.inner = untag_ptr(this_ptr);
56974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56976         this_ptr_conv.is_owned = false;
56977         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
56978 }
56979
56980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
56981         LDKUpdateAddHTLC this_ptr_conv;
56982         this_ptr_conv.inner = untag_ptr(this_ptr);
56983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56985         this_ptr_conv.is_owned = false;
56986         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
56987         return ret_conv;
56988 }
56989
56990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56991         LDKUpdateAddHTLC this_ptr_conv;
56992         this_ptr_conv.inner = untag_ptr(this_ptr);
56993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56995         this_ptr_conv.is_owned = false;
56996         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
56997 }
56998
56999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
57000         LDKUpdateAddHTLC this_ptr_conv;
57001         this_ptr_conv.inner = untag_ptr(this_ptr);
57002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57004         this_ptr_conv.is_owned = false;
57005         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57006         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
57007         return ret_arr;
57008 }
57009
57010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57011         LDKUpdateAddHTLC this_ptr_conv;
57012         this_ptr_conv.inner = untag_ptr(this_ptr);
57013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57015         this_ptr_conv.is_owned = false;
57016         LDKThirtyTwoBytes val_ref;
57017         CHECK((*env)->GetArrayLength(env, val) == 32);
57018         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
57019         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
57020 }
57021
57022 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
57023         LDKUpdateAddHTLC this_ptr_conv;
57024         this_ptr_conv.inner = untag_ptr(this_ptr);
57025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57027         this_ptr_conv.is_owned = false;
57028         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
57029         return ret_conv;
57030 }
57031
57032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
57033         LDKUpdateAddHTLC this_ptr_conv;
57034         this_ptr_conv.inner = untag_ptr(this_ptr);
57035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57037         this_ptr_conv.is_owned = false;
57038         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
57039 }
57040
57041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
57042         LDKUpdateAddHTLC this_ptr_conv;
57043         this_ptr_conv.inner = untag_ptr(this_ptr);
57044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57046         this_ptr_conv.is_owned = false;
57047         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
57048         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
57049         int64_t ret_ref = tag_ptr(ret_copy, true);
57050         return ret_ref;
57051 }
57052
57053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57054         LDKUpdateAddHTLC this_ptr_conv;
57055         this_ptr_conv.inner = untag_ptr(this_ptr);
57056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57058         this_ptr_conv.is_owned = false;
57059         void* val_ptr = untag_ptr(val);
57060         CHECK_ACCESS(val_ptr);
57061         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
57062         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
57063         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
57064 }
57065
57066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
57067         LDKUpdateAddHTLC this_ptr_conv;
57068         this_ptr_conv.inner = untag_ptr(this_ptr);
57069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57071         this_ptr_conv.is_owned = false;
57072         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
57073         int64_t ret_ref = 0;
57074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57076         return ret_ref;
57077 }
57078
57079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57080         LDKUpdateAddHTLC this_ptr_conv;
57081         this_ptr_conv.inner = untag_ptr(this_ptr);
57082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57084         this_ptr_conv.is_owned = false;
57085         LDKOnionPacket val_conv;
57086         val_conv.inner = untag_ptr(val);
57087         val_conv.is_owned = ptr_is_owned(val);
57088         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57089         val_conv = OnionPacket_clone(&val_conv);
57090         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
57091 }
57092
57093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
57094         LDKUpdateAddHTLC this_ptr_conv;
57095         this_ptr_conv.inner = untag_ptr(this_ptr);
57096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57098         this_ptr_conv.is_owned = false;
57099         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
57100         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form);
57101         return ret_arr;
57102 }
57103
57104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57105         LDKUpdateAddHTLC this_ptr_conv;
57106         this_ptr_conv.inner = untag_ptr(this_ptr);
57107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57109         this_ptr_conv.is_owned = false;
57110         LDKPublicKey val_ref;
57111         CHECK((*env)->GetArrayLength(env, val) == 33);
57112         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
57113         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
57114 }
57115
57116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, int64_t skimmed_fee_msat_arg, int64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
57117         LDKChannelId channel_id_arg_conv;
57118         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
57119         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
57120         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
57121         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
57122         LDKThirtyTwoBytes payment_hash_arg_ref;
57123         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
57124         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
57125         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
57126         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
57127         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
57128         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
57129         LDKOnionPacket onion_routing_packet_arg_conv;
57130         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
57131         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
57132         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
57133         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
57134         LDKPublicKey blinding_point_arg_ref;
57135         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
57136         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
57137         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_conv, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
57138         int64_t ret_ref = 0;
57139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57141         return ret_ref;
57142 }
57143
57144 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
57145         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
57146         int64_t ret_ref = 0;
57147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57149         return ret_ref;
57150 }
57151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57152         LDKUpdateAddHTLC arg_conv;
57153         arg_conv.inner = untag_ptr(arg);
57154         arg_conv.is_owned = ptr_is_owned(arg);
57155         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57156         arg_conv.is_owned = false;
57157         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
57158         return ret_conv;
57159 }
57160
57161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57162         LDKUpdateAddHTLC orig_conv;
57163         orig_conv.inner = untag_ptr(orig);
57164         orig_conv.is_owned = ptr_is_owned(orig);
57165         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57166         orig_conv.is_owned = false;
57167         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
57168         int64_t ret_ref = 0;
57169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57171         return ret_ref;
57172 }
57173
57174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
57175         LDKUpdateAddHTLC o_conv;
57176         o_conv.inner = untag_ptr(o);
57177         o_conv.is_owned = ptr_is_owned(o);
57178         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57179         o_conv.is_owned = false;
57180         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
57181         return ret_conv;
57182 }
57183
57184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57185         LDKUpdateAddHTLC a_conv;
57186         a_conv.inner = untag_ptr(a);
57187         a_conv.is_owned = ptr_is_owned(a);
57188         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57189         a_conv.is_owned = false;
57190         LDKUpdateAddHTLC b_conv;
57191         b_conv.inner = untag_ptr(b);
57192         b_conv.is_owned = ptr_is_owned(b);
57193         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57194         b_conv.is_owned = false;
57195         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
57196         return ret_conv;
57197 }
57198
57199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57200         LDKOnionMessage this_obj_conv;
57201         this_obj_conv.inner = untag_ptr(this_obj);
57202         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57204         OnionMessage_free(this_obj_conv);
57205 }
57206
57207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
57208         LDKOnionMessage this_ptr_conv;
57209         this_ptr_conv.inner = untag_ptr(this_ptr);
57210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57212         this_ptr_conv.is_owned = false;
57213         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
57214         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
57215         return ret_arr;
57216 }
57217
57218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57219         LDKOnionMessage this_ptr_conv;
57220         this_ptr_conv.inner = untag_ptr(this_ptr);
57221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57223         this_ptr_conv.is_owned = false;
57224         LDKPublicKey val_ref;
57225         CHECK((*env)->GetArrayLength(env, val) == 33);
57226         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
57227         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
57228 }
57229
57230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
57231         LDKOnionMessage this_ptr_conv;
57232         this_ptr_conv.inner = untag_ptr(this_ptr);
57233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57235         this_ptr_conv.is_owned = false;
57236         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
57237         int64_t ret_ref = 0;
57238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57240         return ret_ref;
57241 }
57242
57243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57244         LDKOnionMessage this_ptr_conv;
57245         this_ptr_conv.inner = untag_ptr(this_ptr);
57246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57248         this_ptr_conv.is_owned = false;
57249         LDKPacket val_conv;
57250         val_conv.inner = untag_ptr(val);
57251         val_conv.is_owned = ptr_is_owned(val);
57252         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57253         val_conv = Packet_clone(&val_conv);
57254         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
57255 }
57256
57257 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) {
57258         LDKPublicKey blinding_point_arg_ref;
57259         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
57260         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
57261         LDKPacket onion_routing_packet_arg_conv;
57262         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
57263         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
57264         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
57265         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
57266         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
57267         int64_t ret_ref = 0;
57268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57270         return ret_ref;
57271 }
57272
57273 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
57274         LDKOnionMessage ret_var = OnionMessage_clone(arg);
57275         int64_t ret_ref = 0;
57276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57278         return ret_ref;
57279 }
57280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57281         LDKOnionMessage arg_conv;
57282         arg_conv.inner = untag_ptr(arg);
57283         arg_conv.is_owned = ptr_is_owned(arg);
57284         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57285         arg_conv.is_owned = false;
57286         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
57287         return ret_conv;
57288 }
57289
57290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57291         LDKOnionMessage orig_conv;
57292         orig_conv.inner = untag_ptr(orig);
57293         orig_conv.is_owned = ptr_is_owned(orig);
57294         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57295         orig_conv.is_owned = false;
57296         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
57297         int64_t ret_ref = 0;
57298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57300         return ret_ref;
57301 }
57302
57303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
57304         LDKOnionMessage o_conv;
57305         o_conv.inner = untag_ptr(o);
57306         o_conv.is_owned = ptr_is_owned(o);
57307         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57308         o_conv.is_owned = false;
57309         int64_t ret_conv = OnionMessage_hash(&o_conv);
57310         return ret_conv;
57311 }
57312
57313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57314         LDKOnionMessage a_conv;
57315         a_conv.inner = untag_ptr(a);
57316         a_conv.is_owned = ptr_is_owned(a);
57317         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57318         a_conv.is_owned = false;
57319         LDKOnionMessage b_conv;
57320         b_conv.inner = untag_ptr(b);
57321         b_conv.is_owned = ptr_is_owned(b);
57322         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57323         b_conv.is_owned = false;
57324         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
57325         return ret_conv;
57326 }
57327
57328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57329         LDKUpdateFulfillHTLC this_obj_conv;
57330         this_obj_conv.inner = untag_ptr(this_obj);
57331         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57333         UpdateFulfillHTLC_free(this_obj_conv);
57334 }
57335
57336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57337         LDKUpdateFulfillHTLC this_ptr_conv;
57338         this_ptr_conv.inner = untag_ptr(this_ptr);
57339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57341         this_ptr_conv.is_owned = false;
57342         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
57343         int64_t ret_ref = 0;
57344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57346         return ret_ref;
57347 }
57348
57349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57350         LDKUpdateFulfillHTLC this_ptr_conv;
57351         this_ptr_conv.inner = untag_ptr(this_ptr);
57352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57354         this_ptr_conv.is_owned = false;
57355         LDKChannelId val_conv;
57356         val_conv.inner = untag_ptr(val);
57357         val_conv.is_owned = ptr_is_owned(val);
57358         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57359         val_conv = ChannelId_clone(&val_conv);
57360         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
57361 }
57362
57363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57364         LDKUpdateFulfillHTLC this_ptr_conv;
57365         this_ptr_conv.inner = untag_ptr(this_ptr);
57366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57368         this_ptr_conv.is_owned = false;
57369         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
57370         return ret_conv;
57371 }
57372
57373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57374         LDKUpdateFulfillHTLC this_ptr_conv;
57375         this_ptr_conv.inner = untag_ptr(this_ptr);
57376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57378         this_ptr_conv.is_owned = false;
57379         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
57380 }
57381
57382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
57383         LDKUpdateFulfillHTLC this_ptr_conv;
57384         this_ptr_conv.inner = untag_ptr(this_ptr);
57385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57387         this_ptr_conv.is_owned = false;
57388         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57389         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
57390         return ret_arr;
57391 }
57392
57393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57394         LDKUpdateFulfillHTLC this_ptr_conv;
57395         this_ptr_conv.inner = untag_ptr(this_ptr);
57396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57398         this_ptr_conv.is_owned = false;
57399         LDKThirtyTwoBytes val_ref;
57400         CHECK((*env)->GetArrayLength(env, val) == 32);
57401         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
57402         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
57403 }
57404
57405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
57406         LDKChannelId channel_id_arg_conv;
57407         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
57408         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
57409         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
57410         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
57411         LDKThirtyTwoBytes payment_preimage_arg_ref;
57412         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
57413         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
57414         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
57415         int64_t ret_ref = 0;
57416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57418         return ret_ref;
57419 }
57420
57421 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
57422         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
57423         int64_t ret_ref = 0;
57424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57426         return ret_ref;
57427 }
57428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57429         LDKUpdateFulfillHTLC arg_conv;
57430         arg_conv.inner = untag_ptr(arg);
57431         arg_conv.is_owned = ptr_is_owned(arg);
57432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57433         arg_conv.is_owned = false;
57434         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
57435         return ret_conv;
57436 }
57437
57438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57439         LDKUpdateFulfillHTLC orig_conv;
57440         orig_conv.inner = untag_ptr(orig);
57441         orig_conv.is_owned = ptr_is_owned(orig);
57442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57443         orig_conv.is_owned = false;
57444         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
57445         int64_t ret_ref = 0;
57446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57448         return ret_ref;
57449 }
57450
57451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
57452         LDKUpdateFulfillHTLC o_conv;
57453         o_conv.inner = untag_ptr(o);
57454         o_conv.is_owned = ptr_is_owned(o);
57455         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57456         o_conv.is_owned = false;
57457         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
57458         return ret_conv;
57459 }
57460
57461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57462         LDKUpdateFulfillHTLC a_conv;
57463         a_conv.inner = untag_ptr(a);
57464         a_conv.is_owned = ptr_is_owned(a);
57465         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57466         a_conv.is_owned = false;
57467         LDKUpdateFulfillHTLC b_conv;
57468         b_conv.inner = untag_ptr(b);
57469         b_conv.is_owned = ptr_is_owned(b);
57470         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57471         b_conv.is_owned = false;
57472         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
57473         return ret_conv;
57474 }
57475
57476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57477         LDKUpdateFailHTLC this_obj_conv;
57478         this_obj_conv.inner = untag_ptr(this_obj);
57479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57481         UpdateFailHTLC_free(this_obj_conv);
57482 }
57483
57484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57485         LDKUpdateFailHTLC this_ptr_conv;
57486         this_ptr_conv.inner = untag_ptr(this_ptr);
57487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57489         this_ptr_conv.is_owned = false;
57490         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
57491         int64_t ret_ref = 0;
57492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57494         return ret_ref;
57495 }
57496
57497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57498         LDKUpdateFailHTLC this_ptr_conv;
57499         this_ptr_conv.inner = untag_ptr(this_ptr);
57500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57502         this_ptr_conv.is_owned = false;
57503         LDKChannelId val_conv;
57504         val_conv.inner = untag_ptr(val);
57505         val_conv.is_owned = ptr_is_owned(val);
57506         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57507         val_conv = ChannelId_clone(&val_conv);
57508         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
57509 }
57510
57511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57512         LDKUpdateFailHTLC this_ptr_conv;
57513         this_ptr_conv.inner = untag_ptr(this_ptr);
57514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57516         this_ptr_conv.is_owned = false;
57517         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
57518         return ret_conv;
57519 }
57520
57521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57522         LDKUpdateFailHTLC this_ptr_conv;
57523         this_ptr_conv.inner = untag_ptr(this_ptr);
57524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57526         this_ptr_conv.is_owned = false;
57527         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
57528 }
57529
57530 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
57531         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
57532         int64_t ret_ref = 0;
57533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57535         return ret_ref;
57536 }
57537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57538         LDKUpdateFailHTLC arg_conv;
57539         arg_conv.inner = untag_ptr(arg);
57540         arg_conv.is_owned = ptr_is_owned(arg);
57541         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57542         arg_conv.is_owned = false;
57543         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
57544         return ret_conv;
57545 }
57546
57547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57548         LDKUpdateFailHTLC orig_conv;
57549         orig_conv.inner = untag_ptr(orig);
57550         orig_conv.is_owned = ptr_is_owned(orig);
57551         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57552         orig_conv.is_owned = false;
57553         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
57554         int64_t ret_ref = 0;
57555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57557         return ret_ref;
57558 }
57559
57560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
57561         LDKUpdateFailHTLC o_conv;
57562         o_conv.inner = untag_ptr(o);
57563         o_conv.is_owned = ptr_is_owned(o);
57564         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57565         o_conv.is_owned = false;
57566         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
57567         return ret_conv;
57568 }
57569
57570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57571         LDKUpdateFailHTLC a_conv;
57572         a_conv.inner = untag_ptr(a);
57573         a_conv.is_owned = ptr_is_owned(a);
57574         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57575         a_conv.is_owned = false;
57576         LDKUpdateFailHTLC b_conv;
57577         b_conv.inner = untag_ptr(b);
57578         b_conv.is_owned = ptr_is_owned(b);
57579         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57580         b_conv.is_owned = false;
57581         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
57582         return ret_conv;
57583 }
57584
57585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57586         LDKUpdateFailMalformedHTLC this_obj_conv;
57587         this_obj_conv.inner = untag_ptr(this_obj);
57588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57590         UpdateFailMalformedHTLC_free(this_obj_conv);
57591 }
57592
57593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57594         LDKUpdateFailMalformedHTLC this_ptr_conv;
57595         this_ptr_conv.inner = untag_ptr(this_ptr);
57596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57598         this_ptr_conv.is_owned = false;
57599         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
57600         int64_t ret_ref = 0;
57601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57603         return ret_ref;
57604 }
57605
57606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57607         LDKUpdateFailMalformedHTLC this_ptr_conv;
57608         this_ptr_conv.inner = untag_ptr(this_ptr);
57609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57611         this_ptr_conv.is_owned = false;
57612         LDKChannelId val_conv;
57613         val_conv.inner = untag_ptr(val);
57614         val_conv.is_owned = ptr_is_owned(val);
57615         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57616         val_conv = ChannelId_clone(&val_conv);
57617         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
57618 }
57619
57620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57621         LDKUpdateFailMalformedHTLC this_ptr_conv;
57622         this_ptr_conv.inner = untag_ptr(this_ptr);
57623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57625         this_ptr_conv.is_owned = false;
57626         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
57627         return ret_conv;
57628 }
57629
57630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57631         LDKUpdateFailMalformedHTLC this_ptr_conv;
57632         this_ptr_conv.inner = untag_ptr(this_ptr);
57633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57635         this_ptr_conv.is_owned = false;
57636         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
57637 }
57638
57639 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
57640         LDKUpdateFailMalformedHTLC this_ptr_conv;
57641         this_ptr_conv.inner = untag_ptr(this_ptr);
57642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57644         this_ptr_conv.is_owned = false;
57645         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
57646         return ret_conv;
57647 }
57648
57649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
57650         LDKUpdateFailMalformedHTLC this_ptr_conv;
57651         this_ptr_conv.inner = untag_ptr(this_ptr);
57652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57654         this_ptr_conv.is_owned = false;
57655         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
57656 }
57657
57658 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
57659         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
57660         int64_t ret_ref = 0;
57661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57663         return ret_ref;
57664 }
57665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57666         LDKUpdateFailMalformedHTLC arg_conv;
57667         arg_conv.inner = untag_ptr(arg);
57668         arg_conv.is_owned = ptr_is_owned(arg);
57669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57670         arg_conv.is_owned = false;
57671         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
57672         return ret_conv;
57673 }
57674
57675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57676         LDKUpdateFailMalformedHTLC orig_conv;
57677         orig_conv.inner = untag_ptr(orig);
57678         orig_conv.is_owned = ptr_is_owned(orig);
57679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57680         orig_conv.is_owned = false;
57681         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
57682         int64_t ret_ref = 0;
57683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57685         return ret_ref;
57686 }
57687
57688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
57689         LDKUpdateFailMalformedHTLC o_conv;
57690         o_conv.inner = untag_ptr(o);
57691         o_conv.is_owned = ptr_is_owned(o);
57692         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57693         o_conv.is_owned = false;
57694         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
57695         return ret_conv;
57696 }
57697
57698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57699         LDKUpdateFailMalformedHTLC a_conv;
57700         a_conv.inner = untag_ptr(a);
57701         a_conv.is_owned = ptr_is_owned(a);
57702         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57703         a_conv.is_owned = false;
57704         LDKUpdateFailMalformedHTLC b_conv;
57705         b_conv.inner = untag_ptr(b);
57706         b_conv.is_owned = ptr_is_owned(b);
57707         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57708         b_conv.is_owned = false;
57709         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
57710         return ret_conv;
57711 }
57712
57713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57714         LDKCommitmentSigned this_obj_conv;
57715         this_obj_conv.inner = untag_ptr(this_obj);
57716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57718         CommitmentSigned_free(this_obj_conv);
57719 }
57720
57721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57722         LDKCommitmentSigned this_ptr_conv;
57723         this_ptr_conv.inner = untag_ptr(this_ptr);
57724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57726         this_ptr_conv.is_owned = false;
57727         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
57728         int64_t ret_ref = 0;
57729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57731         return ret_ref;
57732 }
57733
57734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57735         LDKCommitmentSigned this_ptr_conv;
57736         this_ptr_conv.inner = untag_ptr(this_ptr);
57737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57739         this_ptr_conv.is_owned = false;
57740         LDKChannelId val_conv;
57741         val_conv.inner = untag_ptr(val);
57742         val_conv.is_owned = ptr_is_owned(val);
57743         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57744         val_conv = ChannelId_clone(&val_conv);
57745         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
57746 }
57747
57748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57749         LDKCommitmentSigned this_ptr_conv;
57750         this_ptr_conv.inner = untag_ptr(this_ptr);
57751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57753         this_ptr_conv.is_owned = false;
57754         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57755         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
57756         return ret_arr;
57757 }
57758
57759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57760         LDKCommitmentSigned this_ptr_conv;
57761         this_ptr_conv.inner = untag_ptr(this_ptr);
57762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57764         this_ptr_conv.is_owned = false;
57765         LDKECDSASignature val_ref;
57766         CHECK((*env)->GetArrayLength(env, val) == 64);
57767         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57768         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
57769 }
57770
57771 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
57772         LDKCommitmentSigned this_ptr_conv;
57773         this_ptr_conv.inner = untag_ptr(this_ptr);
57774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57776         this_ptr_conv.is_owned = false;
57777         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
57778         jobjectArray ret_arr = NULL;
57779         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
57780         ;
57781         for (size_t i = 0; i < ret_var.datalen; i++) {
57782                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
57783                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
57784                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
57785         }
57786         
57787         FREE(ret_var.data);
57788         return ret_arr;
57789 }
57790
57791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
57792         LDKCommitmentSigned this_ptr_conv;
57793         this_ptr_conv.inner = untag_ptr(this_ptr);
57794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57796         this_ptr_conv.is_owned = false;
57797         LDKCVec_ECDSASignatureZ val_constr;
57798         val_constr.datalen = (*env)->GetArrayLength(env, val);
57799         if (val_constr.datalen > 0)
57800                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
57801         else
57802                 val_constr.data = NULL;
57803         for (size_t i = 0; i < val_constr.datalen; i++) {
57804                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
57805                 LDKECDSASignature val_conv_8_ref;
57806                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
57807                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
57808                 val_constr.data[i] = val_conv_8_ref;
57809         }
57810         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
57811 }
57812
57813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
57814         LDKChannelId channel_id_arg_conv;
57815         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
57816         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
57817         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
57818         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
57819         LDKECDSASignature signature_arg_ref;
57820         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
57821         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
57822         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
57823         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
57824         if (htlc_signatures_arg_constr.datalen > 0)
57825                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
57826         else
57827                 htlc_signatures_arg_constr.data = NULL;
57828         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
57829                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
57830                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
57831                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
57832                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
57833                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
57834         }
57835         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
57836         int64_t ret_ref = 0;
57837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57839         return ret_ref;
57840 }
57841
57842 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
57843         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
57844         int64_t ret_ref = 0;
57845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57847         return ret_ref;
57848 }
57849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57850         LDKCommitmentSigned arg_conv;
57851         arg_conv.inner = untag_ptr(arg);
57852         arg_conv.is_owned = ptr_is_owned(arg);
57853         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57854         arg_conv.is_owned = false;
57855         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
57856         return ret_conv;
57857 }
57858
57859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57860         LDKCommitmentSigned orig_conv;
57861         orig_conv.inner = untag_ptr(orig);
57862         orig_conv.is_owned = ptr_is_owned(orig);
57863         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57864         orig_conv.is_owned = false;
57865         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
57866         int64_t ret_ref = 0;
57867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57869         return ret_ref;
57870 }
57871
57872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
57873         LDKCommitmentSigned o_conv;
57874         o_conv.inner = untag_ptr(o);
57875         o_conv.is_owned = ptr_is_owned(o);
57876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57877         o_conv.is_owned = false;
57878         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
57879         return ret_conv;
57880 }
57881
57882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57883         LDKCommitmentSigned a_conv;
57884         a_conv.inner = untag_ptr(a);
57885         a_conv.is_owned = ptr_is_owned(a);
57886         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57887         a_conv.is_owned = false;
57888         LDKCommitmentSigned b_conv;
57889         b_conv.inner = untag_ptr(b);
57890         b_conv.is_owned = ptr_is_owned(b);
57891         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57892         b_conv.is_owned = false;
57893         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
57894         return ret_conv;
57895 }
57896
57897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57898         LDKRevokeAndACK this_obj_conv;
57899         this_obj_conv.inner = untag_ptr(this_obj);
57900         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57902         RevokeAndACK_free(this_obj_conv);
57903 }
57904
57905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57906         LDKRevokeAndACK this_ptr_conv;
57907         this_ptr_conv.inner = untag_ptr(this_ptr);
57908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57910         this_ptr_conv.is_owned = false;
57911         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
57912         int64_t ret_ref = 0;
57913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57915         return ret_ref;
57916 }
57917
57918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57919         LDKRevokeAndACK this_ptr_conv;
57920         this_ptr_conv.inner = untag_ptr(this_ptr);
57921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57923         this_ptr_conv.is_owned = false;
57924         LDKChannelId val_conv;
57925         val_conv.inner = untag_ptr(val);
57926         val_conv.is_owned = ptr_is_owned(val);
57927         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57928         val_conv = ChannelId_clone(&val_conv);
57929         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
57930 }
57931
57932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
57933         LDKRevokeAndACK this_ptr_conv;
57934         this_ptr_conv.inner = untag_ptr(this_ptr);
57935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57937         this_ptr_conv.is_owned = false;
57938         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57939         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
57940         return ret_arr;
57941 }
57942
57943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57944         LDKRevokeAndACK this_ptr_conv;
57945         this_ptr_conv.inner = untag_ptr(this_ptr);
57946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57948         this_ptr_conv.is_owned = false;
57949         LDKThirtyTwoBytes val_ref;
57950         CHECK((*env)->GetArrayLength(env, val) == 32);
57951         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
57952         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
57953 }
57954
57955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
57956         LDKRevokeAndACK this_ptr_conv;
57957         this_ptr_conv.inner = untag_ptr(this_ptr);
57958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57960         this_ptr_conv.is_owned = false;
57961         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
57962         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
57963         return ret_arr;
57964 }
57965
57966 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) {
57967         LDKRevokeAndACK this_ptr_conv;
57968         this_ptr_conv.inner = untag_ptr(this_ptr);
57969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57971         this_ptr_conv.is_owned = false;
57972         LDKPublicKey val_ref;
57973         CHECK((*env)->GetArrayLength(env, val) == 33);
57974         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
57975         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
57976 }
57977
57978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
57979         LDKChannelId channel_id_arg_conv;
57980         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
57981         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
57982         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
57983         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
57984         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
57985         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
57986         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
57987         LDKPublicKey next_per_commitment_point_arg_ref;
57988         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
57989         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
57990         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
57991         int64_t ret_ref = 0;
57992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57994         return ret_ref;
57995 }
57996
57997 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
57998         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
57999         int64_t ret_ref = 0;
58000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58002         return ret_ref;
58003 }
58004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58005         LDKRevokeAndACK arg_conv;
58006         arg_conv.inner = untag_ptr(arg);
58007         arg_conv.is_owned = ptr_is_owned(arg);
58008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58009         arg_conv.is_owned = false;
58010         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
58011         return ret_conv;
58012 }
58013
58014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58015         LDKRevokeAndACK orig_conv;
58016         orig_conv.inner = untag_ptr(orig);
58017         orig_conv.is_owned = ptr_is_owned(orig);
58018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58019         orig_conv.is_owned = false;
58020         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
58021         int64_t ret_ref = 0;
58022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58024         return ret_ref;
58025 }
58026
58027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1hash(JNIEnv *env, jclass clz, int64_t o) {
58028         LDKRevokeAndACK o_conv;
58029         o_conv.inner = untag_ptr(o);
58030         o_conv.is_owned = ptr_is_owned(o);
58031         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58032         o_conv.is_owned = false;
58033         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
58034         return ret_conv;
58035 }
58036
58037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58038         LDKRevokeAndACK a_conv;
58039         a_conv.inner = untag_ptr(a);
58040         a_conv.is_owned = ptr_is_owned(a);
58041         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58042         a_conv.is_owned = false;
58043         LDKRevokeAndACK b_conv;
58044         b_conv.inner = untag_ptr(b);
58045         b_conv.is_owned = ptr_is_owned(b);
58046         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58047         b_conv.is_owned = false;
58048         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
58049         return ret_conv;
58050 }
58051
58052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58053         LDKUpdateFee this_obj_conv;
58054         this_obj_conv.inner = untag_ptr(this_obj);
58055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58057         UpdateFee_free(this_obj_conv);
58058 }
58059
58060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58061         LDKUpdateFee this_ptr_conv;
58062         this_ptr_conv.inner = untag_ptr(this_ptr);
58063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58065         this_ptr_conv.is_owned = false;
58066         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
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
58073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58074         LDKUpdateFee this_ptr_conv;
58075         this_ptr_conv.inner = untag_ptr(this_ptr);
58076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58078         this_ptr_conv.is_owned = false;
58079         LDKChannelId val_conv;
58080         val_conv.inner = untag_ptr(val);
58081         val_conv.is_owned = ptr_is_owned(val);
58082         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58083         val_conv = ChannelId_clone(&val_conv);
58084         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
58085 }
58086
58087 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
58088         LDKUpdateFee this_ptr_conv;
58089         this_ptr_conv.inner = untag_ptr(this_ptr);
58090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58092         this_ptr_conv.is_owned = false;
58093         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
58094         return ret_conv;
58095 }
58096
58097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58098         LDKUpdateFee this_ptr_conv;
58099         this_ptr_conv.inner = untag_ptr(this_ptr);
58100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58102         this_ptr_conv.is_owned = false;
58103         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
58104 }
58105
58106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int32_t feerate_per_kw_arg) {
58107         LDKChannelId channel_id_arg_conv;
58108         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
58109         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
58110         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
58111         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
58112         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
58113         int64_t ret_ref = 0;
58114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58116         return ret_ref;
58117 }
58118
58119 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
58120         LDKUpdateFee ret_var = UpdateFee_clone(arg);
58121         int64_t ret_ref = 0;
58122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58124         return ret_ref;
58125 }
58126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58127         LDKUpdateFee arg_conv;
58128         arg_conv.inner = untag_ptr(arg);
58129         arg_conv.is_owned = ptr_is_owned(arg);
58130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58131         arg_conv.is_owned = false;
58132         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
58133         return ret_conv;
58134 }
58135
58136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58137         LDKUpdateFee orig_conv;
58138         orig_conv.inner = untag_ptr(orig);
58139         orig_conv.is_owned = ptr_is_owned(orig);
58140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58141         orig_conv.is_owned = false;
58142         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
58143         int64_t ret_ref = 0;
58144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58146         return ret_ref;
58147 }
58148
58149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1hash(JNIEnv *env, jclass clz, int64_t o) {
58150         LDKUpdateFee o_conv;
58151         o_conv.inner = untag_ptr(o);
58152         o_conv.is_owned = ptr_is_owned(o);
58153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58154         o_conv.is_owned = false;
58155         int64_t ret_conv = UpdateFee_hash(&o_conv);
58156         return ret_conv;
58157 }
58158
58159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58160         LDKUpdateFee a_conv;
58161         a_conv.inner = untag_ptr(a);
58162         a_conv.is_owned = ptr_is_owned(a);
58163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58164         a_conv.is_owned = false;
58165         LDKUpdateFee b_conv;
58166         b_conv.inner = untag_ptr(b);
58167         b_conv.is_owned = ptr_is_owned(b);
58168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58169         b_conv.is_owned = false;
58170         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
58171         return ret_conv;
58172 }
58173
58174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58175         LDKChannelReestablish this_obj_conv;
58176         this_obj_conv.inner = untag_ptr(this_obj);
58177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58179         ChannelReestablish_free(this_obj_conv);
58180 }
58181
58182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58183         LDKChannelReestablish this_ptr_conv;
58184         this_ptr_conv.inner = untag_ptr(this_ptr);
58185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58187         this_ptr_conv.is_owned = false;
58188         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
58189         int64_t ret_ref = 0;
58190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58192         return ret_ref;
58193 }
58194
58195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58196         LDKChannelReestablish this_ptr_conv;
58197         this_ptr_conv.inner = untag_ptr(this_ptr);
58198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58200         this_ptr_conv.is_owned = false;
58201         LDKChannelId val_conv;
58202         val_conv.inner = untag_ptr(val);
58203         val_conv.is_owned = ptr_is_owned(val);
58204         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58205         val_conv = ChannelId_clone(&val_conv);
58206         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
58207 }
58208
58209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
58210         LDKChannelReestablish this_ptr_conv;
58211         this_ptr_conv.inner = untag_ptr(this_ptr);
58212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58214         this_ptr_conv.is_owned = false;
58215         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
58216         return ret_conv;
58217 }
58218
58219 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) {
58220         LDKChannelReestablish this_ptr_conv;
58221         this_ptr_conv.inner = untag_ptr(this_ptr);
58222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58224         this_ptr_conv.is_owned = false;
58225         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
58226 }
58227
58228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
58229         LDKChannelReestablish this_ptr_conv;
58230         this_ptr_conv.inner = untag_ptr(this_ptr);
58231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58233         this_ptr_conv.is_owned = false;
58234         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
58235         return ret_conv;
58236 }
58237
58238 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) {
58239         LDKChannelReestablish this_ptr_conv;
58240         this_ptr_conv.inner = untag_ptr(this_ptr);
58241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58243         this_ptr_conv.is_owned = false;
58244         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
58245 }
58246
58247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
58248         LDKChannelReestablish this_ptr_conv;
58249         this_ptr_conv.inner = untag_ptr(this_ptr);
58250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58252         this_ptr_conv.is_owned = false;
58253         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58254         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
58255         return ret_arr;
58256 }
58257
58258 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) {
58259         LDKChannelReestablish this_ptr_conv;
58260         this_ptr_conv.inner = untag_ptr(this_ptr);
58261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58263         this_ptr_conv.is_owned = false;
58264         LDKThirtyTwoBytes val_ref;
58265         CHECK((*env)->GetArrayLength(env, val) == 32);
58266         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58267         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
58268 }
58269
58270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
58271         LDKChannelReestablish this_ptr_conv;
58272         this_ptr_conv.inner = untag_ptr(this_ptr);
58273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58275         this_ptr_conv.is_owned = false;
58276         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58277         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
58278         return ret_arr;
58279 }
58280
58281 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) {
58282         LDKChannelReestablish this_ptr_conv;
58283         this_ptr_conv.inner = untag_ptr(this_ptr);
58284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58286         this_ptr_conv.is_owned = false;
58287         LDKPublicKey val_ref;
58288         CHECK((*env)->GetArrayLength(env, val) == 33);
58289         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58290         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
58291 }
58292
58293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
58294         LDKChannelReestablish this_ptr_conv;
58295         this_ptr_conv.inner = untag_ptr(this_ptr);
58296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58298         this_ptr_conv.is_owned = false;
58299         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58300         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
58301         int64_t ret_ref = tag_ptr(ret_copy, true);
58302         return ret_ref;
58303 }
58304
58305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58306         LDKChannelReestablish this_ptr_conv;
58307         this_ptr_conv.inner = untag_ptr(this_ptr);
58308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58310         this_ptr_conv.is_owned = false;
58311         void* val_ptr = untag_ptr(val);
58312         CHECK_ACCESS(val_ptr);
58313         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58314         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58315         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
58316 }
58317
58318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int64_t 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) {
58319         LDKChannelId channel_id_arg_conv;
58320         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
58321         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
58322         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
58323         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
58324         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
58325         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
58326         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
58327         LDKPublicKey my_current_per_commitment_point_arg_ref;
58328         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
58329         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
58330         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
58331         CHECK_ACCESS(next_funding_txid_arg_ptr);
58332         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
58333         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
58334         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_conv, 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);
58335         int64_t ret_ref = 0;
58336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58338         return ret_ref;
58339 }
58340
58341 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
58342         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
58343         int64_t ret_ref = 0;
58344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58346         return ret_ref;
58347 }
58348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58349         LDKChannelReestablish arg_conv;
58350         arg_conv.inner = untag_ptr(arg);
58351         arg_conv.is_owned = ptr_is_owned(arg);
58352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58353         arg_conv.is_owned = false;
58354         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
58355         return ret_conv;
58356 }
58357
58358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58359         LDKChannelReestablish orig_conv;
58360         orig_conv.inner = untag_ptr(orig);
58361         orig_conv.is_owned = ptr_is_owned(orig);
58362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58363         orig_conv.is_owned = false;
58364         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
58365         int64_t ret_ref = 0;
58366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58368         return ret_ref;
58369 }
58370
58371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1hash(JNIEnv *env, jclass clz, int64_t o) {
58372         LDKChannelReestablish o_conv;
58373         o_conv.inner = untag_ptr(o);
58374         o_conv.is_owned = ptr_is_owned(o);
58375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58376         o_conv.is_owned = false;
58377         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
58378         return ret_conv;
58379 }
58380
58381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58382         LDKChannelReestablish a_conv;
58383         a_conv.inner = untag_ptr(a);
58384         a_conv.is_owned = ptr_is_owned(a);
58385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58386         a_conv.is_owned = false;
58387         LDKChannelReestablish b_conv;
58388         b_conv.inner = untag_ptr(b);
58389         b_conv.is_owned = ptr_is_owned(b);
58390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58391         b_conv.is_owned = false;
58392         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
58393         return ret_conv;
58394 }
58395
58396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58397         LDKAnnouncementSignatures this_obj_conv;
58398         this_obj_conv.inner = untag_ptr(this_obj);
58399         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58401         AnnouncementSignatures_free(this_obj_conv);
58402 }
58403
58404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58405         LDKAnnouncementSignatures this_ptr_conv;
58406         this_ptr_conv.inner = untag_ptr(this_ptr);
58407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58409         this_ptr_conv.is_owned = false;
58410         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
58411         int64_t ret_ref = 0;
58412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58414         return ret_ref;
58415 }
58416
58417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58418         LDKAnnouncementSignatures this_ptr_conv;
58419         this_ptr_conv.inner = untag_ptr(this_ptr);
58420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58422         this_ptr_conv.is_owned = false;
58423         LDKChannelId val_conv;
58424         val_conv.inner = untag_ptr(val);
58425         val_conv.is_owned = ptr_is_owned(val);
58426         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58427         val_conv = ChannelId_clone(&val_conv);
58428         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
58429 }
58430
58431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58432         LDKAnnouncementSignatures this_ptr_conv;
58433         this_ptr_conv.inner = untag_ptr(this_ptr);
58434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58436         this_ptr_conv.is_owned = false;
58437         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
58438         return ret_conv;
58439 }
58440
58441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58442         LDKAnnouncementSignatures this_ptr_conv;
58443         this_ptr_conv.inner = untag_ptr(this_ptr);
58444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58446         this_ptr_conv.is_owned = false;
58447         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
58448 }
58449
58450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
58451         LDKAnnouncementSignatures this_ptr_conv;
58452         this_ptr_conv.inner = untag_ptr(this_ptr);
58453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58455         this_ptr_conv.is_owned = false;
58456         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58457         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
58458         return ret_arr;
58459 }
58460
58461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58462         LDKAnnouncementSignatures this_ptr_conv;
58463         this_ptr_conv.inner = untag_ptr(this_ptr);
58464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58466         this_ptr_conv.is_owned = false;
58467         LDKECDSASignature val_ref;
58468         CHECK((*env)->GetArrayLength(env, val) == 64);
58469         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58470         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
58471 }
58472
58473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
58474         LDKAnnouncementSignatures this_ptr_conv;
58475         this_ptr_conv.inner = untag_ptr(this_ptr);
58476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58478         this_ptr_conv.is_owned = false;
58479         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
58481         return ret_arr;
58482 }
58483
58484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58485         LDKAnnouncementSignatures this_ptr_conv;
58486         this_ptr_conv.inner = untag_ptr(this_ptr);
58487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58489         this_ptr_conv.is_owned = false;
58490         LDKECDSASignature val_ref;
58491         CHECK((*env)->GetArrayLength(env, val) == 64);
58492         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58493         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
58494 }
58495
58496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
58497         LDKChannelId channel_id_arg_conv;
58498         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
58499         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
58500         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
58501         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
58502         LDKECDSASignature node_signature_arg_ref;
58503         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
58504         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
58505         LDKECDSASignature bitcoin_signature_arg_ref;
58506         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
58507         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
58508         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
58509         int64_t ret_ref = 0;
58510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58512         return ret_ref;
58513 }
58514
58515 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
58516         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
58517         int64_t ret_ref = 0;
58518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58520         return ret_ref;
58521 }
58522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58523         LDKAnnouncementSignatures arg_conv;
58524         arg_conv.inner = untag_ptr(arg);
58525         arg_conv.is_owned = ptr_is_owned(arg);
58526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58527         arg_conv.is_owned = false;
58528         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
58529         return ret_conv;
58530 }
58531
58532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58533         LDKAnnouncementSignatures orig_conv;
58534         orig_conv.inner = untag_ptr(orig);
58535         orig_conv.is_owned = ptr_is_owned(orig);
58536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58537         orig_conv.is_owned = false;
58538         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
58539         int64_t ret_ref = 0;
58540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58542         return ret_ref;
58543 }
58544
58545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
58546         LDKAnnouncementSignatures o_conv;
58547         o_conv.inner = untag_ptr(o);
58548         o_conv.is_owned = ptr_is_owned(o);
58549         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58550         o_conv.is_owned = false;
58551         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
58552         return ret_conv;
58553 }
58554
58555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58556         LDKAnnouncementSignatures a_conv;
58557         a_conv.inner = untag_ptr(a);
58558         a_conv.is_owned = ptr_is_owned(a);
58559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58560         a_conv.is_owned = false;
58561         LDKAnnouncementSignatures b_conv;
58562         b_conv.inner = untag_ptr(b);
58563         b_conv.is_owned = ptr_is_owned(b);
58564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58565         b_conv.is_owned = false;
58566         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
58567         return ret_conv;
58568 }
58569
58570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58571         if (!ptr_is_owned(this_ptr)) return;
58572         void* this_ptr_ptr = untag_ptr(this_ptr);
58573         CHECK_ACCESS(this_ptr_ptr);
58574         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
58575         FREE(untag_ptr(this_ptr));
58576         SocketAddress_free(this_ptr_conv);
58577 }
58578
58579 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
58580         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58581         *ret_copy = SocketAddress_clone(arg);
58582         int64_t ret_ref = tag_ptr(ret_copy, true);
58583         return ret_ref;
58584 }
58585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58586         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
58587         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
58588         return ret_conv;
58589 }
58590
58591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58592         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
58593         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58594         *ret_copy = SocketAddress_clone(orig_conv);
58595         int64_t ret_ref = tag_ptr(ret_copy, true);
58596         return ret_ref;
58597 }
58598
58599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
58600         LDKFourBytes addr_ref;
58601         CHECK((*env)->GetArrayLength(env, addr) == 4);
58602         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
58603         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58604         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
58605         int64_t ret_ref = tag_ptr(ret_copy, true);
58606         return ret_ref;
58607 }
58608
58609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
58610         LDKSixteenBytes addr_ref;
58611         CHECK((*env)->GetArrayLength(env, addr) == 16);
58612         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
58613         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58614         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
58615         int64_t ret_ref = tag_ptr(ret_copy, true);
58616         return ret_ref;
58617 }
58618
58619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
58620         LDKTwelveBytes a_ref;
58621         CHECK((*env)->GetArrayLength(env, a) == 12);
58622         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
58623         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58624         *ret_copy = SocketAddress_onion_v2(a_ref);
58625         int64_t ret_ref = tag_ptr(ret_copy, true);
58626         return ret_ref;
58627 }
58628
58629 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) {
58630         LDKThirtyTwoBytes ed25519_pubkey_ref;
58631         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
58632         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
58633         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58634         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
58635         int64_t ret_ref = tag_ptr(ret_copy, true);
58636         return ret_ref;
58637 }
58638
58639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
58640         LDKHostname hostname_conv;
58641         hostname_conv.inner = untag_ptr(hostname);
58642         hostname_conv.is_owned = ptr_is_owned(hostname);
58643         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
58644         hostname_conv = Hostname_clone(&hostname_conv);
58645         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58646         *ret_copy = SocketAddress_hostname(hostname_conv, port);
58647         int64_t ret_ref = tag_ptr(ret_copy, true);
58648         return ret_ref;
58649 }
58650
58651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hash(JNIEnv *env, jclass clz, int64_t o) {
58652         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
58653         int64_t ret_conv = SocketAddress_hash(o_conv);
58654         return ret_conv;
58655 }
58656
58657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58658         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
58659         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
58660         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
58661         return ret_conv;
58662 }
58663
58664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
58665         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
58666         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
58667         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58668         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58669         CVec_u8Z_free(ret_var);
58670         return ret_arr;
58671 }
58672
58673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58674         LDKu8slice ser_ref;
58675         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58676         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58677         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
58678         *ret_conv = SocketAddress_read(ser_ref);
58679         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58680         return tag_ptr(ret_conv, true);
58681 }
58682
58683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58684         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
58685         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
58686         return ret_conv;
58687 }
58688
58689 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
58690         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
58691         return ret_conv;
58692 }
58693
58694 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
58695         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
58696         return ret_conv;
58697 }
58698
58699 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
58700         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
58701         return ret_conv;
58702 }
58703
58704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
58705         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
58706         return ret_conv;
58707 }
58708
58709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1hash(JNIEnv *env, jclass clz, int64_t o) {
58710         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
58711         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
58712         return ret_conv;
58713 }
58714
58715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58716         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
58717         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
58718         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
58719         return ret_conv;
58720 }
58721
58722 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
58723         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
58724         LDKStr ret_str = SocketAddressParseError_to_str(o_conv);
58725         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
58726         Str_free(ret_str);
58727         return ret_conv;
58728 }
58729
58730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
58731         LDKStr host_conv = java_to_owned_str(env, host);
58732         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
58733         *ret_conv = parse_onion_address(host_conv, port);
58734         return tag_ptr(ret_conv, true);
58735 }
58736
58737 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
58738         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
58739         LDKStr ret_str = SocketAddress_to_str(o_conv);
58740         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
58741         Str_free(ret_str);
58742         return ret_conv;
58743 }
58744
58745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
58746         LDKStr s_conv = java_to_owned_str(env, s);
58747         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
58748         *ret_conv = SocketAddress_from_str(s_conv);
58749         return tag_ptr(ret_conv, true);
58750 }
58751
58752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58753         if (!ptr_is_owned(this_ptr)) return;
58754         void* this_ptr_ptr = untag_ptr(this_ptr);
58755         CHECK_ACCESS(this_ptr_ptr);
58756         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
58757         FREE(untag_ptr(this_ptr));
58758         UnsignedGossipMessage_free(this_ptr_conv);
58759 }
58760
58761 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
58762         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
58763         *ret_copy = UnsignedGossipMessage_clone(arg);
58764         int64_t ret_ref = tag_ptr(ret_copy, true);
58765         return ret_ref;
58766 }
58767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58768         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
58769         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
58770         return ret_conv;
58771 }
58772
58773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58774         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
58775         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
58776         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
58777         int64_t ret_ref = tag_ptr(ret_copy, true);
58778         return ret_ref;
58779 }
58780
58781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
58782         LDKUnsignedChannelAnnouncement a_conv;
58783         a_conv.inner = untag_ptr(a);
58784         a_conv.is_owned = ptr_is_owned(a);
58785         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58786         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
58787         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
58788         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
58789         int64_t ret_ref = tag_ptr(ret_copy, true);
58790         return ret_ref;
58791 }
58792
58793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
58794         LDKUnsignedChannelUpdate a_conv;
58795         a_conv.inner = untag_ptr(a);
58796         a_conv.is_owned = ptr_is_owned(a);
58797         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58798         a_conv = UnsignedChannelUpdate_clone(&a_conv);
58799         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
58800         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
58801         int64_t ret_ref = tag_ptr(ret_copy, true);
58802         return ret_ref;
58803 }
58804
58805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
58806         LDKUnsignedNodeAnnouncement a_conv;
58807         a_conv.inner = untag_ptr(a);
58808         a_conv.is_owned = ptr_is_owned(a);
58809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58810         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
58811         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
58812         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
58813         int64_t ret_ref = tag_ptr(ret_copy, true);
58814         return ret_ref;
58815 }
58816
58817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
58818         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
58819         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
58820         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58821         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58822         CVec_u8Z_free(ret_var);
58823         return ret_arr;
58824 }
58825
58826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58827         LDKUnsignedNodeAnnouncement this_obj_conv;
58828         this_obj_conv.inner = untag_ptr(this_obj);
58829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58831         UnsignedNodeAnnouncement_free(this_obj_conv);
58832 }
58833
58834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
58835         LDKUnsignedNodeAnnouncement this_ptr_conv;
58836         this_ptr_conv.inner = untag_ptr(this_ptr);
58837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58839         this_ptr_conv.is_owned = false;
58840         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
58841         int64_t ret_ref = 0;
58842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58844         return ret_ref;
58845 }
58846
58847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58848         LDKUnsignedNodeAnnouncement this_ptr_conv;
58849         this_ptr_conv.inner = untag_ptr(this_ptr);
58850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58852         this_ptr_conv.is_owned = false;
58853         LDKNodeFeatures val_conv;
58854         val_conv.inner = untag_ptr(val);
58855         val_conv.is_owned = ptr_is_owned(val);
58856         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58857         val_conv = NodeFeatures_clone(&val_conv);
58858         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
58859 }
58860
58861 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
58862         LDKUnsignedNodeAnnouncement this_ptr_conv;
58863         this_ptr_conv.inner = untag_ptr(this_ptr);
58864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58866         this_ptr_conv.is_owned = false;
58867         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
58868         return ret_conv;
58869 }
58870
58871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58872         LDKUnsignedNodeAnnouncement this_ptr_conv;
58873         this_ptr_conv.inner = untag_ptr(this_ptr);
58874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58876         this_ptr_conv.is_owned = false;
58877         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
58878 }
58879
58880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58881         LDKUnsignedNodeAnnouncement this_ptr_conv;
58882         this_ptr_conv.inner = untag_ptr(this_ptr);
58883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58885         this_ptr_conv.is_owned = false;
58886         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
58887         int64_t ret_ref = 0;
58888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58890         return ret_ref;
58891 }
58892
58893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58894         LDKUnsignedNodeAnnouncement this_ptr_conv;
58895         this_ptr_conv.inner = untag_ptr(this_ptr);
58896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58898         this_ptr_conv.is_owned = false;
58899         LDKNodeId val_conv;
58900         val_conv.inner = untag_ptr(val);
58901         val_conv.is_owned = ptr_is_owned(val);
58902         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58903         val_conv = NodeId_clone(&val_conv);
58904         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
58905 }
58906
58907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
58908         LDKUnsignedNodeAnnouncement this_ptr_conv;
58909         this_ptr_conv.inner = untag_ptr(this_ptr);
58910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58912         this_ptr_conv.is_owned = false;
58913         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
58914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
58915         return ret_arr;
58916 }
58917
58918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58919         LDKUnsignedNodeAnnouncement this_ptr_conv;
58920         this_ptr_conv.inner = untag_ptr(this_ptr);
58921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58923         this_ptr_conv.is_owned = false;
58924         LDKThreeBytes val_ref;
58925         CHECK((*env)->GetArrayLength(env, val) == 3);
58926         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
58927         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
58928 }
58929
58930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
58931         LDKUnsignedNodeAnnouncement this_ptr_conv;
58932         this_ptr_conv.inner = untag_ptr(this_ptr);
58933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58935         this_ptr_conv.is_owned = false;
58936         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
58937         int64_t ret_ref = 0;
58938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58940         return ret_ref;
58941 }
58942
58943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58944         LDKUnsignedNodeAnnouncement this_ptr_conv;
58945         this_ptr_conv.inner = untag_ptr(this_ptr);
58946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58948         this_ptr_conv.is_owned = false;
58949         LDKNodeAlias val_conv;
58950         val_conv.inner = untag_ptr(val);
58951         val_conv.is_owned = ptr_is_owned(val);
58952         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58953         val_conv = NodeAlias_clone(&val_conv);
58954         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
58955 }
58956
58957 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
58958         LDKUnsignedNodeAnnouncement this_ptr_conv;
58959         this_ptr_conv.inner = untag_ptr(this_ptr);
58960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58962         this_ptr_conv.is_owned = false;
58963         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
58964         int64_tArray ret_arr = NULL;
58965         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58966         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58967         for (size_t p = 0; p < ret_var.datalen; p++) {
58968                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
58969                 *ret_conv_15_copy = ret_var.data[p];
58970                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
58971                 ret_arr_ptr[p] = ret_conv_15_ref;
58972         }
58973         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58974         FREE(ret_var.data);
58975         return ret_arr;
58976 }
58977
58978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
58979         LDKUnsignedNodeAnnouncement this_ptr_conv;
58980         this_ptr_conv.inner = untag_ptr(this_ptr);
58981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58983         this_ptr_conv.is_owned = false;
58984         LDKCVec_SocketAddressZ val_constr;
58985         val_constr.datalen = (*env)->GetArrayLength(env, val);
58986         if (val_constr.datalen > 0)
58987                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
58988         else
58989                 val_constr.data = NULL;
58990         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
58991         for (size_t p = 0; p < val_constr.datalen; p++) {
58992                 int64_t val_conv_15 = val_vals[p];
58993                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
58994                 CHECK_ACCESS(val_conv_15_ptr);
58995                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
58996                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
58997                 val_constr.data[p] = val_conv_15_conv;
58998         }
58999         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59000         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
59001 }
59002
59003 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1excess_1address_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
59004         LDKUnsignedNodeAnnouncement this_ptr_conv;
59005         this_ptr_conv.inner = untag_ptr(this_ptr);
59006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59008         this_ptr_conv.is_owned = false;
59009         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
59010         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59011         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59012         CVec_u8Z_free(ret_var);
59013         return ret_arr;
59014 }
59015
59016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1excess_1address_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59017         LDKUnsignedNodeAnnouncement this_ptr_conv;
59018         this_ptr_conv.inner = untag_ptr(this_ptr);
59019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59021         this_ptr_conv.is_owned = false;
59022         LDKCVec_u8Z val_ref;
59023         val_ref.datalen = (*env)->GetArrayLength(env, val);
59024         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
59025         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
59026         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
59027 }
59028
59029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
59030         LDKUnsignedNodeAnnouncement this_ptr_conv;
59031         this_ptr_conv.inner = untag_ptr(this_ptr);
59032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59034         this_ptr_conv.is_owned = false;
59035         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
59036         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59037         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59038         CVec_u8Z_free(ret_var);
59039         return ret_arr;
59040 }
59041
59042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59043         LDKUnsignedNodeAnnouncement this_ptr_conv;
59044         this_ptr_conv.inner = untag_ptr(this_ptr);
59045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59047         this_ptr_conv.is_owned = false;
59048         LDKCVec_u8Z val_ref;
59049         val_ref.datalen = (*env)->GetArrayLength(env, val);
59050         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
59051         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
59052         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
59053 }
59054
59055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t timestamp_arg, int64_t node_id_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_tArray addresses_arg, int8_tArray excess_address_data_arg, int8_tArray excess_data_arg) {
59056         LDKNodeFeatures features_arg_conv;
59057         features_arg_conv.inner = untag_ptr(features_arg);
59058         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59059         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59060         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
59061         LDKNodeId node_id_arg_conv;
59062         node_id_arg_conv.inner = untag_ptr(node_id_arg);
59063         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
59064         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
59065         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
59066         LDKThreeBytes rgb_arg_ref;
59067         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
59068         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
59069         LDKNodeAlias alias_arg_conv;
59070         alias_arg_conv.inner = untag_ptr(alias_arg);
59071         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
59072         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
59073         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
59074         LDKCVec_SocketAddressZ addresses_arg_constr;
59075         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
59076         if (addresses_arg_constr.datalen > 0)
59077                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
59078         else
59079                 addresses_arg_constr.data = NULL;
59080         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
59081         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
59082                 int64_t addresses_arg_conv_15 = addresses_arg_vals[p];
59083                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
59084                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
59085                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
59086                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
59087         }
59088         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
59089         LDKCVec_u8Z excess_address_data_arg_ref;
59090         excess_address_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_address_data_arg);
59091         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
59092         (*env)->GetByteArrayRegion(env, excess_address_data_arg, 0, excess_address_data_arg_ref.datalen, excess_address_data_arg_ref.data);
59093         LDKCVec_u8Z excess_data_arg_ref;
59094         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
59095         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
59096         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
59097         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_new(features_arg_conv, timestamp_arg, node_id_arg_conv, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, excess_address_data_arg_ref, excess_data_arg_ref);
59098         int64_t ret_ref = 0;
59099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59101         return ret_ref;
59102 }
59103
59104 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
59105         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
59106         int64_t ret_ref = 0;
59107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59109         return ret_ref;
59110 }
59111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59112         LDKUnsignedNodeAnnouncement arg_conv;
59113         arg_conv.inner = untag_ptr(arg);
59114         arg_conv.is_owned = ptr_is_owned(arg);
59115         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59116         arg_conv.is_owned = false;
59117         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
59118         return ret_conv;
59119 }
59120
59121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59122         LDKUnsignedNodeAnnouncement orig_conv;
59123         orig_conv.inner = untag_ptr(orig);
59124         orig_conv.is_owned = ptr_is_owned(orig);
59125         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59126         orig_conv.is_owned = false;
59127         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
59128         int64_t ret_ref = 0;
59129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59131         return ret_ref;
59132 }
59133
59134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
59135         LDKUnsignedNodeAnnouncement o_conv;
59136         o_conv.inner = untag_ptr(o);
59137         o_conv.is_owned = ptr_is_owned(o);
59138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59139         o_conv.is_owned = false;
59140         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
59141         return ret_conv;
59142 }
59143
59144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59145         LDKUnsignedNodeAnnouncement a_conv;
59146         a_conv.inner = untag_ptr(a);
59147         a_conv.is_owned = ptr_is_owned(a);
59148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59149         a_conv.is_owned = false;
59150         LDKUnsignedNodeAnnouncement b_conv;
59151         b_conv.inner = untag_ptr(b);
59152         b_conv.is_owned = ptr_is_owned(b);
59153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59154         b_conv.is_owned = false;
59155         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
59156         return ret_conv;
59157 }
59158
59159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59160         LDKNodeAnnouncement this_obj_conv;
59161         this_obj_conv.inner = untag_ptr(this_obj);
59162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59164         NodeAnnouncement_free(this_obj_conv);
59165 }
59166
59167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
59168         LDKNodeAnnouncement this_ptr_conv;
59169         this_ptr_conv.inner = untag_ptr(this_ptr);
59170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59172         this_ptr_conv.is_owned = false;
59173         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59174         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
59175         return ret_arr;
59176 }
59177
59178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59179         LDKNodeAnnouncement this_ptr_conv;
59180         this_ptr_conv.inner = untag_ptr(this_ptr);
59181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59183         this_ptr_conv.is_owned = false;
59184         LDKECDSASignature val_ref;
59185         CHECK((*env)->GetArrayLength(env, val) == 64);
59186         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59187         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
59188 }
59189
59190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
59191         LDKNodeAnnouncement this_ptr_conv;
59192         this_ptr_conv.inner = untag_ptr(this_ptr);
59193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59195         this_ptr_conv.is_owned = false;
59196         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
59197         int64_t ret_ref = 0;
59198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59200         return ret_ref;
59201 }
59202
59203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59204         LDKNodeAnnouncement this_ptr_conv;
59205         this_ptr_conv.inner = untag_ptr(this_ptr);
59206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59208         this_ptr_conv.is_owned = false;
59209         LDKUnsignedNodeAnnouncement val_conv;
59210         val_conv.inner = untag_ptr(val);
59211         val_conv.is_owned = ptr_is_owned(val);
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59213         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
59214         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
59215 }
59216
59217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
59218         LDKECDSASignature signature_arg_ref;
59219         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
59220         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
59221         LDKUnsignedNodeAnnouncement contents_arg_conv;
59222         contents_arg_conv.inner = untag_ptr(contents_arg);
59223         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
59224         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
59225         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
59226         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
59227         int64_t ret_ref = 0;
59228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59230         return ret_ref;
59231 }
59232
59233 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
59234         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
59235         int64_t ret_ref = 0;
59236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59238         return ret_ref;
59239 }
59240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59241         LDKNodeAnnouncement arg_conv;
59242         arg_conv.inner = untag_ptr(arg);
59243         arg_conv.is_owned = ptr_is_owned(arg);
59244         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59245         arg_conv.is_owned = false;
59246         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
59247         return ret_conv;
59248 }
59249
59250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59251         LDKNodeAnnouncement orig_conv;
59252         orig_conv.inner = untag_ptr(orig);
59253         orig_conv.is_owned = ptr_is_owned(orig);
59254         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59255         orig_conv.is_owned = false;
59256         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
59257         int64_t ret_ref = 0;
59258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59260         return ret_ref;
59261 }
59262
59263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
59264         LDKNodeAnnouncement o_conv;
59265         o_conv.inner = untag_ptr(o);
59266         o_conv.is_owned = ptr_is_owned(o);
59267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59268         o_conv.is_owned = false;
59269         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
59270         return ret_conv;
59271 }
59272
59273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59274         LDKNodeAnnouncement a_conv;
59275         a_conv.inner = untag_ptr(a);
59276         a_conv.is_owned = ptr_is_owned(a);
59277         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59278         a_conv.is_owned = false;
59279         LDKNodeAnnouncement b_conv;
59280         b_conv.inner = untag_ptr(b);
59281         b_conv.is_owned = ptr_is_owned(b);
59282         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59283         b_conv.is_owned = false;
59284         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
59285         return ret_conv;
59286 }
59287
59288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59289         LDKUnsignedChannelAnnouncement this_obj_conv;
59290         this_obj_conv.inner = untag_ptr(this_obj);
59291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59293         UnsignedChannelAnnouncement_free(this_obj_conv);
59294 }
59295
59296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59297         LDKUnsignedChannelAnnouncement 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         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
59303         int64_t ret_ref = 0;
59304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59306         return ret_ref;
59307 }
59308
59309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59310         LDKUnsignedChannelAnnouncement this_ptr_conv;
59311         this_ptr_conv.inner = untag_ptr(this_ptr);
59312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59314         this_ptr_conv.is_owned = false;
59315         LDKChannelFeatures val_conv;
59316         val_conv.inner = untag_ptr(val);
59317         val_conv.is_owned = ptr_is_owned(val);
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59319         val_conv = ChannelFeatures_clone(&val_conv);
59320         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
59321 }
59322
59323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59324         LDKUnsignedChannelAnnouncement this_ptr_conv;
59325         this_ptr_conv.inner = untag_ptr(this_ptr);
59326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59328         this_ptr_conv.is_owned = false;
59329         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59330         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
59331         return ret_arr;
59332 }
59333
59334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59335         LDKUnsignedChannelAnnouncement this_ptr_conv;
59336         this_ptr_conv.inner = untag_ptr(this_ptr);
59337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59339         this_ptr_conv.is_owned = false;
59340         LDKThirtyTwoBytes val_ref;
59341         CHECK((*env)->GetArrayLength(env, val) == 32);
59342         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59343         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
59344 }
59345
59346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
59347         LDKUnsignedChannelAnnouncement this_ptr_conv;
59348         this_ptr_conv.inner = untag_ptr(this_ptr);
59349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59351         this_ptr_conv.is_owned = false;
59352         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
59353         return ret_conv;
59354 }
59355
59356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59357         LDKUnsignedChannelAnnouncement this_ptr_conv;
59358         this_ptr_conv.inner = untag_ptr(this_ptr);
59359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59361         this_ptr_conv.is_owned = false;
59362         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
59363 }
59364
59365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
59366         LDKUnsignedChannelAnnouncement this_ptr_conv;
59367         this_ptr_conv.inner = untag_ptr(this_ptr);
59368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59370         this_ptr_conv.is_owned = false;
59371         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
59372         int64_t ret_ref = 0;
59373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59375         return ret_ref;
59376 }
59377
59378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59379         LDKUnsignedChannelAnnouncement this_ptr_conv;
59380         this_ptr_conv.inner = untag_ptr(this_ptr);
59381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59383         this_ptr_conv.is_owned = false;
59384         LDKNodeId val_conv;
59385         val_conv.inner = untag_ptr(val);
59386         val_conv.is_owned = ptr_is_owned(val);
59387         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59388         val_conv = NodeId_clone(&val_conv);
59389         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
59390 }
59391
59392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
59393         LDKUnsignedChannelAnnouncement this_ptr_conv;
59394         this_ptr_conv.inner = untag_ptr(this_ptr);
59395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59397         this_ptr_conv.is_owned = false;
59398         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
59399         int64_t ret_ref = 0;
59400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59402         return ret_ref;
59403 }
59404
59405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59406         LDKUnsignedChannelAnnouncement this_ptr_conv;
59407         this_ptr_conv.inner = untag_ptr(this_ptr);
59408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59410         this_ptr_conv.is_owned = false;
59411         LDKNodeId val_conv;
59412         val_conv.inner = untag_ptr(val);
59413         val_conv.is_owned = ptr_is_owned(val);
59414         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59415         val_conv = NodeId_clone(&val_conv);
59416         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
59417 }
59418
59419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
59420         LDKUnsignedChannelAnnouncement this_ptr_conv;
59421         this_ptr_conv.inner = untag_ptr(this_ptr);
59422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59424         this_ptr_conv.is_owned = false;
59425         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
59426         int64_t ret_ref = 0;
59427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59429         return ret_ref;
59430 }
59431
59432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59433         LDKUnsignedChannelAnnouncement this_ptr_conv;
59434         this_ptr_conv.inner = untag_ptr(this_ptr);
59435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59437         this_ptr_conv.is_owned = false;
59438         LDKNodeId val_conv;
59439         val_conv.inner = untag_ptr(val);
59440         val_conv.is_owned = ptr_is_owned(val);
59441         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59442         val_conv = NodeId_clone(&val_conv);
59443         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
59444 }
59445
59446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
59447         LDKUnsignedChannelAnnouncement this_ptr_conv;
59448         this_ptr_conv.inner = untag_ptr(this_ptr);
59449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59451         this_ptr_conv.is_owned = false;
59452         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
59453         int64_t ret_ref = 0;
59454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59456         return ret_ref;
59457 }
59458
59459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59460         LDKUnsignedChannelAnnouncement this_ptr_conv;
59461         this_ptr_conv.inner = untag_ptr(this_ptr);
59462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59464         this_ptr_conv.is_owned = false;
59465         LDKNodeId val_conv;
59466         val_conv.inner = untag_ptr(val);
59467         val_conv.is_owned = ptr_is_owned(val);
59468         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59469         val_conv = NodeId_clone(&val_conv);
59470         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
59471 }
59472
59473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
59474         LDKUnsignedChannelAnnouncement this_ptr_conv;
59475         this_ptr_conv.inner = untag_ptr(this_ptr);
59476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59478         this_ptr_conv.is_owned = false;
59479         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
59480         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59481         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59482         CVec_u8Z_free(ret_var);
59483         return ret_arr;
59484 }
59485
59486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59487         LDKUnsignedChannelAnnouncement this_ptr_conv;
59488         this_ptr_conv.inner = untag_ptr(this_ptr);
59489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59491         this_ptr_conv.is_owned = false;
59492         LDKCVec_u8Z val_ref;
59493         val_ref.datalen = (*env)->GetArrayLength(env, val);
59494         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
59495         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
59496         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
59497 }
59498
59499 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) {
59500         LDKChannelFeatures features_arg_conv;
59501         features_arg_conv.inner = untag_ptr(features_arg);
59502         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59503         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59504         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
59505         LDKThirtyTwoBytes chain_hash_arg_ref;
59506         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59507         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59508         LDKNodeId node_id_1_arg_conv;
59509         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
59510         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
59511         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
59512         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
59513         LDKNodeId node_id_2_arg_conv;
59514         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
59515         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
59516         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
59517         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
59518         LDKNodeId bitcoin_key_1_arg_conv;
59519         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
59520         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
59521         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
59522         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
59523         LDKNodeId bitcoin_key_2_arg_conv;
59524         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
59525         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
59526         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
59527         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
59528         LDKCVec_u8Z excess_data_arg_ref;
59529         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
59530         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
59531         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
59532         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);
59533         int64_t ret_ref = 0;
59534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59536         return ret_ref;
59537 }
59538
59539 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
59540         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
59541         int64_t ret_ref = 0;
59542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59544         return ret_ref;
59545 }
59546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59547         LDKUnsignedChannelAnnouncement arg_conv;
59548         arg_conv.inner = untag_ptr(arg);
59549         arg_conv.is_owned = ptr_is_owned(arg);
59550         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59551         arg_conv.is_owned = false;
59552         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
59553         return ret_conv;
59554 }
59555
59556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59557         LDKUnsignedChannelAnnouncement orig_conv;
59558         orig_conv.inner = untag_ptr(orig);
59559         orig_conv.is_owned = ptr_is_owned(orig);
59560         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59561         orig_conv.is_owned = false;
59562         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
59563         int64_t ret_ref = 0;
59564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59566         return ret_ref;
59567 }
59568
59569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
59570         LDKUnsignedChannelAnnouncement o_conv;
59571         o_conv.inner = untag_ptr(o);
59572         o_conv.is_owned = ptr_is_owned(o);
59573         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59574         o_conv.is_owned = false;
59575         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
59576         return ret_conv;
59577 }
59578
59579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59580         LDKUnsignedChannelAnnouncement a_conv;
59581         a_conv.inner = untag_ptr(a);
59582         a_conv.is_owned = ptr_is_owned(a);
59583         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59584         a_conv.is_owned = false;
59585         LDKUnsignedChannelAnnouncement b_conv;
59586         b_conv.inner = untag_ptr(b);
59587         b_conv.is_owned = ptr_is_owned(b);
59588         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59589         b_conv.is_owned = false;
59590         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
59591         return ret_conv;
59592 }
59593
59594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59595         LDKChannelAnnouncement this_obj_conv;
59596         this_obj_conv.inner = untag_ptr(this_obj);
59597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59599         ChannelAnnouncement_free(this_obj_conv);
59600 }
59601
59602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
59603         LDKChannelAnnouncement this_ptr_conv;
59604         this_ptr_conv.inner = untag_ptr(this_ptr);
59605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59607         this_ptr_conv.is_owned = false;
59608         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59609         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
59610         return ret_arr;
59611 }
59612
59613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59614         LDKChannelAnnouncement this_ptr_conv;
59615         this_ptr_conv.inner = untag_ptr(this_ptr);
59616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59618         this_ptr_conv.is_owned = false;
59619         LDKECDSASignature val_ref;
59620         CHECK((*env)->GetArrayLength(env, val) == 64);
59621         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59622         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
59623 }
59624
59625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
59626         LDKChannelAnnouncement this_ptr_conv;
59627         this_ptr_conv.inner = untag_ptr(this_ptr);
59628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59630         this_ptr_conv.is_owned = false;
59631         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
59633         return ret_arr;
59634 }
59635
59636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59637         LDKChannelAnnouncement this_ptr_conv;
59638         this_ptr_conv.inner = untag_ptr(this_ptr);
59639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59641         this_ptr_conv.is_owned = false;
59642         LDKECDSASignature val_ref;
59643         CHECK((*env)->GetArrayLength(env, val) == 64);
59644         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59645         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
59646 }
59647
59648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
59649         LDKChannelAnnouncement this_ptr_conv;
59650         this_ptr_conv.inner = untag_ptr(this_ptr);
59651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59653         this_ptr_conv.is_owned = false;
59654         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59655         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
59656         return ret_arr;
59657 }
59658
59659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59660         LDKChannelAnnouncement this_ptr_conv;
59661         this_ptr_conv.inner = untag_ptr(this_ptr);
59662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59664         this_ptr_conv.is_owned = false;
59665         LDKECDSASignature val_ref;
59666         CHECK((*env)->GetArrayLength(env, val) == 64);
59667         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59668         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
59669 }
59670
59671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
59672         LDKChannelAnnouncement this_ptr_conv;
59673         this_ptr_conv.inner = untag_ptr(this_ptr);
59674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59676         this_ptr_conv.is_owned = false;
59677         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59678         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
59679         return ret_arr;
59680 }
59681
59682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59683         LDKChannelAnnouncement this_ptr_conv;
59684         this_ptr_conv.inner = untag_ptr(this_ptr);
59685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59687         this_ptr_conv.is_owned = false;
59688         LDKECDSASignature val_ref;
59689         CHECK((*env)->GetArrayLength(env, val) == 64);
59690         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59691         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
59692 }
59693
59694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
59695         LDKChannelAnnouncement this_ptr_conv;
59696         this_ptr_conv.inner = untag_ptr(this_ptr);
59697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59699         this_ptr_conv.is_owned = false;
59700         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
59701         int64_t ret_ref = 0;
59702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59704         return ret_ref;
59705 }
59706
59707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59708         LDKChannelAnnouncement this_ptr_conv;
59709         this_ptr_conv.inner = untag_ptr(this_ptr);
59710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59712         this_ptr_conv.is_owned = false;
59713         LDKUnsignedChannelAnnouncement val_conv;
59714         val_conv.inner = untag_ptr(val);
59715         val_conv.is_owned = ptr_is_owned(val);
59716         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59717         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
59718         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
59719 }
59720
59721 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) {
59722         LDKECDSASignature node_signature_1_arg_ref;
59723         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
59724         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
59725         LDKECDSASignature node_signature_2_arg_ref;
59726         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
59727         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
59728         LDKECDSASignature bitcoin_signature_1_arg_ref;
59729         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
59730         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
59731         LDKECDSASignature bitcoin_signature_2_arg_ref;
59732         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
59733         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
59734         LDKUnsignedChannelAnnouncement contents_arg_conv;
59735         contents_arg_conv.inner = untag_ptr(contents_arg);
59736         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
59737         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
59738         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
59739         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);
59740         int64_t ret_ref = 0;
59741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59743         return ret_ref;
59744 }
59745
59746 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
59747         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
59748         int64_t ret_ref = 0;
59749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59751         return ret_ref;
59752 }
59753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59754         LDKChannelAnnouncement arg_conv;
59755         arg_conv.inner = untag_ptr(arg);
59756         arg_conv.is_owned = ptr_is_owned(arg);
59757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59758         arg_conv.is_owned = false;
59759         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
59760         return ret_conv;
59761 }
59762
59763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59764         LDKChannelAnnouncement orig_conv;
59765         orig_conv.inner = untag_ptr(orig);
59766         orig_conv.is_owned = ptr_is_owned(orig);
59767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59768         orig_conv.is_owned = false;
59769         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
59770         int64_t ret_ref = 0;
59771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59773         return ret_ref;
59774 }
59775
59776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
59777         LDKChannelAnnouncement o_conv;
59778         o_conv.inner = untag_ptr(o);
59779         o_conv.is_owned = ptr_is_owned(o);
59780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59781         o_conv.is_owned = false;
59782         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
59783         return ret_conv;
59784 }
59785
59786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59787         LDKChannelAnnouncement a_conv;
59788         a_conv.inner = untag_ptr(a);
59789         a_conv.is_owned = ptr_is_owned(a);
59790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59791         a_conv.is_owned = false;
59792         LDKChannelAnnouncement b_conv;
59793         b_conv.inner = untag_ptr(b);
59794         b_conv.is_owned = ptr_is_owned(b);
59795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59796         b_conv.is_owned = false;
59797         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
59798         return ret_conv;
59799 }
59800
59801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59802         LDKUnsignedChannelUpdate this_obj_conv;
59803         this_obj_conv.inner = untag_ptr(this_obj);
59804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59806         UnsignedChannelUpdate_free(this_obj_conv);
59807 }
59808
59809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59810         LDKUnsignedChannelUpdate this_ptr_conv;
59811         this_ptr_conv.inner = untag_ptr(this_ptr);
59812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59814         this_ptr_conv.is_owned = false;
59815         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59816         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
59817         return ret_arr;
59818 }
59819
59820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59821         LDKUnsignedChannelUpdate this_ptr_conv;
59822         this_ptr_conv.inner = untag_ptr(this_ptr);
59823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59825         this_ptr_conv.is_owned = false;
59826         LDKThirtyTwoBytes val_ref;
59827         CHECK((*env)->GetArrayLength(env, val) == 32);
59828         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59829         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
59830 }
59831
59832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
59833         LDKUnsignedChannelUpdate this_ptr_conv;
59834         this_ptr_conv.inner = untag_ptr(this_ptr);
59835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59837         this_ptr_conv.is_owned = false;
59838         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
59839         return ret_conv;
59840 }
59841
59842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59843         LDKUnsignedChannelUpdate this_ptr_conv;
59844         this_ptr_conv.inner = untag_ptr(this_ptr);
59845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59847         this_ptr_conv.is_owned = false;
59848         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
59849 }
59850
59851 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
59852         LDKUnsignedChannelUpdate this_ptr_conv;
59853         this_ptr_conv.inner = untag_ptr(this_ptr);
59854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59856         this_ptr_conv.is_owned = false;
59857         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
59858         return ret_conv;
59859 }
59860
59861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59862         LDKUnsignedChannelUpdate this_ptr_conv;
59863         this_ptr_conv.inner = untag_ptr(this_ptr);
59864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59866         this_ptr_conv.is_owned = false;
59867         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
59868 }
59869
59870 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
59871         LDKUnsignedChannelUpdate this_ptr_conv;
59872         this_ptr_conv.inner = untag_ptr(this_ptr);
59873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59875         this_ptr_conv.is_owned = false;
59876         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
59877         return ret_conv;
59878 }
59879
59880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
59881         LDKUnsignedChannelUpdate this_ptr_conv;
59882         this_ptr_conv.inner = untag_ptr(this_ptr);
59883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59885         this_ptr_conv.is_owned = false;
59886         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
59887 }
59888
59889 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59890         LDKUnsignedChannelUpdate this_ptr_conv;
59891         this_ptr_conv.inner = untag_ptr(this_ptr);
59892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59894         this_ptr_conv.is_owned = false;
59895         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
59896         return ret_conv;
59897 }
59898
59899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59900         LDKUnsignedChannelUpdate this_ptr_conv;
59901         this_ptr_conv.inner = untag_ptr(this_ptr);
59902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59904         this_ptr_conv.is_owned = false;
59905         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
59906 }
59907
59908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59909         LDKUnsignedChannelUpdate this_ptr_conv;
59910         this_ptr_conv.inner = untag_ptr(this_ptr);
59911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59913         this_ptr_conv.is_owned = false;
59914         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
59915         return ret_conv;
59916 }
59917
59918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59919         LDKUnsignedChannelUpdate this_ptr_conv;
59920         this_ptr_conv.inner = untag_ptr(this_ptr);
59921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59923         this_ptr_conv.is_owned = false;
59924         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
59925 }
59926
59927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59928         LDKUnsignedChannelUpdate this_ptr_conv;
59929         this_ptr_conv.inner = untag_ptr(this_ptr);
59930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59932         this_ptr_conv.is_owned = false;
59933         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
59934         return ret_conv;
59935 }
59936
59937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59938         LDKUnsignedChannelUpdate this_ptr_conv;
59939         this_ptr_conv.inner = untag_ptr(this_ptr);
59940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59942         this_ptr_conv.is_owned = false;
59943         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
59944 }
59945
59946 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59947         LDKUnsignedChannelUpdate this_ptr_conv;
59948         this_ptr_conv.inner = untag_ptr(this_ptr);
59949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59951         this_ptr_conv.is_owned = false;
59952         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
59953         return ret_conv;
59954 }
59955
59956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59957         LDKUnsignedChannelUpdate this_ptr_conv;
59958         this_ptr_conv.inner = untag_ptr(this_ptr);
59959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59961         this_ptr_conv.is_owned = false;
59962         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
59963 }
59964
59965 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59966         LDKUnsignedChannelUpdate this_ptr_conv;
59967         this_ptr_conv.inner = untag_ptr(this_ptr);
59968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59970         this_ptr_conv.is_owned = false;
59971         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
59972         return ret_conv;
59973 }
59974
59975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59976         LDKUnsignedChannelUpdate this_ptr_conv;
59977         this_ptr_conv.inner = untag_ptr(this_ptr);
59978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59980         this_ptr_conv.is_owned = false;
59981         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
59982 }
59983
59984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
59985         LDKUnsignedChannelUpdate this_ptr_conv;
59986         this_ptr_conv.inner = untag_ptr(this_ptr);
59987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59989         this_ptr_conv.is_owned = false;
59990         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
59991         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59992         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59993         CVec_u8Z_free(ret_var);
59994         return ret_arr;
59995 }
59996
59997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59998         LDKUnsignedChannelUpdate this_ptr_conv;
59999         this_ptr_conv.inner = untag_ptr(this_ptr);
60000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60002         this_ptr_conv.is_owned = false;
60003         LDKCVec_u8Z val_ref;
60004         val_ref.datalen = (*env)->GetArrayLength(env, val);
60005         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
60006         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
60007         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
60008 }
60009
60010 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) {
60011         LDKThirtyTwoBytes chain_hash_arg_ref;
60012         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
60013         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
60014         LDKCVec_u8Z excess_data_arg_ref;
60015         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
60016         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
60017         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
60018         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);
60019         int64_t ret_ref = 0;
60020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60022         return ret_ref;
60023 }
60024
60025 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
60026         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
60027         int64_t ret_ref = 0;
60028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60030         return ret_ref;
60031 }
60032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60033         LDKUnsignedChannelUpdate arg_conv;
60034         arg_conv.inner = untag_ptr(arg);
60035         arg_conv.is_owned = ptr_is_owned(arg);
60036         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60037         arg_conv.is_owned = false;
60038         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
60039         return ret_conv;
60040 }
60041
60042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60043         LDKUnsignedChannelUpdate orig_conv;
60044         orig_conv.inner = untag_ptr(orig);
60045         orig_conv.is_owned = ptr_is_owned(orig);
60046         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60047         orig_conv.is_owned = false;
60048         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
60049         int64_t ret_ref = 0;
60050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60052         return ret_ref;
60053 }
60054
60055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
60056         LDKUnsignedChannelUpdate o_conv;
60057         o_conv.inner = untag_ptr(o);
60058         o_conv.is_owned = ptr_is_owned(o);
60059         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60060         o_conv.is_owned = false;
60061         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
60062         return ret_conv;
60063 }
60064
60065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60066         LDKUnsignedChannelUpdate a_conv;
60067         a_conv.inner = untag_ptr(a);
60068         a_conv.is_owned = ptr_is_owned(a);
60069         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60070         a_conv.is_owned = false;
60071         LDKUnsignedChannelUpdate b_conv;
60072         b_conv.inner = untag_ptr(b);
60073         b_conv.is_owned = ptr_is_owned(b);
60074         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60075         b_conv.is_owned = false;
60076         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
60077         return ret_conv;
60078 }
60079
60080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60081         LDKChannelUpdate this_obj_conv;
60082         this_obj_conv.inner = untag_ptr(this_obj);
60083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60085         ChannelUpdate_free(this_obj_conv);
60086 }
60087
60088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
60089         LDKChannelUpdate this_ptr_conv;
60090         this_ptr_conv.inner = untag_ptr(this_ptr);
60091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60093         this_ptr_conv.is_owned = false;
60094         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60095         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
60096         return ret_arr;
60097 }
60098
60099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60100         LDKChannelUpdate this_ptr_conv;
60101         this_ptr_conv.inner = untag_ptr(this_ptr);
60102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60104         this_ptr_conv.is_owned = false;
60105         LDKECDSASignature val_ref;
60106         CHECK((*env)->GetArrayLength(env, val) == 64);
60107         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
60108         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
60109 }
60110
60111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
60112         LDKChannelUpdate this_ptr_conv;
60113         this_ptr_conv.inner = untag_ptr(this_ptr);
60114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60116         this_ptr_conv.is_owned = false;
60117         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
60118         int64_t ret_ref = 0;
60119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60121         return ret_ref;
60122 }
60123
60124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60125         LDKChannelUpdate this_ptr_conv;
60126         this_ptr_conv.inner = untag_ptr(this_ptr);
60127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60129         this_ptr_conv.is_owned = false;
60130         LDKUnsignedChannelUpdate val_conv;
60131         val_conv.inner = untag_ptr(val);
60132         val_conv.is_owned = ptr_is_owned(val);
60133         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60134         val_conv = UnsignedChannelUpdate_clone(&val_conv);
60135         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
60136 }
60137
60138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
60139         LDKECDSASignature signature_arg_ref;
60140         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
60141         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
60142         LDKUnsignedChannelUpdate contents_arg_conv;
60143         contents_arg_conv.inner = untag_ptr(contents_arg);
60144         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
60145         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
60146         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
60147         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
60148         int64_t ret_ref = 0;
60149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60151         return ret_ref;
60152 }
60153
60154 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
60155         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
60156         int64_t ret_ref = 0;
60157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60159         return ret_ref;
60160 }
60161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60162         LDKChannelUpdate arg_conv;
60163         arg_conv.inner = untag_ptr(arg);
60164         arg_conv.is_owned = ptr_is_owned(arg);
60165         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60166         arg_conv.is_owned = false;
60167         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
60168         return ret_conv;
60169 }
60170
60171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60172         LDKChannelUpdate orig_conv;
60173         orig_conv.inner = untag_ptr(orig);
60174         orig_conv.is_owned = ptr_is_owned(orig);
60175         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60176         orig_conv.is_owned = false;
60177         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
60178         int64_t ret_ref = 0;
60179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60181         return ret_ref;
60182 }
60183
60184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
60185         LDKChannelUpdate o_conv;
60186         o_conv.inner = untag_ptr(o);
60187         o_conv.is_owned = ptr_is_owned(o);
60188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60189         o_conv.is_owned = false;
60190         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
60191         return ret_conv;
60192 }
60193
60194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60195         LDKChannelUpdate a_conv;
60196         a_conv.inner = untag_ptr(a);
60197         a_conv.is_owned = ptr_is_owned(a);
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60199         a_conv.is_owned = false;
60200         LDKChannelUpdate b_conv;
60201         b_conv.inner = untag_ptr(b);
60202         b_conv.is_owned = ptr_is_owned(b);
60203         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60204         b_conv.is_owned = false;
60205         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
60206         return ret_conv;
60207 }
60208
60209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60210         LDKQueryChannelRange this_obj_conv;
60211         this_obj_conv.inner = untag_ptr(this_obj);
60212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60214         QueryChannelRange_free(this_obj_conv);
60215 }
60216
60217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
60218         LDKQueryChannelRange this_ptr_conv;
60219         this_ptr_conv.inner = untag_ptr(this_ptr);
60220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60222         this_ptr_conv.is_owned = false;
60223         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
60225         return ret_arr;
60226 }
60227
60228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60229         LDKQueryChannelRange this_ptr_conv;
60230         this_ptr_conv.inner = untag_ptr(this_ptr);
60231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60233         this_ptr_conv.is_owned = false;
60234         LDKThirtyTwoBytes val_ref;
60235         CHECK((*env)->GetArrayLength(env, val) == 32);
60236         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60237         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
60238 }
60239
60240 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
60241         LDKQueryChannelRange this_ptr_conv;
60242         this_ptr_conv.inner = untag_ptr(this_ptr);
60243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60245         this_ptr_conv.is_owned = false;
60246         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
60247         return ret_conv;
60248 }
60249
60250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60251         LDKQueryChannelRange this_ptr_conv;
60252         this_ptr_conv.inner = untag_ptr(this_ptr);
60253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60255         this_ptr_conv.is_owned = false;
60256         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
60257 }
60258
60259 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
60260         LDKQueryChannelRange this_ptr_conv;
60261         this_ptr_conv.inner = untag_ptr(this_ptr);
60262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60264         this_ptr_conv.is_owned = false;
60265         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
60266         return ret_conv;
60267 }
60268
60269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60270         LDKQueryChannelRange this_ptr_conv;
60271         this_ptr_conv.inner = untag_ptr(this_ptr);
60272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60274         this_ptr_conv.is_owned = false;
60275         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
60276 }
60277
60278 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) {
60279         LDKThirtyTwoBytes chain_hash_arg_ref;
60280         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
60281         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
60282         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
60283         int64_t ret_ref = 0;
60284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60286         return ret_ref;
60287 }
60288
60289 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
60290         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
60291         int64_t ret_ref = 0;
60292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60294         return ret_ref;
60295 }
60296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60297         LDKQueryChannelRange arg_conv;
60298         arg_conv.inner = untag_ptr(arg);
60299         arg_conv.is_owned = ptr_is_owned(arg);
60300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60301         arg_conv.is_owned = false;
60302         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
60303         return ret_conv;
60304 }
60305
60306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60307         LDKQueryChannelRange orig_conv;
60308         orig_conv.inner = untag_ptr(orig);
60309         orig_conv.is_owned = ptr_is_owned(orig);
60310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60311         orig_conv.is_owned = false;
60312         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
60313         int64_t ret_ref = 0;
60314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60316         return ret_ref;
60317 }
60318
60319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
60320         LDKQueryChannelRange o_conv;
60321         o_conv.inner = untag_ptr(o);
60322         o_conv.is_owned = ptr_is_owned(o);
60323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60324         o_conv.is_owned = false;
60325         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
60326         return ret_conv;
60327 }
60328
60329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60330         LDKQueryChannelRange a_conv;
60331         a_conv.inner = untag_ptr(a);
60332         a_conv.is_owned = ptr_is_owned(a);
60333         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60334         a_conv.is_owned = false;
60335         LDKQueryChannelRange b_conv;
60336         b_conv.inner = untag_ptr(b);
60337         b_conv.is_owned = ptr_is_owned(b);
60338         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60339         b_conv.is_owned = false;
60340         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
60341         return ret_conv;
60342 }
60343
60344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60345         LDKReplyChannelRange this_obj_conv;
60346         this_obj_conv.inner = untag_ptr(this_obj);
60347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60349         ReplyChannelRange_free(this_obj_conv);
60350 }
60351
60352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
60353         LDKReplyChannelRange this_ptr_conv;
60354         this_ptr_conv.inner = untag_ptr(this_ptr);
60355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60357         this_ptr_conv.is_owned = false;
60358         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60359         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
60360         return ret_arr;
60361 }
60362
60363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60364         LDKReplyChannelRange this_ptr_conv;
60365         this_ptr_conv.inner = untag_ptr(this_ptr);
60366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60368         this_ptr_conv.is_owned = false;
60369         LDKThirtyTwoBytes val_ref;
60370         CHECK((*env)->GetArrayLength(env, val) == 32);
60371         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60372         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
60373 }
60374
60375 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
60376         LDKReplyChannelRange this_ptr_conv;
60377         this_ptr_conv.inner = untag_ptr(this_ptr);
60378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60380         this_ptr_conv.is_owned = false;
60381         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
60382         return ret_conv;
60383 }
60384
60385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60386         LDKReplyChannelRange this_ptr_conv;
60387         this_ptr_conv.inner = untag_ptr(this_ptr);
60388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60390         this_ptr_conv.is_owned = false;
60391         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
60392 }
60393
60394 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
60395         LDKReplyChannelRange this_ptr_conv;
60396         this_ptr_conv.inner = untag_ptr(this_ptr);
60397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60399         this_ptr_conv.is_owned = false;
60400         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
60401         return ret_conv;
60402 }
60403
60404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60405         LDKReplyChannelRange this_ptr_conv;
60406         this_ptr_conv.inner = untag_ptr(this_ptr);
60407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60409         this_ptr_conv.is_owned = false;
60410         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
60411 }
60412
60413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
60414         LDKReplyChannelRange this_ptr_conv;
60415         this_ptr_conv.inner = untag_ptr(this_ptr);
60416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60418         this_ptr_conv.is_owned = false;
60419         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
60420         return ret_conv;
60421 }
60422
60423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
60424         LDKReplyChannelRange this_ptr_conv;
60425         this_ptr_conv.inner = untag_ptr(this_ptr);
60426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60428         this_ptr_conv.is_owned = false;
60429         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
60430 }
60431
60432 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
60433         LDKReplyChannelRange this_ptr_conv;
60434         this_ptr_conv.inner = untag_ptr(this_ptr);
60435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60437         this_ptr_conv.is_owned = false;
60438         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
60439         int64_tArray ret_arr = NULL;
60440         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60441         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60442         for (size_t g = 0; g < ret_var.datalen; g++) {
60443                 int64_t ret_conv_6_conv = ret_var.data[g];
60444                 ret_arr_ptr[g] = ret_conv_6_conv;
60445         }
60446         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60447         FREE(ret_var.data);
60448         return ret_arr;
60449 }
60450
60451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60452         LDKReplyChannelRange this_ptr_conv;
60453         this_ptr_conv.inner = untag_ptr(this_ptr);
60454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60456         this_ptr_conv.is_owned = false;
60457         LDKCVec_u64Z val_constr;
60458         val_constr.datalen = (*env)->GetArrayLength(env, val);
60459         if (val_constr.datalen > 0)
60460                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60461         else
60462                 val_constr.data = NULL;
60463         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60464         for (size_t g = 0; g < val_constr.datalen; g++) {
60465                 int64_t val_conv_6 = val_vals[g];
60466                 val_constr.data[g] = val_conv_6;
60467         }
60468         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60469         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
60470 }
60471
60472 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) {
60473         LDKThirtyTwoBytes chain_hash_arg_ref;
60474         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
60475         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
60476         LDKCVec_u64Z short_channel_ids_arg_constr;
60477         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
60478         if (short_channel_ids_arg_constr.datalen > 0)
60479                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60480         else
60481                 short_channel_ids_arg_constr.data = NULL;
60482         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
60483         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
60484                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
60485                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
60486         }
60487         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
60488         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
60489         int64_t ret_ref = 0;
60490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60492         return ret_ref;
60493 }
60494
60495 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
60496         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
60497         int64_t ret_ref = 0;
60498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60500         return ret_ref;
60501 }
60502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60503         LDKReplyChannelRange arg_conv;
60504         arg_conv.inner = untag_ptr(arg);
60505         arg_conv.is_owned = ptr_is_owned(arg);
60506         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60507         arg_conv.is_owned = false;
60508         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
60509         return ret_conv;
60510 }
60511
60512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60513         LDKReplyChannelRange orig_conv;
60514         orig_conv.inner = untag_ptr(orig);
60515         orig_conv.is_owned = ptr_is_owned(orig);
60516         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60517         orig_conv.is_owned = false;
60518         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
60519         int64_t ret_ref = 0;
60520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60522         return ret_ref;
60523 }
60524
60525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
60526         LDKReplyChannelRange o_conv;
60527         o_conv.inner = untag_ptr(o);
60528         o_conv.is_owned = ptr_is_owned(o);
60529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60530         o_conv.is_owned = false;
60531         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
60532         return ret_conv;
60533 }
60534
60535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60536         LDKReplyChannelRange a_conv;
60537         a_conv.inner = untag_ptr(a);
60538         a_conv.is_owned = ptr_is_owned(a);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60540         a_conv.is_owned = false;
60541         LDKReplyChannelRange b_conv;
60542         b_conv.inner = untag_ptr(b);
60543         b_conv.is_owned = ptr_is_owned(b);
60544         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60545         b_conv.is_owned = false;
60546         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
60547         return ret_conv;
60548 }
60549
60550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60551         LDKQueryShortChannelIds this_obj_conv;
60552         this_obj_conv.inner = untag_ptr(this_obj);
60553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60555         QueryShortChannelIds_free(this_obj_conv);
60556 }
60557
60558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
60559         LDKQueryShortChannelIds this_ptr_conv;
60560         this_ptr_conv.inner = untag_ptr(this_ptr);
60561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60563         this_ptr_conv.is_owned = false;
60564         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60565         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
60566         return ret_arr;
60567 }
60568
60569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60570         LDKQueryShortChannelIds this_ptr_conv;
60571         this_ptr_conv.inner = untag_ptr(this_ptr);
60572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60574         this_ptr_conv.is_owned = false;
60575         LDKThirtyTwoBytes val_ref;
60576         CHECK((*env)->GetArrayLength(env, val) == 32);
60577         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60578         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
60579 }
60580
60581 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
60582         LDKQueryShortChannelIds this_ptr_conv;
60583         this_ptr_conv.inner = untag_ptr(this_ptr);
60584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60586         this_ptr_conv.is_owned = false;
60587         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
60588         int64_tArray ret_arr = NULL;
60589         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60590         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60591         for (size_t g = 0; g < ret_var.datalen; g++) {
60592                 int64_t ret_conv_6_conv = ret_var.data[g];
60593                 ret_arr_ptr[g] = ret_conv_6_conv;
60594         }
60595         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60596         FREE(ret_var.data);
60597         return ret_arr;
60598 }
60599
60600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60601         LDKQueryShortChannelIds this_ptr_conv;
60602         this_ptr_conv.inner = untag_ptr(this_ptr);
60603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60605         this_ptr_conv.is_owned = false;
60606         LDKCVec_u64Z val_constr;
60607         val_constr.datalen = (*env)->GetArrayLength(env, val);
60608         if (val_constr.datalen > 0)
60609                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60610         else
60611                 val_constr.data = NULL;
60612         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60613         for (size_t g = 0; g < val_constr.datalen; g++) {
60614                 int64_t val_conv_6 = val_vals[g];
60615                 val_constr.data[g] = val_conv_6;
60616         }
60617         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60618         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
60619 }
60620
60621 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) {
60622         LDKThirtyTwoBytes chain_hash_arg_ref;
60623         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
60624         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
60625         LDKCVec_u64Z short_channel_ids_arg_constr;
60626         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
60627         if (short_channel_ids_arg_constr.datalen > 0)
60628                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60629         else
60630                 short_channel_ids_arg_constr.data = NULL;
60631         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
60632         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
60633                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
60634                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
60635         }
60636         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
60637         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
60638         int64_t ret_ref = 0;
60639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60641         return ret_ref;
60642 }
60643
60644 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
60645         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
60646         int64_t ret_ref = 0;
60647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60649         return ret_ref;
60650 }
60651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60652         LDKQueryShortChannelIds arg_conv;
60653         arg_conv.inner = untag_ptr(arg);
60654         arg_conv.is_owned = ptr_is_owned(arg);
60655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60656         arg_conv.is_owned = false;
60657         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
60658         return ret_conv;
60659 }
60660
60661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60662         LDKQueryShortChannelIds orig_conv;
60663         orig_conv.inner = untag_ptr(orig);
60664         orig_conv.is_owned = ptr_is_owned(orig);
60665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60666         orig_conv.is_owned = false;
60667         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
60668         int64_t ret_ref = 0;
60669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60671         return ret_ref;
60672 }
60673
60674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1hash(JNIEnv *env, jclass clz, int64_t o) {
60675         LDKQueryShortChannelIds o_conv;
60676         o_conv.inner = untag_ptr(o);
60677         o_conv.is_owned = ptr_is_owned(o);
60678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60679         o_conv.is_owned = false;
60680         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
60681         return ret_conv;
60682 }
60683
60684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60685         LDKQueryShortChannelIds a_conv;
60686         a_conv.inner = untag_ptr(a);
60687         a_conv.is_owned = ptr_is_owned(a);
60688         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60689         a_conv.is_owned = false;
60690         LDKQueryShortChannelIds b_conv;
60691         b_conv.inner = untag_ptr(b);
60692         b_conv.is_owned = ptr_is_owned(b);
60693         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60694         b_conv.is_owned = false;
60695         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
60696         return ret_conv;
60697 }
60698
60699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60700         LDKReplyShortChannelIdsEnd this_obj_conv;
60701         this_obj_conv.inner = untag_ptr(this_obj);
60702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60704         ReplyShortChannelIdsEnd_free(this_obj_conv);
60705 }
60706
60707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
60708         LDKReplyShortChannelIdsEnd this_ptr_conv;
60709         this_ptr_conv.inner = untag_ptr(this_ptr);
60710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60712         this_ptr_conv.is_owned = false;
60713         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60714         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
60715         return ret_arr;
60716 }
60717
60718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60719         LDKReplyShortChannelIdsEnd this_ptr_conv;
60720         this_ptr_conv.inner = untag_ptr(this_ptr);
60721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60723         this_ptr_conv.is_owned = false;
60724         LDKThirtyTwoBytes val_ref;
60725         CHECK((*env)->GetArrayLength(env, val) == 32);
60726         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60727         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
60728 }
60729
60730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
60731         LDKReplyShortChannelIdsEnd this_ptr_conv;
60732         this_ptr_conv.inner = untag_ptr(this_ptr);
60733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60735         this_ptr_conv.is_owned = false;
60736         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
60737         return ret_conv;
60738 }
60739
60740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
60741         LDKReplyShortChannelIdsEnd this_ptr_conv;
60742         this_ptr_conv.inner = untag_ptr(this_ptr);
60743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60745         this_ptr_conv.is_owned = false;
60746         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
60747 }
60748
60749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
60750         LDKThirtyTwoBytes chain_hash_arg_ref;
60751         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
60752         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
60753         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
60754         int64_t ret_ref = 0;
60755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60757         return ret_ref;
60758 }
60759
60760 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
60761         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
60762         int64_t ret_ref = 0;
60763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60765         return ret_ref;
60766 }
60767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60768         LDKReplyShortChannelIdsEnd arg_conv;
60769         arg_conv.inner = untag_ptr(arg);
60770         arg_conv.is_owned = ptr_is_owned(arg);
60771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60772         arg_conv.is_owned = false;
60773         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
60774         return ret_conv;
60775 }
60776
60777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60778         LDKReplyShortChannelIdsEnd orig_conv;
60779         orig_conv.inner = untag_ptr(orig);
60780         orig_conv.is_owned = ptr_is_owned(orig);
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60782         orig_conv.is_owned = false;
60783         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_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_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1hash(JNIEnv *env, jclass clz, int64_t o) {
60791         LDKReplyShortChannelIdsEnd o_conv;
60792         o_conv.inner = untag_ptr(o);
60793         o_conv.is_owned = ptr_is_owned(o);
60794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60795         o_conv.is_owned = false;
60796         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
60797         return ret_conv;
60798 }
60799
60800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60801         LDKReplyShortChannelIdsEnd a_conv;
60802         a_conv.inner = untag_ptr(a);
60803         a_conv.is_owned = ptr_is_owned(a);
60804         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60805         a_conv.is_owned = false;
60806         LDKReplyShortChannelIdsEnd b_conv;
60807         b_conv.inner = untag_ptr(b);
60808         b_conv.is_owned = ptr_is_owned(b);
60809         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60810         b_conv.is_owned = false;
60811         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
60812         return ret_conv;
60813 }
60814
60815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60816         LDKGossipTimestampFilter this_obj_conv;
60817         this_obj_conv.inner = untag_ptr(this_obj);
60818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60820         GossipTimestampFilter_free(this_obj_conv);
60821 }
60822
60823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
60824         LDKGossipTimestampFilter this_ptr_conv;
60825         this_ptr_conv.inner = untag_ptr(this_ptr);
60826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60828         this_ptr_conv.is_owned = false;
60829         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60830         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
60831         return ret_arr;
60832 }
60833
60834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60835         LDKGossipTimestampFilter this_ptr_conv;
60836         this_ptr_conv.inner = untag_ptr(this_ptr);
60837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60839         this_ptr_conv.is_owned = false;
60840         LDKThirtyTwoBytes val_ref;
60841         CHECK((*env)->GetArrayLength(env, val) == 32);
60842         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60843         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
60844 }
60845
60846 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
60847         LDKGossipTimestampFilter this_ptr_conv;
60848         this_ptr_conv.inner = untag_ptr(this_ptr);
60849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60851         this_ptr_conv.is_owned = false;
60852         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
60853         return ret_conv;
60854 }
60855
60856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60857         LDKGossipTimestampFilter this_ptr_conv;
60858         this_ptr_conv.inner = untag_ptr(this_ptr);
60859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60861         this_ptr_conv.is_owned = false;
60862         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
60863 }
60864
60865 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
60866         LDKGossipTimestampFilter this_ptr_conv;
60867         this_ptr_conv.inner = untag_ptr(this_ptr);
60868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60870         this_ptr_conv.is_owned = false;
60871         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
60872         return ret_conv;
60873 }
60874
60875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60876         LDKGossipTimestampFilter this_ptr_conv;
60877         this_ptr_conv.inner = untag_ptr(this_ptr);
60878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60880         this_ptr_conv.is_owned = false;
60881         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
60882 }
60883
60884 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) {
60885         LDKThirtyTwoBytes chain_hash_arg_ref;
60886         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
60887         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
60888         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
60889         int64_t ret_ref = 0;
60890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60892         return ret_ref;
60893 }
60894
60895 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
60896         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
60897         int64_t ret_ref = 0;
60898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60900         return ret_ref;
60901 }
60902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60903         LDKGossipTimestampFilter arg_conv;
60904         arg_conv.inner = untag_ptr(arg);
60905         arg_conv.is_owned = ptr_is_owned(arg);
60906         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60907         arg_conv.is_owned = false;
60908         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
60909         return ret_conv;
60910 }
60911
60912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60913         LDKGossipTimestampFilter orig_conv;
60914         orig_conv.inner = untag_ptr(orig);
60915         orig_conv.is_owned = ptr_is_owned(orig);
60916         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60917         orig_conv.is_owned = false;
60918         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
60919         int64_t ret_ref = 0;
60920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60922         return ret_ref;
60923 }
60924
60925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1hash(JNIEnv *env, jclass clz, int64_t o) {
60926         LDKGossipTimestampFilter o_conv;
60927         o_conv.inner = untag_ptr(o);
60928         o_conv.is_owned = ptr_is_owned(o);
60929         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60930         o_conv.is_owned = false;
60931         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
60932         return ret_conv;
60933 }
60934
60935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60936         LDKGossipTimestampFilter a_conv;
60937         a_conv.inner = untag_ptr(a);
60938         a_conv.is_owned = ptr_is_owned(a);
60939         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60940         a_conv.is_owned = false;
60941         LDKGossipTimestampFilter b_conv;
60942         b_conv.inner = untag_ptr(b);
60943         b_conv.is_owned = ptr_is_owned(b);
60944         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60945         b_conv.is_owned = false;
60946         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
60947         return ret_conv;
60948 }
60949
60950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60951         if (!ptr_is_owned(this_ptr)) return;
60952         void* this_ptr_ptr = untag_ptr(this_ptr);
60953         CHECK_ACCESS(this_ptr_ptr);
60954         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
60955         FREE(untag_ptr(this_ptr));
60956         ErrorAction_free(this_ptr_conv);
60957 }
60958
60959 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
60960         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
60961         *ret_copy = ErrorAction_clone(arg);
60962         int64_t ret_ref = tag_ptr(ret_copy, true);
60963         return ret_ref;
60964 }
60965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60966         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
60967         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
60968         return ret_conv;
60969 }
60970
60971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60972         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
60973         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
60974         *ret_copy = ErrorAction_clone(orig_conv);
60975         int64_t ret_ref = tag_ptr(ret_copy, true);
60976         return ret_ref;
60977 }
60978
60979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
60980         LDKErrorMessage msg_conv;
60981         msg_conv.inner = untag_ptr(msg);
60982         msg_conv.is_owned = ptr_is_owned(msg);
60983         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60984         msg_conv = ErrorMessage_clone(&msg_conv);
60985         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
60986         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
60987         int64_t ret_ref = tag_ptr(ret_copy, true);
60988         return ret_ref;
60989 }
60990
60991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
60992         LDKWarningMessage msg_conv;
60993         msg_conv.inner = untag_ptr(msg);
60994         msg_conv.is_owned = ptr_is_owned(msg);
60995         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60996         msg_conv = WarningMessage_clone(&msg_conv);
60997         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
60998         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
60999         int64_t ret_ref = tag_ptr(ret_copy, true);
61000         return ret_ref;
61001 }
61002
61003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
61004         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
61005         *ret_copy = ErrorAction_ignore_error();
61006         int64_t ret_ref = tag_ptr(ret_copy, true);
61007         return ret_ref;
61008 }
61009
61010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
61011         LDKLevel a_conv = LDKLevel_from_java(env, a);
61012         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
61013         *ret_copy = ErrorAction_ignore_and_log(a_conv);
61014         int64_t ret_ref = tag_ptr(ret_copy, true);
61015         return ret_ref;
61016 }
61017
61018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
61019         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
61020         *ret_copy = ErrorAction_ignore_duplicate_gossip();
61021         int64_t ret_ref = tag_ptr(ret_copy, true);
61022         return ret_ref;
61023 }
61024
61025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
61026         LDKErrorMessage msg_conv;
61027         msg_conv.inner = untag_ptr(msg);
61028         msg_conv.is_owned = ptr_is_owned(msg);
61029         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61030         msg_conv = ErrorMessage_clone(&msg_conv);
61031         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
61032         *ret_copy = ErrorAction_send_error_message(msg_conv);
61033         int64_t ret_ref = tag_ptr(ret_copy, true);
61034         return ret_ref;
61035 }
61036
61037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
61038         LDKWarningMessage msg_conv;
61039         msg_conv.inner = untag_ptr(msg);
61040         msg_conv.is_owned = ptr_is_owned(msg);
61041         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61042         msg_conv = WarningMessage_clone(&msg_conv);
61043         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
61044         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
61045         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
61046         int64_t ret_ref = tag_ptr(ret_copy, true);
61047         return ret_ref;
61048 }
61049
61050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1hash(JNIEnv *env, jclass clz, int64_t o) {
61051         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
61052         int64_t ret_conv = ErrorAction_hash(o_conv);
61053         return ret_conv;
61054 }
61055
61056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61057         LDKLightningError this_obj_conv;
61058         this_obj_conv.inner = untag_ptr(this_obj);
61059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61061         LightningError_free(this_obj_conv);
61062 }
61063
61064 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
61065         LDKLightningError this_ptr_conv;
61066         this_ptr_conv.inner = untag_ptr(this_ptr);
61067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61069         this_ptr_conv.is_owned = false;
61070         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
61071         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
61072         Str_free(ret_str);
61073         return ret_conv;
61074 }
61075
61076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
61077         LDKLightningError this_ptr_conv;
61078         this_ptr_conv.inner = untag_ptr(this_ptr);
61079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61081         this_ptr_conv.is_owned = false;
61082         LDKStr val_conv = java_to_owned_str(env, val);
61083         LightningError_set_err(&this_ptr_conv, val_conv);
61084 }
61085
61086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
61087         LDKLightningError this_ptr_conv;
61088         this_ptr_conv.inner = untag_ptr(this_ptr);
61089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61091         this_ptr_conv.is_owned = false;
61092         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
61093         *ret_copy = LightningError_get_action(&this_ptr_conv);
61094         int64_t ret_ref = tag_ptr(ret_copy, true);
61095         return ret_ref;
61096 }
61097
61098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61099         LDKLightningError this_ptr_conv;
61100         this_ptr_conv.inner = untag_ptr(this_ptr);
61101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61103         this_ptr_conv.is_owned = false;
61104         void* val_ptr = untag_ptr(val);
61105         CHECK_ACCESS(val_ptr);
61106         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
61107         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
61108         LightningError_set_action(&this_ptr_conv, val_conv);
61109 }
61110
61111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
61112         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
61113         void* action_arg_ptr = untag_ptr(action_arg);
61114         CHECK_ACCESS(action_arg_ptr);
61115         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
61116         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
61117         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
61118         int64_t ret_ref = 0;
61119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61121         return ret_ref;
61122 }
61123
61124 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
61125         LDKLightningError ret_var = LightningError_clone(arg);
61126         int64_t ret_ref = 0;
61127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61129         return ret_ref;
61130 }
61131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61132         LDKLightningError arg_conv;
61133         arg_conv.inner = untag_ptr(arg);
61134         arg_conv.is_owned = ptr_is_owned(arg);
61135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61136         arg_conv.is_owned = false;
61137         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
61138         return ret_conv;
61139 }
61140
61141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61142         LDKLightningError orig_conv;
61143         orig_conv.inner = untag_ptr(orig);
61144         orig_conv.is_owned = ptr_is_owned(orig);
61145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61146         orig_conv.is_owned = false;
61147         LDKLightningError ret_var = LightningError_clone(&orig_conv);
61148         int64_t ret_ref = 0;
61149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61151         return ret_ref;
61152 }
61153
61154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61155         LDKCommitmentUpdate this_obj_conv;
61156         this_obj_conv.inner = untag_ptr(this_obj);
61157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61159         CommitmentUpdate_free(this_obj_conv);
61160 }
61161
61162 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
61163         LDKCommitmentUpdate this_ptr_conv;
61164         this_ptr_conv.inner = untag_ptr(this_ptr);
61165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61167         this_ptr_conv.is_owned = false;
61168         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
61169         int64_tArray ret_arr = NULL;
61170         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61171         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61172         for (size_t p = 0; p < ret_var.datalen; p++) {
61173                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
61174                 int64_t ret_conv_15_ref = 0;
61175                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
61176                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
61177                 ret_arr_ptr[p] = ret_conv_15_ref;
61178         }
61179         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61180         FREE(ret_var.data);
61181         return ret_arr;
61182 }
61183
61184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
61185         LDKCommitmentUpdate this_ptr_conv;
61186         this_ptr_conv.inner = untag_ptr(this_ptr);
61187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61189         this_ptr_conv.is_owned = false;
61190         LDKCVec_UpdateAddHTLCZ val_constr;
61191         val_constr.datalen = (*env)->GetArrayLength(env, val);
61192         if (val_constr.datalen > 0)
61193                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
61194         else
61195                 val_constr.data = NULL;
61196         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
61197         for (size_t p = 0; p < val_constr.datalen; p++) {
61198                 int64_t val_conv_15 = val_vals[p];
61199                 LDKUpdateAddHTLC val_conv_15_conv;
61200                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
61201                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
61202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
61203                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
61204                 val_constr.data[p] = val_conv_15_conv;
61205         }
61206         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
61207         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
61208 }
61209
61210 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
61211         LDKCommitmentUpdate this_ptr_conv;
61212         this_ptr_conv.inner = untag_ptr(this_ptr);
61213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61215         this_ptr_conv.is_owned = false;
61216         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
61217         int64_tArray ret_arr = NULL;
61218         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61219         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61220         for (size_t t = 0; t < ret_var.datalen; t++) {
61221                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
61222                 int64_t ret_conv_19_ref = 0;
61223                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
61224                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
61225                 ret_arr_ptr[t] = ret_conv_19_ref;
61226         }
61227         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61228         FREE(ret_var.data);
61229         return ret_arr;
61230 }
61231
61232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
61233         LDKCommitmentUpdate this_ptr_conv;
61234         this_ptr_conv.inner = untag_ptr(this_ptr);
61235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61237         this_ptr_conv.is_owned = false;
61238         LDKCVec_UpdateFulfillHTLCZ val_constr;
61239         val_constr.datalen = (*env)->GetArrayLength(env, val);
61240         if (val_constr.datalen > 0)
61241                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
61242         else
61243                 val_constr.data = NULL;
61244         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
61245         for (size_t t = 0; t < val_constr.datalen; t++) {
61246                 int64_t val_conv_19 = val_vals[t];
61247                 LDKUpdateFulfillHTLC val_conv_19_conv;
61248                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
61249                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
61250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
61251                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
61252                 val_constr.data[t] = val_conv_19_conv;
61253         }
61254         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
61255         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
61256 }
61257
61258 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
61259         LDKCommitmentUpdate this_ptr_conv;
61260         this_ptr_conv.inner = untag_ptr(this_ptr);
61261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61263         this_ptr_conv.is_owned = false;
61264         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
61265         int64_tArray ret_arr = NULL;
61266         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61267         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61268         for (size_t q = 0; q < ret_var.datalen; q++) {
61269                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
61270                 int64_t ret_conv_16_ref = 0;
61271                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
61272                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
61273                 ret_arr_ptr[q] = ret_conv_16_ref;
61274         }
61275         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61276         FREE(ret_var.data);
61277         return ret_arr;
61278 }
61279
61280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
61281         LDKCommitmentUpdate this_ptr_conv;
61282         this_ptr_conv.inner = untag_ptr(this_ptr);
61283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61285         this_ptr_conv.is_owned = false;
61286         LDKCVec_UpdateFailHTLCZ val_constr;
61287         val_constr.datalen = (*env)->GetArrayLength(env, val);
61288         if (val_constr.datalen > 0)
61289                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
61290         else
61291                 val_constr.data = NULL;
61292         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
61293         for (size_t q = 0; q < val_constr.datalen; q++) {
61294                 int64_t val_conv_16 = val_vals[q];
61295                 LDKUpdateFailHTLC val_conv_16_conv;
61296                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
61297                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
61298                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
61299                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
61300                 val_constr.data[q] = val_conv_16_conv;
61301         }
61302         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
61303         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
61304 }
61305
61306 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
61307         LDKCommitmentUpdate this_ptr_conv;
61308         this_ptr_conv.inner = untag_ptr(this_ptr);
61309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61311         this_ptr_conv.is_owned = false;
61312         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
61313         int64_tArray ret_arr = NULL;
61314         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61315         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61316         for (size_t z = 0; z < ret_var.datalen; z++) {
61317                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
61318                 int64_t ret_conv_25_ref = 0;
61319                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
61320                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
61321                 ret_arr_ptr[z] = ret_conv_25_ref;
61322         }
61323         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61324         FREE(ret_var.data);
61325         return ret_arr;
61326 }
61327
61328 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) {
61329         LDKCommitmentUpdate this_ptr_conv;
61330         this_ptr_conv.inner = untag_ptr(this_ptr);
61331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61333         this_ptr_conv.is_owned = false;
61334         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
61335         val_constr.datalen = (*env)->GetArrayLength(env, val);
61336         if (val_constr.datalen > 0)
61337                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
61338         else
61339                 val_constr.data = NULL;
61340         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
61341         for (size_t z = 0; z < val_constr.datalen; z++) {
61342                 int64_t val_conv_25 = val_vals[z];
61343                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
61344                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
61345                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
61346                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
61347                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
61348                 val_constr.data[z] = val_conv_25_conv;
61349         }
61350         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
61351         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
61352 }
61353
61354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
61355         LDKCommitmentUpdate this_ptr_conv;
61356         this_ptr_conv.inner = untag_ptr(this_ptr);
61357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61359         this_ptr_conv.is_owned = false;
61360         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
61361         int64_t ret_ref = 0;
61362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61364         return ret_ref;
61365 }
61366
61367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61368         LDKCommitmentUpdate this_ptr_conv;
61369         this_ptr_conv.inner = untag_ptr(this_ptr);
61370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61372         this_ptr_conv.is_owned = false;
61373         LDKUpdateFee val_conv;
61374         val_conv.inner = untag_ptr(val);
61375         val_conv.is_owned = ptr_is_owned(val);
61376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61377         val_conv = UpdateFee_clone(&val_conv);
61378         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
61379 }
61380
61381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
61382         LDKCommitmentUpdate this_ptr_conv;
61383         this_ptr_conv.inner = untag_ptr(this_ptr);
61384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61386         this_ptr_conv.is_owned = false;
61387         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
61388         int64_t ret_ref = 0;
61389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61391         return ret_ref;
61392 }
61393
61394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61395         LDKCommitmentUpdate this_ptr_conv;
61396         this_ptr_conv.inner = untag_ptr(this_ptr);
61397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61399         this_ptr_conv.is_owned = false;
61400         LDKCommitmentSigned val_conv;
61401         val_conv.inner = untag_ptr(val);
61402         val_conv.is_owned = ptr_is_owned(val);
61403         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61404         val_conv = CommitmentSigned_clone(&val_conv);
61405         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
61406 }
61407
61408 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) {
61409         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
61410         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
61411         if (update_add_htlcs_arg_constr.datalen > 0)
61412                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
61413         else
61414                 update_add_htlcs_arg_constr.data = NULL;
61415         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
61416         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
61417                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
61418                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
61419                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
61420                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
61421                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
61422                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
61423                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
61424         }
61425         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
61426         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
61427         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
61428         if (update_fulfill_htlcs_arg_constr.datalen > 0)
61429                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
61430         else
61431                 update_fulfill_htlcs_arg_constr.data = NULL;
61432         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
61433         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
61434                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
61435                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
61436                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
61437                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
61438                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
61439                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
61440                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
61441         }
61442         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
61443         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
61444         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
61445         if (update_fail_htlcs_arg_constr.datalen > 0)
61446                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
61447         else
61448                 update_fail_htlcs_arg_constr.data = NULL;
61449         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
61450         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
61451                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
61452                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
61453                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
61454                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
61455                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
61456                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
61457                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
61458         }
61459         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
61460         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
61461         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
61462         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
61463                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
61464         else
61465                 update_fail_malformed_htlcs_arg_constr.data = NULL;
61466         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
61467         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
61468                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
61469                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
61470                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
61471                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
61472                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
61473                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
61474                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
61475         }
61476         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
61477         LDKUpdateFee update_fee_arg_conv;
61478         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
61479         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
61480         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
61481         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
61482         LDKCommitmentSigned commitment_signed_arg_conv;
61483         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
61484         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
61485         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
61486         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
61487         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);
61488         int64_t ret_ref = 0;
61489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61491         return ret_ref;
61492 }
61493
61494 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
61495         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
61496         int64_t ret_ref = 0;
61497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61499         return ret_ref;
61500 }
61501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61502         LDKCommitmentUpdate arg_conv;
61503         arg_conv.inner = untag_ptr(arg);
61504         arg_conv.is_owned = ptr_is_owned(arg);
61505         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61506         arg_conv.is_owned = false;
61507         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
61508         return ret_conv;
61509 }
61510
61511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61512         LDKCommitmentUpdate orig_conv;
61513         orig_conv.inner = untag_ptr(orig);
61514         orig_conv.is_owned = ptr_is_owned(orig);
61515         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61516         orig_conv.is_owned = false;
61517         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
61518         int64_t ret_ref = 0;
61519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61521         return ret_ref;
61522 }
61523
61524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
61525         LDKCommitmentUpdate o_conv;
61526         o_conv.inner = untag_ptr(o);
61527         o_conv.is_owned = ptr_is_owned(o);
61528         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61529         o_conv.is_owned = false;
61530         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
61531         return ret_conv;
61532 }
61533
61534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61535         LDKCommitmentUpdate a_conv;
61536         a_conv.inner = untag_ptr(a);
61537         a_conv.is_owned = ptr_is_owned(a);
61538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61539         a_conv.is_owned = false;
61540         LDKCommitmentUpdate b_conv;
61541         b_conv.inner = untag_ptr(b);
61542         b_conv.is_owned = ptr_is_owned(b);
61543         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61544         b_conv.is_owned = false;
61545         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
61546         return ret_conv;
61547 }
61548
61549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61550         if (!ptr_is_owned(this_ptr)) return;
61551         void* this_ptr_ptr = untag_ptr(this_ptr);
61552         CHECK_ACCESS(this_ptr_ptr);
61553         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
61554         FREE(untag_ptr(this_ptr));
61555         ChannelMessageHandler_free(this_ptr_conv);
61556 }
61557
61558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61559         if (!ptr_is_owned(this_ptr)) return;
61560         void* this_ptr_ptr = untag_ptr(this_ptr);
61561         CHECK_ACCESS(this_ptr_ptr);
61562         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
61563         FREE(untag_ptr(this_ptr));
61564         RoutingMessageHandler_free(this_ptr_conv);
61565 }
61566
61567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61568         if (!ptr_is_owned(this_ptr)) return;
61569         void* this_ptr_ptr = untag_ptr(this_ptr);
61570         CHECK_ACCESS(this_ptr_ptr);
61571         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
61572         FREE(untag_ptr(this_ptr));
61573         OnionMessageHandler_free(this_ptr_conv);
61574 }
61575
61576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61577         LDKFinalOnionHopData this_obj_conv;
61578         this_obj_conv.inner = untag_ptr(this_obj);
61579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61581         FinalOnionHopData_free(this_obj_conv);
61582 }
61583
61584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
61585         LDKFinalOnionHopData this_ptr_conv;
61586         this_ptr_conv.inner = untag_ptr(this_ptr);
61587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61589         this_ptr_conv.is_owned = false;
61590         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61591         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FinalOnionHopData_get_payment_secret(&this_ptr_conv));
61592         return ret_arr;
61593 }
61594
61595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
61596         LDKFinalOnionHopData this_ptr_conv;
61597         this_ptr_conv.inner = untag_ptr(this_ptr);
61598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61600         this_ptr_conv.is_owned = false;
61601         LDKThirtyTwoBytes val_ref;
61602         CHECK((*env)->GetArrayLength(env, val) == 32);
61603         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
61604         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
61605 }
61606
61607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61608         LDKFinalOnionHopData this_ptr_conv;
61609         this_ptr_conv.inner = untag_ptr(this_ptr);
61610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61612         this_ptr_conv.is_owned = false;
61613         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
61614         return ret_conv;
61615 }
61616
61617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61618         LDKFinalOnionHopData this_ptr_conv;
61619         this_ptr_conv.inner = untag_ptr(this_ptr);
61620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61622         this_ptr_conv.is_owned = false;
61623         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
61624 }
61625
61626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1new(JNIEnv *env, jclass clz, int8_tArray payment_secret_arg, int64_t total_msat_arg) {
61627         LDKThirtyTwoBytes payment_secret_arg_ref;
61628         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
61629         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
61630         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
61631         int64_t ret_ref = 0;
61632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61634         return ret_ref;
61635 }
61636
61637 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
61638         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
61639         int64_t ret_ref = 0;
61640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61642         return ret_ref;
61643 }
61644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61645         LDKFinalOnionHopData arg_conv;
61646         arg_conv.inner = untag_ptr(arg);
61647         arg_conv.is_owned = ptr_is_owned(arg);
61648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61649         arg_conv.is_owned = false;
61650         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
61651         return ret_conv;
61652 }
61653
61654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61655         LDKFinalOnionHopData orig_conv;
61656         orig_conv.inner = untag_ptr(orig);
61657         orig_conv.is_owned = ptr_is_owned(orig);
61658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61659         orig_conv.is_owned = false;
61660         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
61661         int64_t ret_ref = 0;
61662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61664         return ret_ref;
61665 }
61666
61667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61668         LDKOnionPacket this_obj_conv;
61669         this_obj_conv.inner = untag_ptr(this_obj);
61670         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61672         OnionPacket_free(this_obj_conv);
61673 }
61674
61675 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
61676         LDKOnionPacket this_ptr_conv;
61677         this_ptr_conv.inner = untag_ptr(this_ptr);
61678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61680         this_ptr_conv.is_owned = false;
61681         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
61682         return ret_conv;
61683 }
61684
61685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
61686         LDKOnionPacket this_ptr_conv;
61687         this_ptr_conv.inner = untag_ptr(this_ptr);
61688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61690         this_ptr_conv.is_owned = false;
61691         OnionPacket_set_version(&this_ptr_conv, val);
61692 }
61693
61694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
61695         LDKOnionPacket this_ptr_conv;
61696         this_ptr_conv.inner = untag_ptr(this_ptr);
61697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61699         this_ptr_conv.is_owned = false;
61700         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61701         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
61702         return tag_ptr(ret_conv, true);
61703 }
61704
61705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61706         LDKOnionPacket this_ptr_conv;
61707         this_ptr_conv.inner = untag_ptr(this_ptr);
61708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61710         this_ptr_conv.is_owned = false;
61711         void* val_ptr = untag_ptr(val);
61712         CHECK_ACCESS(val_ptr);
61713         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
61714         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
61715         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
61716 }
61717
61718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
61719         LDKOnionPacket this_ptr_conv;
61720         this_ptr_conv.inner = untag_ptr(this_ptr);
61721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61723         this_ptr_conv.is_owned = false;
61724         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61725         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OnionPacket_get_hmac(&this_ptr_conv));
61726         return ret_arr;
61727 }
61728
61729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
61730         LDKOnionPacket this_ptr_conv;
61731         this_ptr_conv.inner = untag_ptr(this_ptr);
61732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61734         this_ptr_conv.is_owned = false;
61735         LDKThirtyTwoBytes val_ref;
61736         CHECK((*env)->GetArrayLength(env, val) == 32);
61737         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
61738         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
61739 }
61740
61741 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
61742         LDKOnionPacket ret_var = OnionPacket_clone(arg);
61743         int64_t ret_ref = 0;
61744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61746         return ret_ref;
61747 }
61748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61749         LDKOnionPacket arg_conv;
61750         arg_conv.inner = untag_ptr(arg);
61751         arg_conv.is_owned = ptr_is_owned(arg);
61752         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61753         arg_conv.is_owned = false;
61754         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
61755         return ret_conv;
61756 }
61757
61758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61759         LDKOnionPacket orig_conv;
61760         orig_conv.inner = untag_ptr(orig);
61761         orig_conv.is_owned = ptr_is_owned(orig);
61762         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61763         orig_conv.is_owned = false;
61764         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
61765         int64_t ret_ref = 0;
61766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61768         return ret_ref;
61769 }
61770
61771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
61772         LDKOnionPacket o_conv;
61773         o_conv.inner = untag_ptr(o);
61774         o_conv.is_owned = ptr_is_owned(o);
61775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61776         o_conv.is_owned = false;
61777         int64_t ret_conv = OnionPacket_hash(&o_conv);
61778         return ret_conv;
61779 }
61780
61781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61782         LDKOnionPacket a_conv;
61783         a_conv.inner = untag_ptr(a);
61784         a_conv.is_owned = ptr_is_owned(a);
61785         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61786         a_conv.is_owned = false;
61787         LDKOnionPacket b_conv;
61788         b_conv.inner = untag_ptr(b);
61789         b_conv.is_owned = ptr_is_owned(b);
61790         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61791         b_conv.is_owned = false;
61792         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
61793         return ret_conv;
61794 }
61795
61796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61797         LDKTrampolineOnionPacket this_obj_conv;
61798         this_obj_conv.inner = untag_ptr(this_obj);
61799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61801         TrampolineOnionPacket_free(this_obj_conv);
61802 }
61803
61804 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
61805         LDKTrampolineOnionPacket this_ptr_conv;
61806         this_ptr_conv.inner = untag_ptr(this_ptr);
61807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61809         this_ptr_conv.is_owned = false;
61810         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
61811         return ret_conv;
61812 }
61813
61814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
61815         LDKTrampolineOnionPacket this_ptr_conv;
61816         this_ptr_conv.inner = untag_ptr(this_ptr);
61817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61819         this_ptr_conv.is_owned = false;
61820         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
61821 }
61822
61823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
61824         LDKTrampolineOnionPacket this_ptr_conv;
61825         this_ptr_conv.inner = untag_ptr(this_ptr);
61826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61828         this_ptr_conv.is_owned = false;
61829         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61830         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form);
61831         return ret_arr;
61832 }
61833
61834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
61835         LDKTrampolineOnionPacket this_ptr_conv;
61836         this_ptr_conv.inner = untag_ptr(this_ptr);
61837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61839         this_ptr_conv.is_owned = false;
61840         LDKPublicKey val_ref;
61841         CHECK((*env)->GetArrayLength(env, val) == 33);
61842         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
61843         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
61844 }
61845
61846 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
61847         LDKTrampolineOnionPacket this_ptr_conv;
61848         this_ptr_conv.inner = untag_ptr(this_ptr);
61849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61851         this_ptr_conv.is_owned = false;
61852         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
61853         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61854         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61855         CVec_u8Z_free(ret_var);
61856         return ret_arr;
61857 }
61858
61859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
61860         LDKTrampolineOnionPacket this_ptr_conv;
61861         this_ptr_conv.inner = untag_ptr(this_ptr);
61862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61864         this_ptr_conv.is_owned = false;
61865         LDKCVec_u8Z val_ref;
61866         val_ref.datalen = (*env)->GetArrayLength(env, val);
61867         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
61868         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
61869         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
61870 }
61871
61872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
61873         LDKTrampolineOnionPacket this_ptr_conv;
61874         this_ptr_conv.inner = untag_ptr(this_ptr);
61875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61877         this_ptr_conv.is_owned = false;
61878         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TrampolineOnionPacket_get_hmac(&this_ptr_conv));
61880         return ret_arr;
61881 }
61882
61883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
61884         LDKTrampolineOnionPacket this_ptr_conv;
61885         this_ptr_conv.inner = untag_ptr(this_ptr);
61886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61888         this_ptr_conv.is_owned = false;
61889         LDKThirtyTwoBytes val_ref;
61890         CHECK((*env)->GetArrayLength(env, val) == 32);
61891         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
61892         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
61893 }
61894
61895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1new(JNIEnv *env, jclass clz, int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
61896         LDKPublicKey public_key_arg_ref;
61897         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
61898         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
61899         LDKCVec_u8Z hop_data_arg_ref;
61900         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
61901         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
61902         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
61903         LDKThirtyTwoBytes hmac_arg_ref;
61904         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
61905         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
61906         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
61907         int64_t ret_ref = 0;
61908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61910         return ret_ref;
61911 }
61912
61913 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
61914         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
61915         int64_t ret_ref = 0;
61916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61918         return ret_ref;
61919 }
61920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61921         LDKTrampolineOnionPacket arg_conv;
61922         arg_conv.inner = untag_ptr(arg);
61923         arg_conv.is_owned = ptr_is_owned(arg);
61924         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61925         arg_conv.is_owned = false;
61926         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
61927         return ret_conv;
61928 }
61929
61930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61931         LDKTrampolineOnionPacket orig_conv;
61932         orig_conv.inner = untag_ptr(orig);
61933         orig_conv.is_owned = ptr_is_owned(orig);
61934         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61935         orig_conv.is_owned = false;
61936         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
61937         int64_t ret_ref = 0;
61938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61940         return ret_ref;
61941 }
61942
61943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
61944         LDKTrampolineOnionPacket o_conv;
61945         o_conv.inner = untag_ptr(o);
61946         o_conv.is_owned = ptr_is_owned(o);
61947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61948         o_conv.is_owned = false;
61949         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
61950         return ret_conv;
61951 }
61952
61953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61954         LDKTrampolineOnionPacket a_conv;
61955         a_conv.inner = untag_ptr(a);
61956         a_conv.is_owned = ptr_is_owned(a);
61957         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61958         a_conv.is_owned = false;
61959         LDKTrampolineOnionPacket b_conv;
61960         b_conv.inner = untag_ptr(b);
61961         b_conv.is_owned = ptr_is_owned(b);
61962         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61963         b_conv.is_owned = false;
61964         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
61965         return ret_conv;
61966 }
61967
61968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
61969         LDKTrampolineOnionPacket obj_conv;
61970         obj_conv.inner = untag_ptr(obj);
61971         obj_conv.is_owned = ptr_is_owned(obj);
61972         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61973         obj_conv.is_owned = false;
61974         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
61975         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61976         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61977         CVec_u8Z_free(ret_var);
61978         return ret_arr;
61979 }
61980
61981 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_DecodeError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
61982         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
61983         LDKStr ret_str = DecodeError_to_str(o_conv);
61984         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
61985         Str_free(ret_str);
61986         return ret_conv;
61987 }
61988
61989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
61990         LDKAcceptChannel obj_conv;
61991         obj_conv.inner = untag_ptr(obj);
61992         obj_conv.is_owned = ptr_is_owned(obj);
61993         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61994         obj_conv.is_owned = false;
61995         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
61996         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61997         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61998         CVec_u8Z_free(ret_var);
61999         return ret_arr;
62000 }
62001
62002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62003         LDKu8slice ser_ref;
62004         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62005         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62006         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
62007         *ret_conv = AcceptChannel_read(ser_ref);
62008         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62009         return tag_ptr(ret_conv, true);
62010 }
62011
62012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
62013         LDKAcceptChannelV2 obj_conv;
62014         obj_conv.inner = untag_ptr(obj);
62015         obj_conv.is_owned = ptr_is_owned(obj);
62016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62017         obj_conv.is_owned = false;
62018         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
62019         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62020         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62021         CVec_u8Z_free(ret_var);
62022         return ret_arr;
62023 }
62024
62025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62026         LDKu8slice ser_ref;
62027         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62028         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62029         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
62030         *ret_conv = AcceptChannelV2_read(ser_ref);
62031         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62032         return tag_ptr(ret_conv, true);
62033 }
62034
62035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1write(JNIEnv *env, jclass clz, int64_t obj) {
62036         LDKStfu obj_conv;
62037         obj_conv.inner = untag_ptr(obj);
62038         obj_conv.is_owned = ptr_is_owned(obj);
62039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62040         obj_conv.is_owned = false;
62041         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
62042         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62043         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62044         CVec_u8Z_free(ret_var);
62045         return ret_arr;
62046 }
62047
62048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62049         LDKu8slice ser_ref;
62050         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62051         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62052         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
62053         *ret_conv = Stfu_read(ser_ref);
62054         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62055         return tag_ptr(ret_conv, true);
62056 }
62057
62058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1write(JNIEnv *env, jclass clz, int64_t obj) {
62059         LDKSplice obj_conv;
62060         obj_conv.inner = untag_ptr(obj);
62061         obj_conv.is_owned = ptr_is_owned(obj);
62062         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62063         obj_conv.is_owned = false;
62064         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
62065         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62066         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62067         CVec_u8Z_free(ret_var);
62068         return ret_arr;
62069 }
62070
62071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62072         LDKu8slice ser_ref;
62073         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62074         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62075         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
62076         *ret_conv = Splice_read(ser_ref);
62077         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62078         return tag_ptr(ret_conv, true);
62079 }
62080
62081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1write(JNIEnv *env, jclass clz, int64_t obj) {
62082         LDKSpliceAck obj_conv;
62083         obj_conv.inner = untag_ptr(obj);
62084         obj_conv.is_owned = ptr_is_owned(obj);
62085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62086         obj_conv.is_owned = false;
62087         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
62088         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62089         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62090         CVec_u8Z_free(ret_var);
62091         return ret_arr;
62092 }
62093
62094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62095         LDKu8slice ser_ref;
62096         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62097         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62098         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
62099         *ret_conv = SpliceAck_read(ser_ref);
62100         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62101         return tag_ptr(ret_conv, true);
62102 }
62103
62104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
62105         LDKSpliceLocked obj_conv;
62106         obj_conv.inner = untag_ptr(obj);
62107         obj_conv.is_owned = ptr_is_owned(obj);
62108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62109         obj_conv.is_owned = false;
62110         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
62111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62113         CVec_u8Z_free(ret_var);
62114         return ret_arr;
62115 }
62116
62117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62118         LDKu8slice ser_ref;
62119         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62120         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62121         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
62122         *ret_conv = SpliceLocked_read(ser_ref);
62123         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62124         return tag_ptr(ret_conv, true);
62125 }
62126
62127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
62128         LDKTxAddInput obj_conv;
62129         obj_conv.inner = untag_ptr(obj);
62130         obj_conv.is_owned = ptr_is_owned(obj);
62131         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62132         obj_conv.is_owned = false;
62133         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
62134         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62135         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62136         CVec_u8Z_free(ret_var);
62137         return ret_arr;
62138 }
62139
62140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62141         LDKu8slice ser_ref;
62142         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62143         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62144         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
62145         *ret_conv = TxAddInput_read(ser_ref);
62146         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62147         return tag_ptr(ret_conv, true);
62148 }
62149
62150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
62151         LDKTxAddOutput obj_conv;
62152         obj_conv.inner = untag_ptr(obj);
62153         obj_conv.is_owned = ptr_is_owned(obj);
62154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62155         obj_conv.is_owned = false;
62156         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
62157         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62158         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62159         CVec_u8Z_free(ret_var);
62160         return ret_arr;
62161 }
62162
62163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62164         LDKu8slice ser_ref;
62165         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62166         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62167         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
62168         *ret_conv = TxAddOutput_read(ser_ref);
62169         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62170         return tag_ptr(ret_conv, true);
62171 }
62172
62173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
62174         LDKTxRemoveInput obj_conv;
62175         obj_conv.inner = untag_ptr(obj);
62176         obj_conv.is_owned = ptr_is_owned(obj);
62177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62178         obj_conv.is_owned = false;
62179         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
62180         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62181         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62182         CVec_u8Z_free(ret_var);
62183         return ret_arr;
62184 }
62185
62186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62187         LDKu8slice ser_ref;
62188         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62189         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62190         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
62191         *ret_conv = TxRemoveInput_read(ser_ref);
62192         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62193         return tag_ptr(ret_conv, true);
62194 }
62195
62196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
62197         LDKTxRemoveOutput obj_conv;
62198         obj_conv.inner = untag_ptr(obj);
62199         obj_conv.is_owned = ptr_is_owned(obj);
62200         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62201         obj_conv.is_owned = false;
62202         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
62203         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62204         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62205         CVec_u8Z_free(ret_var);
62206         return ret_arr;
62207 }
62208
62209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62210         LDKu8slice ser_ref;
62211         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62212         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62213         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
62214         *ret_conv = TxRemoveOutput_read(ser_ref);
62215         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62216         return tag_ptr(ret_conv, true);
62217 }
62218
62219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
62220         LDKTxComplete obj_conv;
62221         obj_conv.inner = untag_ptr(obj);
62222         obj_conv.is_owned = ptr_is_owned(obj);
62223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62224         obj_conv.is_owned = false;
62225         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
62226         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62227         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62228         CVec_u8Z_free(ret_var);
62229         return ret_arr;
62230 }
62231
62232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62233         LDKu8slice ser_ref;
62234         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62235         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62236         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
62237         *ret_conv = TxComplete_read(ser_ref);
62238         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62239         return tag_ptr(ret_conv, true);
62240 }
62241
62242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
62243         LDKTxSignatures obj_conv;
62244         obj_conv.inner = untag_ptr(obj);
62245         obj_conv.is_owned = ptr_is_owned(obj);
62246         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62247         obj_conv.is_owned = false;
62248         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
62249         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62250         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62251         CVec_u8Z_free(ret_var);
62252         return ret_arr;
62253 }
62254
62255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62256         LDKu8slice ser_ref;
62257         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62258         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62259         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
62260         *ret_conv = TxSignatures_read(ser_ref);
62261         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62262         return tag_ptr(ret_conv, true);
62263 }
62264
62265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
62266         LDKTxInitRbf obj_conv;
62267         obj_conv.inner = untag_ptr(obj);
62268         obj_conv.is_owned = ptr_is_owned(obj);
62269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62270         obj_conv.is_owned = false;
62271         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
62272         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62273         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62274         CVec_u8Z_free(ret_var);
62275         return ret_arr;
62276 }
62277
62278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62279         LDKu8slice ser_ref;
62280         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62281         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62282         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
62283         *ret_conv = TxInitRbf_read(ser_ref);
62284         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62285         return tag_ptr(ret_conv, true);
62286 }
62287
62288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
62289         LDKTxAckRbf obj_conv;
62290         obj_conv.inner = untag_ptr(obj);
62291         obj_conv.is_owned = ptr_is_owned(obj);
62292         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62293         obj_conv.is_owned = false;
62294         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
62295         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62296         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62297         CVec_u8Z_free(ret_var);
62298         return ret_arr;
62299 }
62300
62301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62302         LDKu8slice ser_ref;
62303         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62304         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62305         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
62306         *ret_conv = TxAckRbf_read(ser_ref);
62307         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62308         return tag_ptr(ret_conv, true);
62309 }
62310
62311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
62312         LDKTxAbort obj_conv;
62313         obj_conv.inner = untag_ptr(obj);
62314         obj_conv.is_owned = ptr_is_owned(obj);
62315         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62316         obj_conv.is_owned = false;
62317         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
62318         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62319         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62320         CVec_u8Z_free(ret_var);
62321         return ret_arr;
62322 }
62323
62324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62325         LDKu8slice ser_ref;
62326         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62327         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62328         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
62329         *ret_conv = TxAbort_read(ser_ref);
62330         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62331         return tag_ptr(ret_conv, true);
62332 }
62333
62334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
62335         LDKAnnouncementSignatures obj_conv;
62336         obj_conv.inner = untag_ptr(obj);
62337         obj_conv.is_owned = ptr_is_owned(obj);
62338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62339         obj_conv.is_owned = false;
62340         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
62341         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62342         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62343         CVec_u8Z_free(ret_var);
62344         return ret_arr;
62345 }
62346
62347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62348         LDKu8slice ser_ref;
62349         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62350         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62351         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
62352         *ret_conv = AnnouncementSignatures_read(ser_ref);
62353         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62354         return tag_ptr(ret_conv, true);
62355 }
62356
62357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
62358         LDKChannelReestablish obj_conv;
62359         obj_conv.inner = untag_ptr(obj);
62360         obj_conv.is_owned = ptr_is_owned(obj);
62361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62362         obj_conv.is_owned = false;
62363         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
62364         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62365         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62366         CVec_u8Z_free(ret_var);
62367         return ret_arr;
62368 }
62369
62370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62371         LDKu8slice ser_ref;
62372         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62373         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62374         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
62375         *ret_conv = ChannelReestablish_read(ser_ref);
62376         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62377         return tag_ptr(ret_conv, true);
62378 }
62379
62380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
62381         LDKClosingSigned obj_conv;
62382         obj_conv.inner = untag_ptr(obj);
62383         obj_conv.is_owned = ptr_is_owned(obj);
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62385         obj_conv.is_owned = false;
62386         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
62387         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62388         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62389         CVec_u8Z_free(ret_var);
62390         return ret_arr;
62391 }
62392
62393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62394         LDKu8slice ser_ref;
62395         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62396         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62397         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
62398         *ret_conv = ClosingSigned_read(ser_ref);
62399         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62400         return tag_ptr(ret_conv, true);
62401 }
62402
62403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
62404         LDKClosingSignedFeeRange obj_conv;
62405         obj_conv.inner = untag_ptr(obj);
62406         obj_conv.is_owned = ptr_is_owned(obj);
62407         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62408         obj_conv.is_owned = false;
62409         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
62410         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62411         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62412         CVec_u8Z_free(ret_var);
62413         return ret_arr;
62414 }
62415
62416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62417         LDKu8slice ser_ref;
62418         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62419         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62420         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
62421         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
62422         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62423         return tag_ptr(ret_conv, true);
62424 }
62425
62426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
62427         LDKCommitmentSigned obj_conv;
62428         obj_conv.inner = untag_ptr(obj);
62429         obj_conv.is_owned = ptr_is_owned(obj);
62430         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62431         obj_conv.is_owned = false;
62432         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
62433         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62434         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62435         CVec_u8Z_free(ret_var);
62436         return ret_arr;
62437 }
62438
62439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62440         LDKu8slice ser_ref;
62441         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62442         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62443         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
62444         *ret_conv = CommitmentSigned_read(ser_ref);
62445         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62446         return tag_ptr(ret_conv, true);
62447 }
62448
62449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
62450         LDKFundingCreated obj_conv;
62451         obj_conv.inner = untag_ptr(obj);
62452         obj_conv.is_owned = ptr_is_owned(obj);
62453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62454         obj_conv.is_owned = false;
62455         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
62456         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62457         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62458         CVec_u8Z_free(ret_var);
62459         return ret_arr;
62460 }
62461
62462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62463         LDKu8slice ser_ref;
62464         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62465         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62466         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
62467         *ret_conv = FundingCreated_read(ser_ref);
62468         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62469         return tag_ptr(ret_conv, true);
62470 }
62471
62472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
62473         LDKFundingSigned obj_conv;
62474         obj_conv.inner = untag_ptr(obj);
62475         obj_conv.is_owned = ptr_is_owned(obj);
62476         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62477         obj_conv.is_owned = false;
62478         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
62479         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62480         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62481         CVec_u8Z_free(ret_var);
62482         return ret_arr;
62483 }
62484
62485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62486         LDKu8slice ser_ref;
62487         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62488         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62489         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
62490         *ret_conv = FundingSigned_read(ser_ref);
62491         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62492         return tag_ptr(ret_conv, true);
62493 }
62494
62495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
62496         LDKChannelReady obj_conv;
62497         obj_conv.inner = untag_ptr(obj);
62498         obj_conv.is_owned = ptr_is_owned(obj);
62499         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62500         obj_conv.is_owned = false;
62501         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
62502         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62503         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62504         CVec_u8Z_free(ret_var);
62505         return ret_arr;
62506 }
62507
62508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62509         LDKu8slice ser_ref;
62510         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62511         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62512         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
62513         *ret_conv = ChannelReady_read(ser_ref);
62514         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62515         return tag_ptr(ret_conv, true);
62516 }
62517
62518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
62519         LDKInit obj_conv;
62520         obj_conv.inner = untag_ptr(obj);
62521         obj_conv.is_owned = ptr_is_owned(obj);
62522         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62523         obj_conv.is_owned = false;
62524         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
62525         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62526         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62527         CVec_u8Z_free(ret_var);
62528         return ret_arr;
62529 }
62530
62531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62532         LDKu8slice ser_ref;
62533         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62534         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62535         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
62536         *ret_conv = Init_read(ser_ref);
62537         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62538         return tag_ptr(ret_conv, true);
62539 }
62540
62541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
62542         LDKOpenChannel obj_conv;
62543         obj_conv.inner = untag_ptr(obj);
62544         obj_conv.is_owned = ptr_is_owned(obj);
62545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62546         obj_conv.is_owned = false;
62547         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
62548         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62549         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62550         CVec_u8Z_free(ret_var);
62551         return ret_arr;
62552 }
62553
62554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62555         LDKu8slice ser_ref;
62556         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62557         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62558         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
62559         *ret_conv = OpenChannel_read(ser_ref);
62560         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62561         return tag_ptr(ret_conv, true);
62562 }
62563
62564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
62565         LDKOpenChannelV2 obj_conv;
62566         obj_conv.inner = untag_ptr(obj);
62567         obj_conv.is_owned = ptr_is_owned(obj);
62568         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62569         obj_conv.is_owned = false;
62570         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
62571         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62572         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62573         CVec_u8Z_free(ret_var);
62574         return ret_arr;
62575 }
62576
62577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62578         LDKu8slice ser_ref;
62579         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62580         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62581         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
62582         *ret_conv = OpenChannelV2_read(ser_ref);
62583         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62584         return tag_ptr(ret_conv, true);
62585 }
62586
62587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
62588         LDKRevokeAndACK obj_conv;
62589         obj_conv.inner = untag_ptr(obj);
62590         obj_conv.is_owned = ptr_is_owned(obj);
62591         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62592         obj_conv.is_owned = false;
62593         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
62594         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62595         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62596         CVec_u8Z_free(ret_var);
62597         return ret_arr;
62598 }
62599
62600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62601         LDKu8slice ser_ref;
62602         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62603         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62604         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
62605         *ret_conv = RevokeAndACK_read(ser_ref);
62606         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62607         return tag_ptr(ret_conv, true);
62608 }
62609
62610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
62611         LDKShutdown obj_conv;
62612         obj_conv.inner = untag_ptr(obj);
62613         obj_conv.is_owned = ptr_is_owned(obj);
62614         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62615         obj_conv.is_owned = false;
62616         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
62617         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62618         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62619         CVec_u8Z_free(ret_var);
62620         return ret_arr;
62621 }
62622
62623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62624         LDKu8slice ser_ref;
62625         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62626         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62627         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
62628         *ret_conv = Shutdown_read(ser_ref);
62629         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62630         return tag_ptr(ret_conv, true);
62631 }
62632
62633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
62634         LDKUpdateFailHTLC obj_conv;
62635         obj_conv.inner = untag_ptr(obj);
62636         obj_conv.is_owned = ptr_is_owned(obj);
62637         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62638         obj_conv.is_owned = false;
62639         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
62640         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62641         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62642         CVec_u8Z_free(ret_var);
62643         return ret_arr;
62644 }
62645
62646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62647         LDKu8slice ser_ref;
62648         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62649         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62650         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
62651         *ret_conv = UpdateFailHTLC_read(ser_ref);
62652         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62653         return tag_ptr(ret_conv, true);
62654 }
62655
62656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
62657         LDKUpdateFailMalformedHTLC obj_conv;
62658         obj_conv.inner = untag_ptr(obj);
62659         obj_conv.is_owned = ptr_is_owned(obj);
62660         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62661         obj_conv.is_owned = false;
62662         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
62663         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62664         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62665         CVec_u8Z_free(ret_var);
62666         return ret_arr;
62667 }
62668
62669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62670         LDKu8slice ser_ref;
62671         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62672         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62673         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
62674         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
62675         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62676         return tag_ptr(ret_conv, true);
62677 }
62678
62679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
62680         LDKUpdateFee obj_conv;
62681         obj_conv.inner = untag_ptr(obj);
62682         obj_conv.is_owned = ptr_is_owned(obj);
62683         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62684         obj_conv.is_owned = false;
62685         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
62686         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62687         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62688         CVec_u8Z_free(ret_var);
62689         return ret_arr;
62690 }
62691
62692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62693         LDKu8slice ser_ref;
62694         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62695         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62696         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
62697         *ret_conv = UpdateFee_read(ser_ref);
62698         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62699         return tag_ptr(ret_conv, true);
62700 }
62701
62702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
62703         LDKUpdateFulfillHTLC obj_conv;
62704         obj_conv.inner = untag_ptr(obj);
62705         obj_conv.is_owned = ptr_is_owned(obj);
62706         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62707         obj_conv.is_owned = false;
62708         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
62709         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62710         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62711         CVec_u8Z_free(ret_var);
62712         return ret_arr;
62713 }
62714
62715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62716         LDKu8slice ser_ref;
62717         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62718         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62719         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
62720         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
62721         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62722         return tag_ptr(ret_conv, true);
62723 }
62724
62725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
62726         LDKOnionPacket obj_conv;
62727         obj_conv.inner = untag_ptr(obj);
62728         obj_conv.is_owned = ptr_is_owned(obj);
62729         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62730         obj_conv.is_owned = false;
62731         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
62732         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62733         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62734         CVec_u8Z_free(ret_var);
62735         return ret_arr;
62736 }
62737
62738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62739         LDKu8slice ser_ref;
62740         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62741         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62742         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
62743         *ret_conv = OnionPacket_read(ser_ref);
62744         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62745         return tag_ptr(ret_conv, true);
62746 }
62747
62748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
62749         LDKUpdateAddHTLC obj_conv;
62750         obj_conv.inner = untag_ptr(obj);
62751         obj_conv.is_owned = ptr_is_owned(obj);
62752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62753         obj_conv.is_owned = false;
62754         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
62755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62757         CVec_u8Z_free(ret_var);
62758         return ret_arr;
62759 }
62760
62761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62762         LDKu8slice ser_ref;
62763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62765         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
62766         *ret_conv = UpdateAddHTLC_read(ser_ref);
62767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62768         return tag_ptr(ret_conv, true);
62769 }
62770
62771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62772         LDKu8slice ser_ref;
62773         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62774         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62775         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
62776         *ret_conv = OnionMessage_read(ser_ref);
62777         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62778         return tag_ptr(ret_conv, true);
62779 }
62780
62781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
62782         LDKOnionMessage obj_conv;
62783         obj_conv.inner = untag_ptr(obj);
62784         obj_conv.is_owned = ptr_is_owned(obj);
62785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62786         obj_conv.is_owned = false;
62787         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
62788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62790         CVec_u8Z_free(ret_var);
62791         return ret_arr;
62792 }
62793
62794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1write(JNIEnv *env, jclass clz, int64_t obj) {
62795         LDKFinalOnionHopData obj_conv;
62796         obj_conv.inner = untag_ptr(obj);
62797         obj_conv.is_owned = ptr_is_owned(obj);
62798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62799         obj_conv.is_owned = false;
62800         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
62801         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62802         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62803         CVec_u8Z_free(ret_var);
62804         return ret_arr;
62805 }
62806
62807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62808         LDKu8slice ser_ref;
62809         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62810         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62811         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
62812         *ret_conv = FinalOnionHopData_read(ser_ref);
62813         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62814         return tag_ptr(ret_conv, true);
62815 }
62816
62817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
62818         LDKPing obj_conv;
62819         obj_conv.inner = untag_ptr(obj);
62820         obj_conv.is_owned = ptr_is_owned(obj);
62821         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62822         obj_conv.is_owned = false;
62823         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
62824         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62825         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62826         CVec_u8Z_free(ret_var);
62827         return ret_arr;
62828 }
62829
62830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62831         LDKu8slice ser_ref;
62832         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62833         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62834         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
62835         *ret_conv = Ping_read(ser_ref);
62836         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62837         return tag_ptr(ret_conv, true);
62838 }
62839
62840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
62841         LDKPong obj_conv;
62842         obj_conv.inner = untag_ptr(obj);
62843         obj_conv.is_owned = ptr_is_owned(obj);
62844         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62845         obj_conv.is_owned = false;
62846         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
62847         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62848         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62849         CVec_u8Z_free(ret_var);
62850         return ret_arr;
62851 }
62852
62853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62854         LDKu8slice ser_ref;
62855         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62856         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62857         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
62858         *ret_conv = Pong_read(ser_ref);
62859         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62860         return tag_ptr(ret_conv, true);
62861 }
62862
62863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
62864         LDKUnsignedChannelAnnouncement obj_conv;
62865         obj_conv.inner = untag_ptr(obj);
62866         obj_conv.is_owned = ptr_is_owned(obj);
62867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62868         obj_conv.is_owned = false;
62869         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
62870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62872         CVec_u8Z_free(ret_var);
62873         return ret_arr;
62874 }
62875
62876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62877         LDKu8slice ser_ref;
62878         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62879         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62880         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
62881         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
62882         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62883         return tag_ptr(ret_conv, true);
62884 }
62885
62886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
62887         LDKChannelAnnouncement obj_conv;
62888         obj_conv.inner = untag_ptr(obj);
62889         obj_conv.is_owned = ptr_is_owned(obj);
62890         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62891         obj_conv.is_owned = false;
62892         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
62893         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62894         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62895         CVec_u8Z_free(ret_var);
62896         return ret_arr;
62897 }
62898
62899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62900         LDKu8slice ser_ref;
62901         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62902         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62903         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
62904         *ret_conv = ChannelAnnouncement_read(ser_ref);
62905         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62906         return tag_ptr(ret_conv, true);
62907 }
62908
62909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
62910         LDKUnsignedChannelUpdate obj_conv;
62911         obj_conv.inner = untag_ptr(obj);
62912         obj_conv.is_owned = ptr_is_owned(obj);
62913         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62914         obj_conv.is_owned = false;
62915         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
62916         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62917         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62918         CVec_u8Z_free(ret_var);
62919         return ret_arr;
62920 }
62921
62922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62923         LDKu8slice ser_ref;
62924         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62925         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62926         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
62927         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
62928         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62929         return tag_ptr(ret_conv, true);
62930 }
62931
62932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
62933         LDKChannelUpdate obj_conv;
62934         obj_conv.inner = untag_ptr(obj);
62935         obj_conv.is_owned = ptr_is_owned(obj);
62936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62937         obj_conv.is_owned = false;
62938         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
62939         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62940         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62941         CVec_u8Z_free(ret_var);
62942         return ret_arr;
62943 }
62944
62945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62946         LDKu8slice ser_ref;
62947         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62948         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62949         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
62950         *ret_conv = ChannelUpdate_read(ser_ref);
62951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62952         return tag_ptr(ret_conv, true);
62953 }
62954
62955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
62956         LDKErrorMessage obj_conv;
62957         obj_conv.inner = untag_ptr(obj);
62958         obj_conv.is_owned = ptr_is_owned(obj);
62959         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62960         obj_conv.is_owned = false;
62961         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
62962         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62963         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62964         CVec_u8Z_free(ret_var);
62965         return ret_arr;
62966 }
62967
62968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62969         LDKu8slice ser_ref;
62970         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62971         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62972         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
62973         *ret_conv = ErrorMessage_read(ser_ref);
62974         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62975         return tag_ptr(ret_conv, true);
62976 }
62977
62978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
62979         LDKWarningMessage obj_conv;
62980         obj_conv.inner = untag_ptr(obj);
62981         obj_conv.is_owned = ptr_is_owned(obj);
62982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62983         obj_conv.is_owned = false;
62984         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
62985         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62986         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62987         CVec_u8Z_free(ret_var);
62988         return ret_arr;
62989 }
62990
62991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62992         LDKu8slice ser_ref;
62993         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62994         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62995         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
62996         *ret_conv = WarningMessage_read(ser_ref);
62997         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62998         return tag_ptr(ret_conv, true);
62999 }
63000
63001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
63002         LDKUnsignedNodeAnnouncement obj_conv;
63003         obj_conv.inner = untag_ptr(obj);
63004         obj_conv.is_owned = ptr_is_owned(obj);
63005         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63006         obj_conv.is_owned = false;
63007         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
63008         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63009         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63010         CVec_u8Z_free(ret_var);
63011         return ret_arr;
63012 }
63013
63014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63015         LDKu8slice ser_ref;
63016         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63017         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63018         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
63019         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
63020         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63021         return tag_ptr(ret_conv, true);
63022 }
63023
63024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
63025         LDKNodeAnnouncement obj_conv;
63026         obj_conv.inner = untag_ptr(obj);
63027         obj_conv.is_owned = ptr_is_owned(obj);
63028         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63029         obj_conv.is_owned = false;
63030         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
63031         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63032         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63033         CVec_u8Z_free(ret_var);
63034         return ret_arr;
63035 }
63036
63037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63038         LDKu8slice ser_ref;
63039         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63040         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63041         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
63042         *ret_conv = NodeAnnouncement_read(ser_ref);
63043         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63044         return tag_ptr(ret_conv, true);
63045 }
63046
63047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63048         LDKu8slice ser_ref;
63049         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63050         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63051         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
63052         *ret_conv = QueryShortChannelIds_read(ser_ref);
63053         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63054         return tag_ptr(ret_conv, true);
63055 }
63056
63057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
63058         LDKQueryShortChannelIds obj_conv;
63059         obj_conv.inner = untag_ptr(obj);
63060         obj_conv.is_owned = ptr_is_owned(obj);
63061         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63062         obj_conv.is_owned = false;
63063         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
63064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63066         CVec_u8Z_free(ret_var);
63067         return ret_arr;
63068 }
63069
63070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
63071         LDKReplyShortChannelIdsEnd obj_conv;
63072         obj_conv.inner = untag_ptr(obj);
63073         obj_conv.is_owned = ptr_is_owned(obj);
63074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63075         obj_conv.is_owned = false;
63076         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
63077         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63078         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63079         CVec_u8Z_free(ret_var);
63080         return ret_arr;
63081 }
63082
63083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63084         LDKu8slice ser_ref;
63085         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63086         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63087         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
63088         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
63089         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63090         return tag_ptr(ret_conv, true);
63091 }
63092
63093 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
63094         LDKQueryChannelRange this_arg_conv;
63095         this_arg_conv.inner = untag_ptr(this_arg);
63096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63098         this_arg_conv.is_owned = false;
63099         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
63100         return ret_conv;
63101 }
63102
63103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
63104         LDKQueryChannelRange obj_conv;
63105         obj_conv.inner = untag_ptr(obj);
63106         obj_conv.is_owned = ptr_is_owned(obj);
63107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63108         obj_conv.is_owned = false;
63109         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
63110         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63111         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63112         CVec_u8Z_free(ret_var);
63113         return ret_arr;
63114 }
63115
63116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63117         LDKu8slice ser_ref;
63118         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63119         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63120         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
63121         *ret_conv = QueryChannelRange_read(ser_ref);
63122         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63123         return tag_ptr(ret_conv, true);
63124 }
63125
63126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63127         LDKu8slice ser_ref;
63128         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63129         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63130         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
63131         *ret_conv = ReplyChannelRange_read(ser_ref);
63132         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63133         return tag_ptr(ret_conv, true);
63134 }
63135
63136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
63137         LDKReplyChannelRange obj_conv;
63138         obj_conv.inner = untag_ptr(obj);
63139         obj_conv.is_owned = ptr_is_owned(obj);
63140         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63141         obj_conv.is_owned = false;
63142         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
63143         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63144         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63145         CVec_u8Z_free(ret_var);
63146         return ret_arr;
63147 }
63148
63149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
63150         LDKGossipTimestampFilter obj_conv;
63151         obj_conv.inner = untag_ptr(obj);
63152         obj_conv.is_owned = ptr_is_owned(obj);
63153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63154         obj_conv.is_owned = false;
63155         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
63156         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63157         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63158         CVec_u8Z_free(ret_var);
63159         return ret_arr;
63160 }
63161
63162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63163         LDKu8slice ser_ref;
63164         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63165         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63166         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
63167         *ret_conv = GossipTimestampFilter_read(ser_ref);
63168         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63169         return tag_ptr(ret_conv, true);
63170 }
63171
63172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63173         if (!ptr_is_owned(this_ptr)) return;
63174         void* this_ptr_ptr = untag_ptr(this_ptr);
63175         CHECK_ACCESS(this_ptr_ptr);
63176         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
63177         FREE(untag_ptr(this_ptr));
63178         CustomMessageHandler_free(this_ptr_conv);
63179 }
63180
63181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63182         LDKIgnoringMessageHandler this_obj_conv;
63183         this_obj_conv.inner = untag_ptr(this_obj);
63184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63186         IgnoringMessageHandler_free(this_obj_conv);
63187 }
63188
63189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
63190         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
63191         int64_t ret_ref = 0;
63192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63194         return ret_ref;
63195 }
63196
63197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63198         LDKIgnoringMessageHandler this_arg_conv;
63199         this_arg_conv.inner = untag_ptr(this_arg);
63200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63202         this_arg_conv.is_owned = false;
63203         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
63204         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
63205         return tag_ptr(ret_ret, true);
63206 }
63207
63208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63209         LDKIgnoringMessageHandler this_arg_conv;
63210         this_arg_conv.inner = untag_ptr(this_arg);
63211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63213         this_arg_conv.is_owned = false;
63214         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
63215         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
63216         return tag_ptr(ret_ret, true);
63217 }
63218
63219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63220         LDKIgnoringMessageHandler this_arg_conv;
63221         this_arg_conv.inner = untag_ptr(this_arg);
63222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63224         this_arg_conv.is_owned = false;
63225         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
63226         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
63227         return tag_ptr(ret_ret, true);
63228 }
63229
63230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63231         LDKIgnoringMessageHandler this_arg_conv;
63232         this_arg_conv.inner = untag_ptr(this_arg);
63233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63235         this_arg_conv.is_owned = false;
63236         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
63237         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
63238         return tag_ptr(ret_ret, true);
63239 }
63240
63241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63242         LDKIgnoringMessageHandler this_arg_conv;
63243         this_arg_conv.inner = untag_ptr(this_arg);
63244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63246         this_arg_conv.is_owned = false;
63247         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
63248         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
63249         return tag_ptr(ret_ret, true);
63250 }
63251
63252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63253         LDKIgnoringMessageHandler this_arg_conv;
63254         this_arg_conv.inner = untag_ptr(this_arg);
63255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63257         this_arg_conv.is_owned = false;
63258         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
63259         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
63260         return tag_ptr(ret_ret, true);
63261 }
63262
63263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
63264         LDKIgnoringMessageHandler this_arg_conv;
63265         this_arg_conv.inner = untag_ptr(this_arg);
63266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63268         this_arg_conv.is_owned = false;
63269         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
63270         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
63271         return tag_ptr(ret_ret, true);
63272 }
63273
63274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63275         LDKIgnoringMessageHandler this_arg_conv;
63276         this_arg_conv.inner = untag_ptr(this_arg);
63277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63279         this_arg_conv.is_owned = false;
63280         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
63281         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
63282         return tag_ptr(ret_ret, true);
63283 }
63284
63285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63286         LDKErroringMessageHandler this_obj_conv;
63287         this_obj_conv.inner = untag_ptr(this_obj);
63288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63290         ErroringMessageHandler_free(this_obj_conv);
63291 }
63292
63293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
63294         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
63295         int64_t ret_ref = 0;
63296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63298         return ret_ref;
63299 }
63300
63301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63302         LDKErroringMessageHandler this_arg_conv;
63303         this_arg_conv.inner = untag_ptr(this_arg);
63304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63306         this_arg_conv.is_owned = false;
63307         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
63308         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
63309         return tag_ptr(ret_ret, true);
63310 }
63311
63312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63313         LDKErroringMessageHandler this_arg_conv;
63314         this_arg_conv.inner = untag_ptr(this_arg);
63315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63317         this_arg_conv.is_owned = false;
63318         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
63319         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
63320         return tag_ptr(ret_ret, true);
63321 }
63322
63323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63324         LDKMessageHandler this_obj_conv;
63325         this_obj_conv.inner = untag_ptr(this_obj);
63326         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63328         MessageHandler_free(this_obj_conv);
63329 }
63330
63331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
63332         LDKMessageHandler this_ptr_conv;
63333         this_ptr_conv.inner = untag_ptr(this_ptr);
63334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63336         this_ptr_conv.is_owned = false;
63337         // WARNING: This object doesn't live past this scope, needs clone!
63338         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
63339         return ret_ret;
63340 }
63341
63342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63343         LDKMessageHandler this_ptr_conv;
63344         this_ptr_conv.inner = untag_ptr(this_ptr);
63345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63347         this_ptr_conv.is_owned = false;
63348         void* val_ptr = untag_ptr(val);
63349         CHECK_ACCESS(val_ptr);
63350         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
63351         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
63352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63353                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
63354         }
63355         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
63356 }
63357
63358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
63359         LDKMessageHandler this_ptr_conv;
63360         this_ptr_conv.inner = untag_ptr(this_ptr);
63361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63363         this_ptr_conv.is_owned = false;
63364         // WARNING: This object doesn't live past this scope, needs clone!
63365         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
63366         return ret_ret;
63367 }
63368
63369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63370         LDKMessageHandler this_ptr_conv;
63371         this_ptr_conv.inner = untag_ptr(this_ptr);
63372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63374         this_ptr_conv.is_owned = false;
63375         void* val_ptr = untag_ptr(val);
63376         CHECK_ACCESS(val_ptr);
63377         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
63378         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
63379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63380                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
63381         }
63382         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
63383 }
63384
63385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
63386         LDKMessageHandler this_ptr_conv;
63387         this_ptr_conv.inner = untag_ptr(this_ptr);
63388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63390         this_ptr_conv.is_owned = false;
63391         // WARNING: This object doesn't live past this scope, needs clone!
63392         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
63393         return ret_ret;
63394 }
63395
63396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63397         LDKMessageHandler this_ptr_conv;
63398         this_ptr_conv.inner = untag_ptr(this_ptr);
63399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63401         this_ptr_conv.is_owned = false;
63402         void* val_ptr = untag_ptr(val);
63403         CHECK_ACCESS(val_ptr);
63404         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
63405         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
63406                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63407                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
63408         }
63409         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
63410 }
63411
63412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
63413         LDKMessageHandler this_ptr_conv;
63414         this_ptr_conv.inner = untag_ptr(this_ptr);
63415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63417         this_ptr_conv.is_owned = false;
63418         // WARNING: This object doesn't live past this scope, needs clone!
63419         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
63420         return ret_ret;
63421 }
63422
63423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63424         LDKMessageHandler this_ptr_conv;
63425         this_ptr_conv.inner = untag_ptr(this_ptr);
63426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63428         this_ptr_conv.is_owned = false;
63429         void* val_ptr = untag_ptr(val);
63430         CHECK_ACCESS(val_ptr);
63431         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
63432         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
63433                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63434                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
63435         }
63436         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
63437 }
63438
63439 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) {
63440         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
63441         CHECK_ACCESS(chan_handler_arg_ptr);
63442         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
63443         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
63444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63445                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
63446         }
63447         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
63448         CHECK_ACCESS(route_handler_arg_ptr);
63449         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
63450         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
63451                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63452                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
63453         }
63454         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
63455         CHECK_ACCESS(onion_message_handler_arg_ptr);
63456         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
63457         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
63458                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63459                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
63460         }
63461         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
63462         CHECK_ACCESS(custom_message_handler_arg_ptr);
63463         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
63464         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
63465                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63466                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
63467         }
63468         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
63469         int64_t ret_ref = 0;
63470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63472         return ret_ref;
63473 }
63474
63475 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
63476         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
63477         *ret_ret = SocketDescriptor_clone(arg);
63478         return tag_ptr(ret_ret, true);
63479 }
63480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63481         void* arg_ptr = untag_ptr(arg);
63482         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
63483         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
63484         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
63485         return ret_conv;
63486 }
63487
63488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63489         void* orig_ptr = untag_ptr(orig);
63490         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
63491         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
63492         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
63493         *ret_ret = SocketDescriptor_clone(orig_conv);
63494         return tag_ptr(ret_ret, true);
63495 }
63496
63497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63498         if (!ptr_is_owned(this_ptr)) return;
63499         void* this_ptr_ptr = untag_ptr(this_ptr);
63500         CHECK_ACCESS(this_ptr_ptr);
63501         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
63502         FREE(untag_ptr(this_ptr));
63503         SocketDescriptor_free(this_ptr_conv);
63504 }
63505
63506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63507         LDKPeerDetails this_obj_conv;
63508         this_obj_conv.inner = untag_ptr(this_obj);
63509         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63511         PeerDetails_free(this_obj_conv);
63512 }
63513
63514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
63515         LDKPeerDetails this_ptr_conv;
63516         this_ptr_conv.inner = untag_ptr(this_ptr);
63517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63519         this_ptr_conv.is_owned = false;
63520         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63521         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form);
63522         return ret_arr;
63523 }
63524
63525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63526         LDKPeerDetails this_ptr_conv;
63527         this_ptr_conv.inner = untag_ptr(this_ptr);
63528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63530         this_ptr_conv.is_owned = false;
63531         LDKPublicKey val_ref;
63532         CHECK((*env)->GetArrayLength(env, val) == 33);
63533         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63534         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
63535 }
63536
63537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1socket_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
63538         LDKPeerDetails this_ptr_conv;
63539         this_ptr_conv.inner = untag_ptr(this_ptr);
63540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63542         this_ptr_conv.is_owned = false;
63543         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
63544         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
63545         int64_t ret_ref = tag_ptr(ret_copy, true);
63546         return ret_ref;
63547 }
63548
63549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1socket_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63550         LDKPeerDetails this_ptr_conv;
63551         this_ptr_conv.inner = untag_ptr(this_ptr);
63552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63554         this_ptr_conv.is_owned = false;
63555         void* val_ptr = untag_ptr(val);
63556         CHECK_ACCESS(val_ptr);
63557         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
63558         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
63559         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
63560 }
63561
63562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1init_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63563         LDKPeerDetails this_ptr_conv;
63564         this_ptr_conv.inner = untag_ptr(this_ptr);
63565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63567         this_ptr_conv.is_owned = false;
63568         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
63569         int64_t ret_ref = 0;
63570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63572         return ret_ref;
63573 }
63574
63575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1init_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63576         LDKPeerDetails this_ptr_conv;
63577         this_ptr_conv.inner = untag_ptr(this_ptr);
63578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63580         this_ptr_conv.is_owned = false;
63581         LDKInitFeatures val_conv;
63582         val_conv.inner = untag_ptr(val);
63583         val_conv.is_owned = ptr_is_owned(val);
63584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63585         val_conv = InitFeatures_clone(&val_conv);
63586         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
63587 }
63588
63589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1is_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_ptr) {
63590         LDKPeerDetails 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         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
63596         return ret_conv;
63597 }
63598
63599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1is_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63600         LDKPeerDetails this_ptr_conv;
63601         this_ptr_conv.inner = untag_ptr(this_ptr);
63602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63604         this_ptr_conv.is_owned = false;
63605         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
63606 }
63607
63608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1new(JNIEnv *env, jclass clz, int8_tArray counterparty_node_id_arg, int64_t socket_address_arg, int64_t init_features_arg, jboolean is_inbound_connection_arg) {
63609         LDKPublicKey counterparty_node_id_arg_ref;
63610         CHECK((*env)->GetArrayLength(env, counterparty_node_id_arg) == 33);
63611         (*env)->GetByteArrayRegion(env, counterparty_node_id_arg, 0, 33, counterparty_node_id_arg_ref.compressed_form);
63612         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
63613         CHECK_ACCESS(socket_address_arg_ptr);
63614         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
63615         LDKInitFeatures init_features_arg_conv;
63616         init_features_arg_conv.inner = untag_ptr(init_features_arg);
63617         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
63618         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
63619         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
63620         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
63621         int64_t ret_ref = 0;
63622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63624         return ret_ref;
63625 }
63626
63627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63628         LDKPeerHandleError this_obj_conv;
63629         this_obj_conv.inner = untag_ptr(this_obj);
63630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63632         PeerHandleError_free(this_obj_conv);
63633 }
63634
63635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
63636         LDKPeerHandleError ret_var = PeerHandleError_new();
63637         int64_t ret_ref = 0;
63638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63640         return ret_ref;
63641 }
63642
63643 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
63644         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
63645         int64_t ret_ref = 0;
63646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63648         return ret_ref;
63649 }
63650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63651         LDKPeerHandleError arg_conv;
63652         arg_conv.inner = untag_ptr(arg);
63653         arg_conv.is_owned = ptr_is_owned(arg);
63654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63655         arg_conv.is_owned = false;
63656         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
63657         return ret_conv;
63658 }
63659
63660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63661         LDKPeerHandleError orig_conv;
63662         orig_conv.inner = untag_ptr(orig);
63663         orig_conv.is_owned = ptr_is_owned(orig);
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63665         orig_conv.is_owned = false;
63666         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
63667         int64_t ret_ref = 0;
63668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63670         return ret_ref;
63671 }
63672
63673 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
63674         LDKPeerHandleError o_conv;
63675         o_conv.inner = untag_ptr(o);
63676         o_conv.is_owned = ptr_is_owned(o);
63677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63678         o_conv.is_owned = false;
63679         LDKStr ret_str = PeerHandleError_to_str(&o_conv);
63680         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
63681         Str_free(ret_str);
63682         return ret_conv;
63683 }
63684
63685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63686         LDKPeerManager this_obj_conv;
63687         this_obj_conv.inner = untag_ptr(this_obj);
63688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63690         PeerManager_free(this_obj_conv);
63691 }
63692
63693 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) {
63694         LDKMessageHandler message_handler_conv;
63695         message_handler_conv.inner = untag_ptr(message_handler);
63696         message_handler_conv.is_owned = ptr_is_owned(message_handler);
63697         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
63698         // WARNING: we need a move here but no clone is available for LDKMessageHandler
63699         
63700         uint8_t ephemeral_random_data_arr[32];
63701         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
63702         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
63703         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
63704         void* logger_ptr = untag_ptr(logger);
63705         CHECK_ACCESS(logger_ptr);
63706         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63707         if (logger_conv.free == LDKLogger_JCalls_free) {
63708                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63709                 LDKLogger_JCalls_cloned(&logger_conv);
63710         }
63711         void* node_signer_ptr = untag_ptr(node_signer);
63712         CHECK_ACCESS(node_signer_ptr);
63713         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63714         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63715                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63716                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63717         }
63718         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
63719         int64_t ret_ref = 0;
63720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63722         return ret_ref;
63723 }
63724
63725 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1list_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
63726         LDKPeerManager this_arg_conv;
63727         this_arg_conv.inner = untag_ptr(this_arg);
63728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63730         this_arg_conv.is_owned = false;
63731         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
63732         int64_tArray ret_arr = NULL;
63733         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63734         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63735         for (size_t n = 0; n < ret_var.datalen; n++) {
63736                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
63737                 int64_t ret_conv_13_ref = 0;
63738                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
63739                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
63740                 ret_arr_ptr[n] = ret_conv_13_ref;
63741         }
63742         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63743         FREE(ret_var.data);
63744         return ret_arr;
63745 }
63746
63747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1peer_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
63748         LDKPeerManager this_arg_conv;
63749         this_arg_conv.inner = untag_ptr(this_arg);
63750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63752         this_arg_conv.is_owned = false;
63753         LDKPublicKey their_node_id_ref;
63754         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
63755         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
63756         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
63757         int64_t ret_ref = 0;
63758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63760         return ret_ref;
63761 }
63762
63763 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) {
63764         LDKPeerManager this_arg_conv;
63765         this_arg_conv.inner = untag_ptr(this_arg);
63766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63768         this_arg_conv.is_owned = false;
63769         LDKPublicKey their_node_id_ref;
63770         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
63771         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
63772         void* descriptor_ptr = untag_ptr(descriptor);
63773         CHECK_ACCESS(descriptor_ptr);
63774         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
63775         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
63776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63777                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
63778         }
63779         void* remote_network_address_ptr = untag_ptr(remote_network_address);
63780         CHECK_ACCESS(remote_network_address_ptr);
63781         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
63782         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
63783         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
63784         return tag_ptr(ret_conv, true);
63785 }
63786
63787 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) {
63788         LDKPeerManager this_arg_conv;
63789         this_arg_conv.inner = untag_ptr(this_arg);
63790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63792         this_arg_conv.is_owned = false;
63793         void* descriptor_ptr = untag_ptr(descriptor);
63794         CHECK_ACCESS(descriptor_ptr);
63795         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
63796         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
63797                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63798                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
63799         }
63800         void* remote_network_address_ptr = untag_ptr(remote_network_address);
63801         CHECK_ACCESS(remote_network_address_ptr);
63802         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
63803         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
63804         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
63805         return tag_ptr(ret_conv, true);
63806 }
63807
63808 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) {
63809         LDKPeerManager this_arg_conv;
63810         this_arg_conv.inner = untag_ptr(this_arg);
63811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63813         this_arg_conv.is_owned = false;
63814         void* descriptor_ptr = untag_ptr(descriptor);
63815         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
63816         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
63817         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
63818         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
63819         return tag_ptr(ret_conv, true);
63820 }
63821
63822 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) {
63823         LDKPeerManager this_arg_conv;
63824         this_arg_conv.inner = untag_ptr(this_arg);
63825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63827         this_arg_conv.is_owned = false;
63828         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
63829         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
63830         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
63831         LDKu8slice data_ref;
63832         data_ref.datalen = (*env)->GetArrayLength(env, data);
63833         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
63834         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
63835         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
63836         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
63837         return tag_ptr(ret_conv, true);
63838 }
63839
63840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
63841         LDKPeerManager this_arg_conv;
63842         this_arg_conv.inner = untag_ptr(this_arg);
63843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63845         this_arg_conv.is_owned = false;
63846         PeerManager_process_events(&this_arg_conv);
63847 }
63848
63849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
63850         LDKPeerManager this_arg_conv;
63851         this_arg_conv.inner = untag_ptr(this_arg);
63852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63854         this_arg_conv.is_owned = false;
63855         void* descriptor_ptr = untag_ptr(descriptor);
63856         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
63857         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
63858         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
63859 }
63860
63861 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) {
63862         LDKPeerManager this_arg_conv;
63863         this_arg_conv.inner = untag_ptr(this_arg);
63864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63866         this_arg_conv.is_owned = false;
63867         LDKPublicKey node_id_ref;
63868         CHECK((*env)->GetArrayLength(env, node_id) == 33);
63869         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
63870         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
63871 }
63872
63873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
63874         LDKPeerManager this_arg_conv;
63875         this_arg_conv.inner = untag_ptr(this_arg);
63876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63878         this_arg_conv.is_owned = false;
63879         PeerManager_disconnect_all_peers(&this_arg_conv);
63880 }
63881
63882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
63883         LDKPeerManager this_arg_conv;
63884         this_arg_conv.inner = untag_ptr(this_arg);
63885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63887         this_arg_conv.is_owned = false;
63888         PeerManager_timer_tick_occurred(&this_arg_conv);
63889 }
63890
63891 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) {
63892         LDKPeerManager this_arg_conv;
63893         this_arg_conv.inner = untag_ptr(this_arg);
63894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63896         this_arg_conv.is_owned = false;
63897         LDKThreeBytes rgb_ref;
63898         CHECK((*env)->GetArrayLength(env, rgb) == 3);
63899         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
63900         LDKThirtyTwoBytes alias_ref;
63901         CHECK((*env)->GetArrayLength(env, alias) == 32);
63902         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
63903         LDKCVec_SocketAddressZ addresses_constr;
63904         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
63905         if (addresses_constr.datalen > 0)
63906                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
63907         else
63908                 addresses_constr.data = NULL;
63909         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
63910         for (size_t p = 0; p < addresses_constr.datalen; p++) {
63911                 int64_t addresses_conv_15 = addresses_vals[p];
63912                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
63913                 CHECK_ACCESS(addresses_conv_15_ptr);
63914                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
63915                 addresses_constr.data[p] = addresses_conv_15_conv;
63916         }
63917         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
63918         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
63919 }
63920
63921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
63922         LDKChannelTypeFeatures channel_type_features_conv;
63923         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63924         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63925         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63926         channel_type_features_conv.is_owned = false;
63927         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
63928         return ret_conv;
63929 }
63930
63931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
63932         LDKChannelTypeFeatures channel_type_features_conv;
63933         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63934         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63935         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63936         channel_type_features_conv.is_owned = false;
63937         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
63938         return ret_conv;
63939 }
63940
63941 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63942         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
63943         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
63944         return ret_conv;
63945 }
63946
63947 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
63948         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
63949         return ret_conv;
63950 }
63951
63952 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
63953         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
63954         return ret_conv;
63955 }
63956
63957 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
63958         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
63959         return ret_conv;
63960 }
63961
63962 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
63963         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
63964         return ret_conv;
63965 }
63966
63967 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
63968         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
63969         return ret_conv;
63970 }
63971
63972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63973         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
63974         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
63975         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
63976         return ret_conv;
63977 }
63978
63979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
63980         LDKWitness witness_ref;
63981         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
63982         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
63983         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
63984         witness_ref.data_is_owned = true;
63985         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
63986         *ret_copy = HTLCClaim_from_witness(witness_ref);
63987         int64_t ret_ref = tag_ptr(ret_copy, true);
63988         return ret_ref;
63989 }
63990
63991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
63992         uint8_t commitment_seed_arr[32];
63993         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
63994         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
63995         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
63996         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63997         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
63998         return ret_arr;
63999 }
64000
64001 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) {
64002         LDKCVec_u8Z to_holder_script_ref;
64003         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
64004         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
64005         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
64006         LDKCVec_u8Z to_counterparty_script_ref;
64007         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
64008         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
64009         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
64010         LDKOutPoint funding_outpoint_conv;
64011         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
64012         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
64013         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
64014         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
64015         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);
64016         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64017         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64018         Transaction_free(ret_var);
64019         return ret_arr;
64020 }
64021
64022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64023         LDKCounterpartyCommitmentSecrets this_obj_conv;
64024         this_obj_conv.inner = untag_ptr(this_obj);
64025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64027         CounterpartyCommitmentSecrets_free(this_obj_conv);
64028 }
64029
64030 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
64031         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
64032         int64_t ret_ref = 0;
64033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64035         return ret_ref;
64036 }
64037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64038         LDKCounterpartyCommitmentSecrets arg_conv;
64039         arg_conv.inner = untag_ptr(arg);
64040         arg_conv.is_owned = ptr_is_owned(arg);
64041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64042         arg_conv.is_owned = false;
64043         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
64044         return ret_conv;
64045 }
64046
64047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64048         LDKCounterpartyCommitmentSecrets orig_conv;
64049         orig_conv.inner = untag_ptr(orig);
64050         orig_conv.is_owned = ptr_is_owned(orig);
64051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64052         orig_conv.is_owned = false;
64053         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
64054         int64_t ret_ref = 0;
64055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64057         return ret_ref;
64058 }
64059
64060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
64061         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
64062         int64_t ret_ref = 0;
64063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64065         return ret_ref;
64066 }
64067
64068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
64069         LDKCounterpartyCommitmentSecrets this_arg_conv;
64070         this_arg_conv.inner = untag_ptr(this_arg);
64071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64073         this_arg_conv.is_owned = false;
64074         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
64075         return ret_conv;
64076 }
64077
64078 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) {
64079         LDKCounterpartyCommitmentSecrets this_arg_conv;
64080         this_arg_conv.inner = untag_ptr(this_arg);
64081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64083         this_arg_conv.is_owned = false;
64084         LDKThirtyTwoBytes secret_ref;
64085         CHECK((*env)->GetArrayLength(env, secret) == 32);
64086         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
64087         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
64088         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
64089         return tag_ptr(ret_conv, true);
64090 }
64091
64092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
64093         LDKCounterpartyCommitmentSecrets this_arg_conv;
64094         this_arg_conv.inner = untag_ptr(this_arg);
64095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64097         this_arg_conv.is_owned = false;
64098         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64099         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
64100         return ret_arr;
64101 }
64102
64103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
64104         LDKCounterpartyCommitmentSecrets obj_conv;
64105         obj_conv.inner = untag_ptr(obj);
64106         obj_conv.is_owned = ptr_is_owned(obj);
64107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64108         obj_conv.is_owned = false;
64109         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
64110         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64111         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64112         CVec_u8Z_free(ret_var);
64113         return ret_arr;
64114 }
64115
64116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64117         LDKu8slice ser_ref;
64118         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64119         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64120         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
64121         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
64122         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64123         return tag_ptr(ret_conv, true);
64124 }
64125
64126 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) {
64127         LDKPublicKey per_commitment_point_ref;
64128         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
64129         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
64130         uint8_t base_secret_arr[32];
64131         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
64132         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
64133         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
64134         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64135         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
64136         return ret_arr;
64137 }
64138
64139 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) {
64140         uint8_t per_commitment_secret_arr[32];
64141         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
64142         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
64143         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
64144         uint8_t countersignatory_revocation_base_secret_arr[32];
64145         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
64146         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
64147         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
64148         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64149         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
64150         return ret_arr;
64151 }
64152
64153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64154         LDKTxCreationKeys this_obj_conv;
64155         this_obj_conv.inner = untag_ptr(this_obj);
64156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64158         TxCreationKeys_free(this_obj_conv);
64159 }
64160
64161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
64162         LDKTxCreationKeys this_ptr_conv;
64163         this_ptr_conv.inner = untag_ptr(this_ptr);
64164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64166         this_ptr_conv.is_owned = false;
64167         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64168         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
64169         return ret_arr;
64170 }
64171
64172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64173         LDKTxCreationKeys this_ptr_conv;
64174         this_ptr_conv.inner = untag_ptr(this_ptr);
64175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64177         this_ptr_conv.is_owned = false;
64178         LDKPublicKey val_ref;
64179         CHECK((*env)->GetArrayLength(env, val) == 33);
64180         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64181         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
64182 }
64183
64184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
64185         LDKTxCreationKeys this_ptr_conv;
64186         this_ptr_conv.inner = untag_ptr(this_ptr);
64187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64189         this_ptr_conv.is_owned = false;
64190         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
64191         int64_t ret_ref = 0;
64192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64194         return ret_ref;
64195 }
64196
64197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64198         LDKTxCreationKeys this_ptr_conv;
64199         this_ptr_conv.inner = untag_ptr(this_ptr);
64200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64202         this_ptr_conv.is_owned = false;
64203         LDKRevocationKey val_conv;
64204         val_conv.inner = untag_ptr(val);
64205         val_conv.is_owned = ptr_is_owned(val);
64206         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64207         val_conv = RevocationKey_clone(&val_conv);
64208         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
64209 }
64210
64211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
64212         LDKTxCreationKeys this_ptr_conv;
64213         this_ptr_conv.inner = untag_ptr(this_ptr);
64214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64216         this_ptr_conv.is_owned = false;
64217         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
64218         int64_t ret_ref = 0;
64219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64221         return ret_ref;
64222 }
64223
64224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64225         LDKTxCreationKeys this_ptr_conv;
64226         this_ptr_conv.inner = untag_ptr(this_ptr);
64227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64229         this_ptr_conv.is_owned = false;
64230         LDKHtlcKey val_conv;
64231         val_conv.inner = untag_ptr(val);
64232         val_conv.is_owned = ptr_is_owned(val);
64233         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64234         val_conv = HtlcKey_clone(&val_conv);
64235         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
64236 }
64237
64238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
64239         LDKTxCreationKeys this_ptr_conv;
64240         this_ptr_conv.inner = untag_ptr(this_ptr);
64241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64243         this_ptr_conv.is_owned = false;
64244         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
64245         int64_t ret_ref = 0;
64246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64248         return ret_ref;
64249 }
64250
64251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64252         LDKTxCreationKeys this_ptr_conv;
64253         this_ptr_conv.inner = untag_ptr(this_ptr);
64254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64256         this_ptr_conv.is_owned = false;
64257         LDKHtlcKey val_conv;
64258         val_conv.inner = untag_ptr(val);
64259         val_conv.is_owned = ptr_is_owned(val);
64260         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64261         val_conv = HtlcKey_clone(&val_conv);
64262         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
64263 }
64264
64265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
64266         LDKTxCreationKeys this_ptr_conv;
64267         this_ptr_conv.inner = untag_ptr(this_ptr);
64268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64270         this_ptr_conv.is_owned = false;
64271         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
64272         int64_t ret_ref = 0;
64273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64275         return ret_ref;
64276 }
64277
64278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64279         LDKTxCreationKeys this_ptr_conv;
64280         this_ptr_conv.inner = untag_ptr(this_ptr);
64281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64283         this_ptr_conv.is_owned = false;
64284         LDKDelayedPaymentKey val_conv;
64285         val_conv.inner = untag_ptr(val);
64286         val_conv.is_owned = ptr_is_owned(val);
64287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64288         val_conv = DelayedPaymentKey_clone(&val_conv);
64289         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
64290 }
64291
64292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int64_t revocation_key_arg, int64_t broadcaster_htlc_key_arg, int64_t countersignatory_htlc_key_arg, int64_t broadcaster_delayed_payment_key_arg) {
64293         LDKPublicKey per_commitment_point_arg_ref;
64294         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
64295         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
64296         LDKRevocationKey revocation_key_arg_conv;
64297         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
64298         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
64299         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
64300         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
64301         LDKHtlcKey broadcaster_htlc_key_arg_conv;
64302         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
64303         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
64304         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
64305         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
64306         LDKHtlcKey countersignatory_htlc_key_arg_conv;
64307         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
64308         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
64309         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
64310         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
64311         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
64312         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
64313         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
64314         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
64315         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
64316         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
64317         int64_t ret_ref = 0;
64318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64320         return ret_ref;
64321 }
64322
64323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64324         LDKTxCreationKeys a_conv;
64325         a_conv.inner = untag_ptr(a);
64326         a_conv.is_owned = ptr_is_owned(a);
64327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64328         a_conv.is_owned = false;
64329         LDKTxCreationKeys b_conv;
64330         b_conv.inner = untag_ptr(b);
64331         b_conv.is_owned = ptr_is_owned(b);
64332         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64333         b_conv.is_owned = false;
64334         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
64335         return ret_conv;
64336 }
64337
64338 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
64339         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
64340         int64_t ret_ref = 0;
64341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64343         return ret_ref;
64344 }
64345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64346         LDKTxCreationKeys arg_conv;
64347         arg_conv.inner = untag_ptr(arg);
64348         arg_conv.is_owned = ptr_is_owned(arg);
64349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64350         arg_conv.is_owned = false;
64351         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
64352         return ret_conv;
64353 }
64354
64355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64356         LDKTxCreationKeys orig_conv;
64357         orig_conv.inner = untag_ptr(orig);
64358         orig_conv.is_owned = ptr_is_owned(orig);
64359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64360         orig_conv.is_owned = false;
64361         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
64362         int64_t ret_ref = 0;
64363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64365         return ret_ref;
64366 }
64367
64368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
64369         LDKTxCreationKeys obj_conv;
64370         obj_conv.inner = untag_ptr(obj);
64371         obj_conv.is_owned = ptr_is_owned(obj);
64372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64373         obj_conv.is_owned = false;
64374         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
64375         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64376         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64377         CVec_u8Z_free(ret_var);
64378         return ret_arr;
64379 }
64380
64381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64382         LDKu8slice ser_ref;
64383         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64384         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64385         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
64386         *ret_conv = TxCreationKeys_read(ser_ref);
64387         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64388         return tag_ptr(ret_conv, true);
64389 }
64390
64391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64392         LDKChannelPublicKeys this_obj_conv;
64393         this_obj_conv.inner = untag_ptr(this_obj);
64394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64396         ChannelPublicKeys_free(this_obj_conv);
64397 }
64398
64399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
64400         LDKChannelPublicKeys this_ptr_conv;
64401         this_ptr_conv.inner = untag_ptr(this_ptr);
64402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64404         this_ptr_conv.is_owned = false;
64405         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64406         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
64407         return ret_arr;
64408 }
64409
64410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64411         LDKChannelPublicKeys 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         LDKPublicKey val_ref;
64417         CHECK((*env)->GetArrayLength(env, val) == 33);
64418         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64419         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
64420 }
64421
64422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
64423         LDKChannelPublicKeys 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         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
64429         int64_t ret_ref = 0;
64430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64432         return ret_ref;
64433 }
64434
64435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64436         LDKChannelPublicKeys 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         LDKRevocationBasepoint val_conv;
64442         val_conv.inner = untag_ptr(val);
64443         val_conv.is_owned = ptr_is_owned(val);
64444         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64445         val_conv = RevocationBasepoint_clone(&val_conv);
64446         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
64447 }
64448
64449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
64450         LDKChannelPublicKeys this_ptr_conv;
64451         this_ptr_conv.inner = untag_ptr(this_ptr);
64452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64454         this_ptr_conv.is_owned = false;
64455         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64456         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
64457         return ret_arr;
64458 }
64459
64460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64461         LDKChannelPublicKeys 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         LDKPublicKey val_ref;
64467         CHECK((*env)->GetArrayLength(env, val) == 33);
64468         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64469         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
64470 }
64471
64472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
64473         LDKChannelPublicKeys this_ptr_conv;
64474         this_ptr_conv.inner = untag_ptr(this_ptr);
64475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64477         this_ptr_conv.is_owned = false;
64478         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
64479         int64_t ret_ref = 0;
64480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64482         return ret_ref;
64483 }
64484
64485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64486         LDKChannelPublicKeys this_ptr_conv;
64487         this_ptr_conv.inner = untag_ptr(this_ptr);
64488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64490         this_ptr_conv.is_owned = false;
64491         LDKDelayedPaymentBasepoint val_conv;
64492         val_conv.inner = untag_ptr(val);
64493         val_conv.is_owned = ptr_is_owned(val);
64494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64495         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
64496         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
64497 }
64498
64499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
64500         LDKChannelPublicKeys this_ptr_conv;
64501         this_ptr_conv.inner = untag_ptr(this_ptr);
64502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64504         this_ptr_conv.is_owned = false;
64505         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
64506         int64_t ret_ref = 0;
64507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64509         return ret_ref;
64510 }
64511
64512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64513         LDKChannelPublicKeys this_ptr_conv;
64514         this_ptr_conv.inner = untag_ptr(this_ptr);
64515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64517         this_ptr_conv.is_owned = false;
64518         LDKHtlcBasepoint val_conv;
64519         val_conv.inner = untag_ptr(val);
64520         val_conv.is_owned = ptr_is_owned(val);
64521         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64522         val_conv = HtlcBasepoint_clone(&val_conv);
64523         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
64524 }
64525
64526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int64_t revocation_basepoint_arg, int8_tArray payment_point_arg, int64_t delayed_payment_basepoint_arg, int64_t htlc_basepoint_arg) {
64527         LDKPublicKey funding_pubkey_arg_ref;
64528         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
64529         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
64530         LDKRevocationBasepoint revocation_basepoint_arg_conv;
64531         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
64532         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
64533         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
64534         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
64535         LDKPublicKey payment_point_arg_ref;
64536         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
64537         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
64538         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
64539         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
64540         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
64541         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
64542         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
64543         LDKHtlcBasepoint htlc_basepoint_arg_conv;
64544         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
64545         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
64546         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
64547         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
64548         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_conv, payment_point_arg_ref, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
64549         int64_t ret_ref = 0;
64550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64552         return ret_ref;
64553 }
64554
64555 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
64556         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
64557         int64_t ret_ref = 0;
64558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64560         return ret_ref;
64561 }
64562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64563         LDKChannelPublicKeys arg_conv;
64564         arg_conv.inner = untag_ptr(arg);
64565         arg_conv.is_owned = ptr_is_owned(arg);
64566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64567         arg_conv.is_owned = false;
64568         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
64569         return ret_conv;
64570 }
64571
64572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64573         LDKChannelPublicKeys orig_conv;
64574         orig_conv.inner = untag_ptr(orig);
64575         orig_conv.is_owned = ptr_is_owned(orig);
64576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64577         orig_conv.is_owned = false;
64578         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
64586         LDKChannelPublicKeys o_conv;
64587         o_conv.inner = untag_ptr(o);
64588         o_conv.is_owned = ptr_is_owned(o);
64589         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64590         o_conv.is_owned = false;
64591         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
64592         return ret_conv;
64593 }
64594
64595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64596         LDKChannelPublicKeys a_conv;
64597         a_conv.inner = untag_ptr(a);
64598         a_conv.is_owned = ptr_is_owned(a);
64599         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64600         a_conv.is_owned = false;
64601         LDKChannelPublicKeys b_conv;
64602         b_conv.inner = untag_ptr(b);
64603         b_conv.is_owned = ptr_is_owned(b);
64604         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64605         b_conv.is_owned = false;
64606         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
64607         return ret_conv;
64608 }
64609
64610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
64611         LDKChannelPublicKeys obj_conv;
64612         obj_conv.inner = untag_ptr(obj);
64613         obj_conv.is_owned = ptr_is_owned(obj);
64614         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64615         obj_conv.is_owned = false;
64616         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
64617         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64618         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64619         CVec_u8Z_free(ret_var);
64620         return ret_arr;
64621 }
64622
64623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64624         LDKu8slice ser_ref;
64625         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64626         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64627         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
64628         *ret_conv = ChannelPublicKeys_read(ser_ref);
64629         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64630         return tag_ptr(ret_conv, true);
64631 }
64632
64633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_delayed_payment_base, int64_t broadcaster_htlc_base, int64_t countersignatory_revocation_base, int64_t countersignatory_htlc_base) {
64634         LDKPublicKey per_commitment_point_ref;
64635         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
64636         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
64637         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
64638         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
64639         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
64640         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
64641         broadcaster_delayed_payment_base_conv.is_owned = false;
64642         LDKHtlcBasepoint broadcaster_htlc_base_conv;
64643         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
64644         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
64645         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
64646         broadcaster_htlc_base_conv.is_owned = false;
64647         LDKRevocationBasepoint countersignatory_revocation_base_conv;
64648         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
64649         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
64650         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
64651         countersignatory_revocation_base_conv.is_owned = false;
64652         LDKHtlcBasepoint countersignatory_htlc_base_conv;
64653         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
64654         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
64655         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
64656         countersignatory_htlc_base_conv.is_owned = false;
64657         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, &broadcaster_delayed_payment_base_conv, &broadcaster_htlc_base_conv, &countersignatory_revocation_base_conv, &countersignatory_htlc_base_conv);
64658         int64_t ret_ref = 0;
64659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64661         return ret_ref;
64662 }
64663
64664 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) {
64665         LDKPublicKey per_commitment_point_ref;
64666         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
64667         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
64668         LDKChannelPublicKeys broadcaster_keys_conv;
64669         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
64670         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
64671         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
64672         broadcaster_keys_conv.is_owned = false;
64673         LDKChannelPublicKeys countersignatory_keys_conv;
64674         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
64675         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
64676         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
64677         countersignatory_keys_conv.is_owned = false;
64678         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
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 int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
64686         LDKRevocationKey revocation_key_conv;
64687         revocation_key_conv.inner = untag_ptr(revocation_key);
64688         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
64689         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
64690         revocation_key_conv.is_owned = false;
64691         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
64692         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
64693         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
64694         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
64695         broadcaster_delayed_payment_key_conv.is_owned = false;
64696         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
64697         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64698         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64699         CVec_u8Z_free(ret_var);
64700         return ret_arr;
64701 }
64702
64703 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) {
64704         LDKChannelTypeFeatures channel_type_features_conv;
64705         channel_type_features_conv.inner = untag_ptr(channel_type_features);
64706         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
64707         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
64708         channel_type_features_conv.is_owned = false;
64709         LDKPublicKey payment_key_ref;
64710         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
64711         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
64712         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
64713         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64714         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64715         CVec_u8Z_free(ret_var);
64716         return ret_arr;
64717 }
64718
64719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64720         LDKHTLCOutputInCommitment this_obj_conv;
64721         this_obj_conv.inner = untag_ptr(this_obj);
64722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64724         HTLCOutputInCommitment_free(this_obj_conv);
64725 }
64726
64727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
64728         LDKHTLCOutputInCommitment this_ptr_conv;
64729         this_ptr_conv.inner = untag_ptr(this_ptr);
64730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64732         this_ptr_conv.is_owned = false;
64733         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
64734         return ret_conv;
64735 }
64736
64737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
64738         LDKHTLCOutputInCommitment this_ptr_conv;
64739         this_ptr_conv.inner = untag_ptr(this_ptr);
64740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64742         this_ptr_conv.is_owned = false;
64743         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
64744 }
64745
64746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64747         LDKHTLCOutputInCommitment this_ptr_conv;
64748         this_ptr_conv.inner = untag_ptr(this_ptr);
64749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64751         this_ptr_conv.is_owned = false;
64752         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
64753         return ret_conv;
64754 }
64755
64756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64757         LDKHTLCOutputInCommitment this_ptr_conv;
64758         this_ptr_conv.inner = untag_ptr(this_ptr);
64759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64761         this_ptr_conv.is_owned = false;
64762         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
64763 }
64764
64765 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
64766         LDKHTLCOutputInCommitment this_ptr_conv;
64767         this_ptr_conv.inner = untag_ptr(this_ptr);
64768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64770         this_ptr_conv.is_owned = false;
64771         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
64772         return ret_conv;
64773 }
64774
64775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
64776         LDKHTLCOutputInCommitment this_ptr_conv;
64777         this_ptr_conv.inner = untag_ptr(this_ptr);
64778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64780         this_ptr_conv.is_owned = false;
64781         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
64782 }
64783
64784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
64785         LDKHTLCOutputInCommitment this_ptr_conv;
64786         this_ptr_conv.inner = untag_ptr(this_ptr);
64787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64789         this_ptr_conv.is_owned = false;
64790         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64791         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
64792         return ret_arr;
64793 }
64794
64795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64796         LDKHTLCOutputInCommitment this_ptr_conv;
64797         this_ptr_conv.inner = untag_ptr(this_ptr);
64798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64800         this_ptr_conv.is_owned = false;
64801         LDKThirtyTwoBytes val_ref;
64802         CHECK((*env)->GetArrayLength(env, val) == 32);
64803         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
64804         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
64805 }
64806
64807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
64808         LDKHTLCOutputInCommitment this_ptr_conv;
64809         this_ptr_conv.inner = untag_ptr(this_ptr);
64810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64812         this_ptr_conv.is_owned = false;
64813         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
64814         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
64815         int64_t ret_ref = tag_ptr(ret_copy, true);
64816         return ret_ref;
64817 }
64818
64819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64820         LDKHTLCOutputInCommitment this_ptr_conv;
64821         this_ptr_conv.inner = untag_ptr(this_ptr);
64822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64824         this_ptr_conv.is_owned = false;
64825         void* val_ptr = untag_ptr(val);
64826         CHECK_ACCESS(val_ptr);
64827         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
64828         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
64829         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
64830 }
64831
64832 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) {
64833         LDKThirtyTwoBytes payment_hash_arg_ref;
64834         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
64835         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
64836         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
64837         CHECK_ACCESS(transaction_output_index_arg_ptr);
64838         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
64839         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
64840         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
64841         int64_t ret_ref = 0;
64842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64844         return ret_ref;
64845 }
64846
64847 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
64848         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
64849         int64_t ret_ref = 0;
64850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64852         return ret_ref;
64853 }
64854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64855         LDKHTLCOutputInCommitment arg_conv;
64856         arg_conv.inner = untag_ptr(arg);
64857         arg_conv.is_owned = ptr_is_owned(arg);
64858         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64859         arg_conv.is_owned = false;
64860         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
64861         return ret_conv;
64862 }
64863
64864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64865         LDKHTLCOutputInCommitment orig_conv;
64866         orig_conv.inner = untag_ptr(orig);
64867         orig_conv.is_owned = ptr_is_owned(orig);
64868         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64869         orig_conv.is_owned = false;
64870         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
64871         int64_t ret_ref = 0;
64872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64874         return ret_ref;
64875 }
64876
64877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64878         LDKHTLCOutputInCommitment a_conv;
64879         a_conv.inner = untag_ptr(a);
64880         a_conv.is_owned = ptr_is_owned(a);
64881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64882         a_conv.is_owned = false;
64883         LDKHTLCOutputInCommitment b_conv;
64884         b_conv.inner = untag_ptr(b);
64885         b_conv.is_owned = ptr_is_owned(b);
64886         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64887         b_conv.is_owned = false;
64888         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
64889         return ret_conv;
64890 }
64891
64892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
64893         LDKHTLCOutputInCommitment obj_conv;
64894         obj_conv.inner = untag_ptr(obj);
64895         obj_conv.is_owned = ptr_is_owned(obj);
64896         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64897         obj_conv.is_owned = false;
64898         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
64899         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64900         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64901         CVec_u8Z_free(ret_var);
64902         return ret_arr;
64903 }
64904
64905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64906         LDKu8slice ser_ref;
64907         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64908         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64909         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
64910         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
64911         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64912         return tag_ptr(ret_conv, true);
64913 }
64914
64915 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) {
64916         LDKHTLCOutputInCommitment htlc_conv;
64917         htlc_conv.inner = untag_ptr(htlc);
64918         htlc_conv.is_owned = ptr_is_owned(htlc);
64919         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
64920         htlc_conv.is_owned = false;
64921         LDKChannelTypeFeatures channel_type_features_conv;
64922         channel_type_features_conv.inner = untag_ptr(channel_type_features);
64923         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
64924         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
64925         channel_type_features_conv.is_owned = false;
64926         LDKTxCreationKeys keys_conv;
64927         keys_conv.inner = untag_ptr(keys);
64928         keys_conv.is_owned = ptr_is_owned(keys);
64929         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
64930         keys_conv.is_owned = false;
64931         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
64932         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64933         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64934         CVec_u8Z_free(ret_var);
64935         return ret_arr;
64936 }
64937
64938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
64939         LDKPublicKey broadcaster_ref;
64940         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
64941         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
64942         LDKPublicKey countersignatory_ref;
64943         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
64944         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
64945         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
64946         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64947         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64948         CVec_u8Z_free(ret_var);
64949         return ret_arr;
64950 }
64951
64952 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, int64_t broadcaster_delayed_payment_key, int64_t revocation_key) {
64953         uint8_t commitment_txid_arr[32];
64954         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
64955         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
64956         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
64957         LDKHTLCOutputInCommitment htlc_conv;
64958         htlc_conv.inner = untag_ptr(htlc);
64959         htlc_conv.is_owned = ptr_is_owned(htlc);
64960         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
64961         htlc_conv.is_owned = false;
64962         LDKChannelTypeFeatures channel_type_features_conv;
64963         channel_type_features_conv.inner = untag_ptr(channel_type_features);
64964         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
64965         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
64966         channel_type_features_conv.is_owned = false;
64967         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
64968         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
64969         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
64970         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
64971         broadcaster_delayed_payment_key_conv.is_owned = false;
64972         LDKRevocationKey revocation_key_conv;
64973         revocation_key_conv.inner = untag_ptr(revocation_key);
64974         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
64975         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
64976         revocation_key_conv.is_owned = false;
64977         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, &broadcaster_delayed_payment_key_conv, &revocation_key_conv);
64978         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64979         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64980         Transaction_free(ret_var);
64981         return ret_arr;
64982 }
64983
64984 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) {
64985         LDKECDSASignature local_sig_ref;
64986         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
64987         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
64988         LDKECDSASignature remote_sig_ref;
64989         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
64990         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
64991         void* preimage_ptr = untag_ptr(preimage);
64992         CHECK_ACCESS(preimage_ptr);
64993         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
64994         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
64995         LDKu8slice redeem_script_ref;
64996         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
64997         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
64998         LDKChannelTypeFeatures channel_type_features_conv;
64999         channel_type_features_conv.inner = untag_ptr(channel_type_features);
65000         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
65001         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
65002         channel_type_features_conv.is_owned = false;
65003         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
65004         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65005         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65006         Witness_free(ret_var);
65007         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
65008         return ret_arr;
65009 }
65010
65011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
65012         LDKPublicKey payment_point_ref;
65013         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
65014         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
65015         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
65016         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65017         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65018         CVec_u8Z_free(ret_var);
65019         return ret_arr;
65020 }
65021
65022 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
65023         LDKPublicKey funding_pubkey_ref;
65024         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
65025         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
65026         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
65027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65029         CVec_u8Z_free(ret_var);
65030         return ret_arr;
65031 }
65032
65033 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) {
65034         LDKPublicKey funding_key_ref;
65035         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
65036         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
65037         LDKECDSASignature funding_sig_ref;
65038         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
65039         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
65040         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
65041         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65042         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65043         Witness_free(ret_var);
65044         return ret_arr;
65045 }
65046
65047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65048         LDKChannelTransactionParameters this_obj_conv;
65049         this_obj_conv.inner = untag_ptr(this_obj);
65050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65052         ChannelTransactionParameters_free(this_obj_conv);
65053 }
65054
65055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
65056         LDKChannelTransactionParameters this_ptr_conv;
65057         this_ptr_conv.inner = untag_ptr(this_ptr);
65058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65060         this_ptr_conv.is_owned = false;
65061         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
65062         int64_t ret_ref = 0;
65063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65065         return ret_ref;
65066 }
65067
65068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65069         LDKChannelTransactionParameters this_ptr_conv;
65070         this_ptr_conv.inner = untag_ptr(this_ptr);
65071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65073         this_ptr_conv.is_owned = false;
65074         LDKChannelPublicKeys val_conv;
65075         val_conv.inner = untag_ptr(val);
65076         val_conv.is_owned = ptr_is_owned(val);
65077         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65078         val_conv = ChannelPublicKeys_clone(&val_conv);
65079         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
65080 }
65081
65082 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
65083         LDKChannelTransactionParameters this_ptr_conv;
65084         this_ptr_conv.inner = untag_ptr(this_ptr);
65085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65087         this_ptr_conv.is_owned = false;
65088         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
65089         return ret_conv;
65090 }
65091
65092 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) {
65093         LDKChannelTransactionParameters this_ptr_conv;
65094         this_ptr_conv.inner = untag_ptr(this_ptr);
65095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65097         this_ptr_conv.is_owned = false;
65098         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
65099 }
65100
65101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
65102         LDKChannelTransactionParameters this_ptr_conv;
65103         this_ptr_conv.inner = untag_ptr(this_ptr);
65104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65106         this_ptr_conv.is_owned = false;
65107         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
65108         return ret_conv;
65109 }
65110
65111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
65112         LDKChannelTransactionParameters this_ptr_conv;
65113         this_ptr_conv.inner = untag_ptr(this_ptr);
65114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65116         this_ptr_conv.is_owned = false;
65117         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
65118 }
65119
65120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
65121         LDKChannelTransactionParameters this_ptr_conv;
65122         this_ptr_conv.inner = untag_ptr(this_ptr);
65123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65125         this_ptr_conv.is_owned = false;
65126         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
65127         int64_t ret_ref = 0;
65128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65130         return ret_ref;
65131 }
65132
65133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65134         LDKChannelTransactionParameters this_ptr_conv;
65135         this_ptr_conv.inner = untag_ptr(this_ptr);
65136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65138         this_ptr_conv.is_owned = false;
65139         LDKCounterpartyChannelTransactionParameters val_conv;
65140         val_conv.inner = untag_ptr(val);
65141         val_conv.is_owned = ptr_is_owned(val);
65142         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65143         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
65144         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
65145 }
65146
65147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
65148         LDKChannelTransactionParameters this_ptr_conv;
65149         this_ptr_conv.inner = untag_ptr(this_ptr);
65150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65152         this_ptr_conv.is_owned = false;
65153         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
65154         int64_t ret_ref = 0;
65155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65157         return ret_ref;
65158 }
65159
65160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65161         LDKChannelTransactionParameters this_ptr_conv;
65162         this_ptr_conv.inner = untag_ptr(this_ptr);
65163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65165         this_ptr_conv.is_owned = false;
65166         LDKOutPoint val_conv;
65167         val_conv.inner = untag_ptr(val);
65168         val_conv.is_owned = ptr_is_owned(val);
65169         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65170         val_conv = OutPoint_clone(&val_conv);
65171         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
65172 }
65173
65174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
65175         LDKChannelTransactionParameters this_ptr_conv;
65176         this_ptr_conv.inner = untag_ptr(this_ptr);
65177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65179         this_ptr_conv.is_owned = false;
65180         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
65181         int64_t ret_ref = 0;
65182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65184         return ret_ref;
65185 }
65186
65187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65188         LDKChannelTransactionParameters this_ptr_conv;
65189         this_ptr_conv.inner = untag_ptr(this_ptr);
65190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65192         this_ptr_conv.is_owned = false;
65193         LDKChannelTypeFeatures val_conv;
65194         val_conv.inner = untag_ptr(val);
65195         val_conv.is_owned = ptr_is_owned(val);
65196         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65197         val_conv = ChannelTypeFeatures_clone(&val_conv);
65198         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
65199 }
65200
65201 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) {
65202         LDKChannelPublicKeys holder_pubkeys_arg_conv;
65203         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
65204         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
65205         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
65206         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
65207         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
65208         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
65209         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
65210         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
65211         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
65212         LDKOutPoint funding_outpoint_arg_conv;
65213         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
65214         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
65215         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
65216         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
65217         LDKChannelTypeFeatures channel_type_features_arg_conv;
65218         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
65219         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
65220         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
65221         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
65222         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);
65223         int64_t ret_ref = 0;
65224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65226         return ret_ref;
65227 }
65228
65229 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
65230         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
65231         int64_t ret_ref = 0;
65232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65234         return ret_ref;
65235 }
65236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65237         LDKChannelTransactionParameters arg_conv;
65238         arg_conv.inner = untag_ptr(arg);
65239         arg_conv.is_owned = ptr_is_owned(arg);
65240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65241         arg_conv.is_owned = false;
65242         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
65243         return ret_conv;
65244 }
65245
65246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65247         LDKChannelTransactionParameters orig_conv;
65248         orig_conv.inner = untag_ptr(orig);
65249         orig_conv.is_owned = ptr_is_owned(orig);
65250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65251         orig_conv.is_owned = false;
65252         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
65253         int64_t ret_ref = 0;
65254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65256         return ret_ref;
65257 }
65258
65259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
65260         LDKChannelTransactionParameters o_conv;
65261         o_conv.inner = untag_ptr(o);
65262         o_conv.is_owned = ptr_is_owned(o);
65263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65264         o_conv.is_owned = false;
65265         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
65266         return ret_conv;
65267 }
65268
65269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65270         LDKChannelTransactionParameters a_conv;
65271         a_conv.inner = untag_ptr(a);
65272         a_conv.is_owned = ptr_is_owned(a);
65273         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65274         a_conv.is_owned = false;
65275         LDKChannelTransactionParameters b_conv;
65276         b_conv.inner = untag_ptr(b);
65277         b_conv.is_owned = ptr_is_owned(b);
65278         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65279         b_conv.is_owned = false;
65280         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
65281         return ret_conv;
65282 }
65283
65284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65285         LDKCounterpartyChannelTransactionParameters this_obj_conv;
65286         this_obj_conv.inner = untag_ptr(this_obj);
65287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65289         CounterpartyChannelTransactionParameters_free(this_obj_conv);
65290 }
65291
65292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
65293         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
65294         this_ptr_conv.inner = untag_ptr(this_ptr);
65295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65297         this_ptr_conv.is_owned = false;
65298         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
65299         int64_t ret_ref = 0;
65300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65302         return ret_ref;
65303 }
65304
65305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65306         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
65307         this_ptr_conv.inner = untag_ptr(this_ptr);
65308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65310         this_ptr_conv.is_owned = false;
65311         LDKChannelPublicKeys val_conv;
65312         val_conv.inner = untag_ptr(val);
65313         val_conv.is_owned = ptr_is_owned(val);
65314         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65315         val_conv = ChannelPublicKeys_clone(&val_conv);
65316         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
65317 }
65318
65319 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
65320         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
65321         this_ptr_conv.inner = untag_ptr(this_ptr);
65322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65324         this_ptr_conv.is_owned = false;
65325         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
65326         return ret_conv;
65327 }
65328
65329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65330         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
65331         this_ptr_conv.inner = untag_ptr(this_ptr);
65332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65334         this_ptr_conv.is_owned = false;
65335         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
65336 }
65337
65338 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) {
65339         LDKChannelPublicKeys pubkeys_arg_conv;
65340         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
65341         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
65342         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
65343         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
65344         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
65345         int64_t ret_ref = 0;
65346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65348         return ret_ref;
65349 }
65350
65351 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
65352         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
65353         int64_t ret_ref = 0;
65354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65356         return ret_ref;
65357 }
65358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65359         LDKCounterpartyChannelTransactionParameters arg_conv;
65360         arg_conv.inner = untag_ptr(arg);
65361         arg_conv.is_owned = ptr_is_owned(arg);
65362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65363         arg_conv.is_owned = false;
65364         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
65365         return ret_conv;
65366 }
65367
65368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65369         LDKCounterpartyChannelTransactionParameters orig_conv;
65370         orig_conv.inner = untag_ptr(orig);
65371         orig_conv.is_owned = ptr_is_owned(orig);
65372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65373         orig_conv.is_owned = false;
65374         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
65375         int64_t ret_ref = 0;
65376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65378         return ret_ref;
65379 }
65380
65381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
65382         LDKCounterpartyChannelTransactionParameters o_conv;
65383         o_conv.inner = untag_ptr(o);
65384         o_conv.is_owned = ptr_is_owned(o);
65385         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65386         o_conv.is_owned = false;
65387         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
65388         return ret_conv;
65389 }
65390
65391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65392         LDKCounterpartyChannelTransactionParameters a_conv;
65393         a_conv.inner = untag_ptr(a);
65394         a_conv.is_owned = ptr_is_owned(a);
65395         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65396         a_conv.is_owned = false;
65397         LDKCounterpartyChannelTransactionParameters b_conv;
65398         b_conv.inner = untag_ptr(b);
65399         b_conv.is_owned = ptr_is_owned(b);
65400         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65401         b_conv.is_owned = false;
65402         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
65403         return ret_conv;
65404 }
65405
65406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
65407         LDKChannelTransactionParameters this_arg_conv;
65408         this_arg_conv.inner = untag_ptr(this_arg);
65409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65411         this_arg_conv.is_owned = false;
65412         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
65413         return ret_conv;
65414 }
65415
65416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
65417         LDKChannelTransactionParameters this_arg_conv;
65418         this_arg_conv.inner = untag_ptr(this_arg);
65419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65421         this_arg_conv.is_owned = false;
65422         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
65423         int64_t ret_ref = 0;
65424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65426         return ret_ref;
65427 }
65428
65429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
65430         LDKChannelTransactionParameters this_arg_conv;
65431         this_arg_conv.inner = untag_ptr(this_arg);
65432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65434         this_arg_conv.is_owned = false;
65435         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
65436         int64_t ret_ref = 0;
65437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65439         return ret_ref;
65440 }
65441
65442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
65443         LDKCounterpartyChannelTransactionParameters obj_conv;
65444         obj_conv.inner = untag_ptr(obj);
65445         obj_conv.is_owned = ptr_is_owned(obj);
65446         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65447         obj_conv.is_owned = false;
65448         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
65449         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65450         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65451         CVec_u8Z_free(ret_var);
65452         return ret_arr;
65453 }
65454
65455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65456         LDKu8slice ser_ref;
65457         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65458         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65459         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
65460         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
65461         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65462         return tag_ptr(ret_conv, true);
65463 }
65464
65465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
65466         LDKChannelTransactionParameters obj_conv;
65467         obj_conv.inner = untag_ptr(obj);
65468         obj_conv.is_owned = ptr_is_owned(obj);
65469         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65470         obj_conv.is_owned = false;
65471         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
65472         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65473         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65474         CVec_u8Z_free(ret_var);
65475         return ret_arr;
65476 }
65477
65478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65479         LDKu8slice ser_ref;
65480         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65481         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65482         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
65483         *ret_conv = ChannelTransactionParameters_read(ser_ref);
65484         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65485         return tag_ptr(ret_conv, true);
65486 }
65487
65488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65489         LDKDirectedChannelTransactionParameters 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         DirectedChannelTransactionParameters_free(this_obj_conv);
65494 }
65495
65496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
65497         LDKDirectedChannelTransactionParameters this_arg_conv;
65498         this_arg_conv.inner = untag_ptr(this_arg);
65499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65501         this_arg_conv.is_owned = false;
65502         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
65503         int64_t ret_ref = 0;
65504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65506         return ret_ref;
65507 }
65508
65509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
65510         LDKDirectedChannelTransactionParameters this_arg_conv;
65511         this_arg_conv.inner = untag_ptr(this_arg);
65512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65514         this_arg_conv.is_owned = false;
65515         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
65516         int64_t ret_ref = 0;
65517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65519         return ret_ref;
65520 }
65521
65522 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
65523         LDKDirectedChannelTransactionParameters this_arg_conv;
65524         this_arg_conv.inner = untag_ptr(this_arg);
65525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65527         this_arg_conv.is_owned = false;
65528         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
65529         return ret_conv;
65530 }
65531
65532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
65533         LDKDirectedChannelTransactionParameters this_arg_conv;
65534         this_arg_conv.inner = untag_ptr(this_arg);
65535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65537         this_arg_conv.is_owned = false;
65538         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
65539         return ret_conv;
65540 }
65541
65542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
65543         LDKDirectedChannelTransactionParameters this_arg_conv;
65544         this_arg_conv.inner = untag_ptr(this_arg);
65545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65547         this_arg_conv.is_owned = false;
65548         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
65549         int64_t ret_ref = 0;
65550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65552         return ret_ref;
65553 }
65554
65555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65556         LDKDirectedChannelTransactionParameters this_arg_conv;
65557         this_arg_conv.inner = untag_ptr(this_arg);
65558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65560         this_arg_conv.is_owned = false;
65561         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
65562         int64_t ret_ref = 0;
65563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65565         return ret_ref;
65566 }
65567
65568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65569         LDKHolderCommitmentTransaction this_obj_conv;
65570         this_obj_conv.inner = untag_ptr(this_obj);
65571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65573         HolderCommitmentTransaction_free(this_obj_conv);
65574 }
65575
65576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
65577         LDKHolderCommitmentTransaction this_ptr_conv;
65578         this_ptr_conv.inner = untag_ptr(this_ptr);
65579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65581         this_ptr_conv.is_owned = false;
65582         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
65583         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
65584         return ret_arr;
65585 }
65586
65587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65588         LDKHolderCommitmentTransaction this_ptr_conv;
65589         this_ptr_conv.inner = untag_ptr(this_ptr);
65590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65592         this_ptr_conv.is_owned = false;
65593         LDKECDSASignature val_ref;
65594         CHECK((*env)->GetArrayLength(env, val) == 64);
65595         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
65596         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
65597 }
65598
65599 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
65600         LDKHolderCommitmentTransaction this_ptr_conv;
65601         this_ptr_conv.inner = untag_ptr(this_ptr);
65602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65604         this_ptr_conv.is_owned = false;
65605         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
65606         jobjectArray ret_arr = NULL;
65607         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
65608         ;
65609         for (size_t i = 0; i < ret_var.datalen; i++) {
65610                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
65611                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
65612                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
65613         }
65614         
65615         FREE(ret_var.data);
65616         return ret_arr;
65617 }
65618
65619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
65620         LDKHolderCommitmentTransaction this_ptr_conv;
65621         this_ptr_conv.inner = untag_ptr(this_ptr);
65622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65624         this_ptr_conv.is_owned = false;
65625         LDKCVec_ECDSASignatureZ val_constr;
65626         val_constr.datalen = (*env)->GetArrayLength(env, val);
65627         if (val_constr.datalen > 0)
65628                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
65629         else
65630                 val_constr.data = NULL;
65631         for (size_t i = 0; i < val_constr.datalen; i++) {
65632                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
65633                 LDKECDSASignature val_conv_8_ref;
65634                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
65635                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
65636                 val_constr.data[i] = val_conv_8_ref;
65637         }
65638         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
65639 }
65640
65641 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
65642         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
65643         int64_t ret_ref = 0;
65644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65646         return ret_ref;
65647 }
65648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65649         LDKHolderCommitmentTransaction arg_conv;
65650         arg_conv.inner = untag_ptr(arg);
65651         arg_conv.is_owned = ptr_is_owned(arg);
65652         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65653         arg_conv.is_owned = false;
65654         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
65655         return ret_conv;
65656 }
65657
65658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65659         LDKHolderCommitmentTransaction orig_conv;
65660         orig_conv.inner = untag_ptr(orig);
65661         orig_conv.is_owned = ptr_is_owned(orig);
65662         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65663         orig_conv.is_owned = false;
65664         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
65665         int64_t ret_ref = 0;
65666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65668         return ret_ref;
65669 }
65670
65671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
65672         LDKHolderCommitmentTransaction obj_conv;
65673         obj_conv.inner = untag_ptr(obj);
65674         obj_conv.is_owned = ptr_is_owned(obj);
65675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65676         obj_conv.is_owned = false;
65677         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
65678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65680         CVec_u8Z_free(ret_var);
65681         return ret_arr;
65682 }
65683
65684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65685         LDKu8slice ser_ref;
65686         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65687         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65688         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
65689         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
65690         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65691         return tag_ptr(ret_conv, true);
65692 }
65693
65694 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) {
65695         LDKCommitmentTransaction commitment_tx_conv;
65696         commitment_tx_conv.inner = untag_ptr(commitment_tx);
65697         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
65698         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
65699         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
65700         LDKECDSASignature counterparty_sig_ref;
65701         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
65702         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
65703         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
65704         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
65705         if (counterparty_htlc_sigs_constr.datalen > 0)
65706                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
65707         else
65708                 counterparty_htlc_sigs_constr.data = NULL;
65709         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
65710                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
65711                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
65712                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
65713                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
65714                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
65715         }
65716         LDKPublicKey holder_funding_key_ref;
65717         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
65718         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
65719         LDKPublicKey counterparty_funding_key_ref;
65720         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
65721         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
65722         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
65723         int64_t ret_ref = 0;
65724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65726         return ret_ref;
65727 }
65728
65729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65730         LDKBuiltCommitmentTransaction this_obj_conv;
65731         this_obj_conv.inner = untag_ptr(this_obj);
65732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65734         BuiltCommitmentTransaction_free(this_obj_conv);
65735 }
65736
65737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
65738         LDKBuiltCommitmentTransaction 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         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
65744         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65745         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65746         Transaction_free(ret_var);
65747         return ret_arr;
65748 }
65749
65750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65751         LDKBuiltCommitmentTransaction this_ptr_conv;
65752         this_ptr_conv.inner = untag_ptr(this_ptr);
65753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65755         this_ptr_conv.is_owned = false;
65756         LDKTransaction val_ref;
65757         val_ref.datalen = (*env)->GetArrayLength(env, val);
65758         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
65759         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
65760         val_ref.data_is_owned = true;
65761         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
65762 }
65763
65764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
65765         LDKBuiltCommitmentTransaction this_ptr_conv;
65766         this_ptr_conv.inner = untag_ptr(this_ptr);
65767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65769         this_ptr_conv.is_owned = false;
65770         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65771         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
65772         return ret_arr;
65773 }
65774
65775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65776         LDKBuiltCommitmentTransaction 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         LDKThirtyTwoBytes val_ref;
65782         CHECK((*env)->GetArrayLength(env, val) == 32);
65783         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
65784         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
65785 }
65786
65787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
65788         LDKTransaction transaction_arg_ref;
65789         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
65790         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
65791         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
65792         transaction_arg_ref.data_is_owned = true;
65793         LDKThirtyTwoBytes txid_arg_ref;
65794         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
65795         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
65796         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
65797         int64_t ret_ref = 0;
65798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65800         return ret_ref;
65801 }
65802
65803 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
65804         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
65805         int64_t ret_ref = 0;
65806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65808         return ret_ref;
65809 }
65810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65811         LDKBuiltCommitmentTransaction arg_conv;
65812         arg_conv.inner = untag_ptr(arg);
65813         arg_conv.is_owned = ptr_is_owned(arg);
65814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65815         arg_conv.is_owned = false;
65816         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
65817         return ret_conv;
65818 }
65819
65820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65821         LDKBuiltCommitmentTransaction orig_conv;
65822         orig_conv.inner = untag_ptr(orig);
65823         orig_conv.is_owned = ptr_is_owned(orig);
65824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65825         orig_conv.is_owned = false;
65826         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
65827         int64_t ret_ref = 0;
65828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65830         return ret_ref;
65831 }
65832
65833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
65834         LDKBuiltCommitmentTransaction obj_conv;
65835         obj_conv.inner = untag_ptr(obj);
65836         obj_conv.is_owned = ptr_is_owned(obj);
65837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65838         obj_conv.is_owned = false;
65839         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
65840         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65841         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65842         CVec_u8Z_free(ret_var);
65843         return ret_arr;
65844 }
65845
65846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65847         LDKu8slice ser_ref;
65848         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65849         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65850         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
65851         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
65852         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65853         return tag_ptr(ret_conv, true);
65854 }
65855
65856 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) {
65857         LDKBuiltCommitmentTransaction this_arg_conv;
65858         this_arg_conv.inner = untag_ptr(this_arg);
65859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65861         this_arg_conv.is_owned = false;
65862         LDKu8slice funding_redeemscript_ref;
65863         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
65864         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
65865         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65866         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
65867         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
65868         return ret_arr;
65869 }
65870
65871 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) {
65872         LDKBuiltCommitmentTransaction this_arg_conv;
65873         this_arg_conv.inner = untag_ptr(this_arg);
65874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65876         this_arg_conv.is_owned = false;
65877         uint8_t funding_key_arr[32];
65878         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
65879         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
65880         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
65881         LDKu8slice funding_redeemscript_ref;
65882         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
65883         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
65884         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
65885         (*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);
65886         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
65887         return ret_arr;
65888 }
65889
65890 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) {
65891         LDKBuiltCommitmentTransaction this_arg_conv;
65892         this_arg_conv.inner = untag_ptr(this_arg);
65893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65895         this_arg_conv.is_owned = false;
65896         uint8_t funding_key_arr[32];
65897         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
65898         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
65899         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
65900         LDKu8slice funding_redeemscript_ref;
65901         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
65902         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
65903         void* entropy_source_ptr = untag_ptr(entropy_source);
65904         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
65905         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
65906         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
65907         (*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);
65908         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
65909         return ret_arr;
65910 }
65911
65912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65913         LDKClosingTransaction this_obj_conv;
65914         this_obj_conv.inner = untag_ptr(this_obj);
65915         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65917         ClosingTransaction_free(this_obj_conv);
65918 }
65919
65920 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
65921         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
65922         int64_t ret_ref = 0;
65923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65925         return ret_ref;
65926 }
65927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65928         LDKClosingTransaction arg_conv;
65929         arg_conv.inner = untag_ptr(arg);
65930         arg_conv.is_owned = ptr_is_owned(arg);
65931         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65932         arg_conv.is_owned = false;
65933         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
65934         return ret_conv;
65935 }
65936
65937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65938         LDKClosingTransaction orig_conv;
65939         orig_conv.inner = untag_ptr(orig);
65940         orig_conv.is_owned = ptr_is_owned(orig);
65941         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65942         orig_conv.is_owned = false;
65943         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
65944         int64_t ret_ref = 0;
65945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65947         return ret_ref;
65948 }
65949
65950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
65951         LDKClosingTransaction o_conv;
65952         o_conv.inner = untag_ptr(o);
65953         o_conv.is_owned = ptr_is_owned(o);
65954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65955         o_conv.is_owned = false;
65956         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
65957         return ret_conv;
65958 }
65959
65960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65961         LDKClosingTransaction a_conv;
65962         a_conv.inner = untag_ptr(a);
65963         a_conv.is_owned = ptr_is_owned(a);
65964         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65965         a_conv.is_owned = false;
65966         LDKClosingTransaction b_conv;
65967         b_conv.inner = untag_ptr(b);
65968         b_conv.is_owned = ptr_is_owned(b);
65969         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65970         b_conv.is_owned = false;
65971         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
65972         return ret_conv;
65973 }
65974
65975 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) {
65976         LDKCVec_u8Z to_holder_script_ref;
65977         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
65978         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
65979         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
65980         LDKCVec_u8Z to_counterparty_script_ref;
65981         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
65982         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
65983         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
65984         LDKOutPoint funding_outpoint_conv;
65985         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
65986         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
65987         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
65988         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
65989         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
65990         int64_t ret_ref = 0;
65991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65993         return ret_ref;
65994 }
65995
65996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
65997         LDKClosingTransaction this_arg_conv;
65998         this_arg_conv.inner = untag_ptr(this_arg);
65999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66001         this_arg_conv.is_owned = false;
66002         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
66003         int64_t ret_ref = 0;
66004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66006         return ret_ref;
66007 }
66008
66009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
66010         LDKClosingTransaction this_arg_conv;
66011         this_arg_conv.inner = untag_ptr(this_arg);
66012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66014         this_arg_conv.is_owned = false;
66015         LDKOutPoint funding_outpoint_conv;
66016         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
66017         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
66018         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
66019         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
66020         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
66021         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
66022         return tag_ptr(ret_conv, true);
66023 }
66024
66025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
66026         LDKClosingTransaction this_arg_conv;
66027         this_arg_conv.inner = untag_ptr(this_arg);
66028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66030         this_arg_conv.is_owned = false;
66031         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
66032         return ret_conv;
66033 }
66034
66035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
66036         LDKClosingTransaction this_arg_conv;
66037         this_arg_conv.inner = untag_ptr(this_arg);
66038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66040         this_arg_conv.is_owned = false;
66041         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
66042         return ret_conv;
66043 }
66044
66045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66046         LDKClosingTransaction this_arg_conv;
66047         this_arg_conv.inner = untag_ptr(this_arg);
66048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66050         this_arg_conv.is_owned = false;
66051         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
66052         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66053         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66054         return ret_arr;
66055 }
66056
66057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66058         LDKClosingTransaction this_arg_conv;
66059         this_arg_conv.inner = untag_ptr(this_arg);
66060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66062         this_arg_conv.is_owned = false;
66063         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
66064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66066         return ret_arr;
66067 }
66068
66069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66070         LDKTrustedClosingTransaction this_obj_conv;
66071         this_obj_conv.inner = untag_ptr(this_obj);
66072         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66074         TrustedClosingTransaction_free(this_obj_conv);
66075 }
66076
66077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
66078         LDKTrustedClosingTransaction this_arg_conv;
66079         this_arg_conv.inner = untag_ptr(this_arg);
66080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66082         this_arg_conv.is_owned = false;
66083         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
66084         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66085         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66086         Transaction_free(ret_var);
66087         return ret_arr;
66088 }
66089
66090 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) {
66091         LDKTrustedClosingTransaction this_arg_conv;
66092         this_arg_conv.inner = untag_ptr(this_arg);
66093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66095         this_arg_conv.is_owned = false;
66096         LDKu8slice funding_redeemscript_ref;
66097         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
66098         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
66099         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66100         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
66101         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
66102         return ret_arr;
66103 }
66104
66105 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) {
66106         LDKTrustedClosingTransaction this_arg_conv;
66107         this_arg_conv.inner = untag_ptr(this_arg);
66108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66110         this_arg_conv.is_owned = false;
66111         uint8_t funding_key_arr[32];
66112         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
66113         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
66114         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
66115         LDKu8slice funding_redeemscript_ref;
66116         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
66117         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
66118         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
66119         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
66120         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
66121         return ret_arr;
66122 }
66123
66124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66125         LDKCommitmentTransaction this_obj_conv;
66126         this_obj_conv.inner = untag_ptr(this_obj);
66127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66129         CommitmentTransaction_free(this_obj_conv);
66130 }
66131
66132 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
66133         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
66134         int64_t ret_ref = 0;
66135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66137         return ret_ref;
66138 }
66139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66140         LDKCommitmentTransaction arg_conv;
66141         arg_conv.inner = untag_ptr(arg);
66142         arg_conv.is_owned = ptr_is_owned(arg);
66143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66144         arg_conv.is_owned = false;
66145         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
66146         return ret_conv;
66147 }
66148
66149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66150         LDKCommitmentTransaction orig_conv;
66151         orig_conv.inner = untag_ptr(orig);
66152         orig_conv.is_owned = ptr_is_owned(orig);
66153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66154         orig_conv.is_owned = false;
66155         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
66156         int64_t ret_ref = 0;
66157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66159         return ret_ref;
66160 }
66161
66162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
66163         LDKCommitmentTransaction obj_conv;
66164         obj_conv.inner = untag_ptr(obj);
66165         obj_conv.is_owned = ptr_is_owned(obj);
66166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66167         obj_conv.is_owned = false;
66168         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
66169         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66170         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66171         CVec_u8Z_free(ret_var);
66172         return ret_arr;
66173 }
66174
66175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66176         LDKu8slice ser_ref;
66177         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66178         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66179         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
66180         *ret_conv = CommitmentTransaction_read(ser_ref);
66181         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66182         return tag_ptr(ret_conv, true);
66183 }
66184
66185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
66186         LDKCommitmentTransaction this_arg_conv;
66187         this_arg_conv.inner = untag_ptr(this_arg);
66188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66190         this_arg_conv.is_owned = false;
66191         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
66192         return ret_conv;
66193 }
66194
66195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
66196         LDKCommitmentTransaction this_arg_conv;
66197         this_arg_conv.inner = untag_ptr(this_arg);
66198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66200         this_arg_conv.is_owned = false;
66201         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66202         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
66203         return ret_arr;
66204 }
66205
66206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
66207         LDKCommitmentTransaction this_arg_conv;
66208         this_arg_conv.inner = untag_ptr(this_arg);
66209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66211         this_arg_conv.is_owned = false;
66212         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
66213         return ret_conv;
66214 }
66215
66216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
66217         LDKCommitmentTransaction this_arg_conv;
66218         this_arg_conv.inner = untag_ptr(this_arg);
66219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66221         this_arg_conv.is_owned = false;
66222         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
66223         return ret_conv;
66224 }
66225
66226 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
66227         LDKCommitmentTransaction this_arg_conv;
66228         this_arg_conv.inner = untag_ptr(this_arg);
66229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66231         this_arg_conv.is_owned = false;
66232         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
66233         return ret_conv;
66234 }
66235
66236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
66237         LDKCommitmentTransaction this_arg_conv;
66238         this_arg_conv.inner = untag_ptr(this_arg);
66239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66241         this_arg_conv.is_owned = false;
66242         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
66243         int64_t ret_ref = 0;
66244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66246         return ret_ref;
66247 }
66248
66249 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) {
66250         LDKCommitmentTransaction this_arg_conv;
66251         this_arg_conv.inner = untag_ptr(this_arg);
66252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66254         this_arg_conv.is_owned = false;
66255         LDKDirectedChannelTransactionParameters channel_parameters_conv;
66256         channel_parameters_conv.inner = untag_ptr(channel_parameters);
66257         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
66258         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
66259         channel_parameters_conv.is_owned = false;
66260         LDKChannelPublicKeys broadcaster_keys_conv;
66261         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
66262         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
66263         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
66264         broadcaster_keys_conv.is_owned = false;
66265         LDKChannelPublicKeys countersignatory_keys_conv;
66266         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
66267         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
66268         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
66269         countersignatory_keys_conv.is_owned = false;
66270         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
66271         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
66272         return tag_ptr(ret_conv, true);
66273 }
66274
66275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66276         LDKTrustedCommitmentTransaction this_obj_conv;
66277         this_obj_conv.inner = untag_ptr(this_obj);
66278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66280         TrustedCommitmentTransaction_free(this_obj_conv);
66281 }
66282
66283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
66284         LDKTrustedCommitmentTransaction this_arg_conv;
66285         this_arg_conv.inner = untag_ptr(this_arg);
66286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66288         this_arg_conv.is_owned = false;
66289         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66290         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
66291         return ret_arr;
66292 }
66293
66294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
66295         LDKTrustedCommitmentTransaction this_arg_conv;
66296         this_arg_conv.inner = untag_ptr(this_arg);
66297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66299         this_arg_conv.is_owned = false;
66300         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
66301         int64_t ret_ref = 0;
66302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66304         return ret_ref;
66305 }
66306
66307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
66308         LDKTrustedCommitmentTransaction this_arg_conv;
66309         this_arg_conv.inner = untag_ptr(this_arg);
66310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66312         this_arg_conv.is_owned = false;
66313         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
66314         int64_t ret_ref = 0;
66315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66317         return ret_ref;
66318 }
66319
66320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66321         LDKTrustedCommitmentTransaction this_arg_conv;
66322         this_arg_conv.inner = untag_ptr(this_arg);
66323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66325         this_arg_conv.is_owned = false;
66326         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
66327         int64_t ret_ref = 0;
66328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66330         return ret_ref;
66331 }
66332
66333 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) {
66334         LDKTrustedCommitmentTransaction this_arg_conv;
66335         this_arg_conv.inner = untag_ptr(this_arg);
66336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66338         this_arg_conv.is_owned = false;
66339         uint8_t htlc_base_key_arr[32];
66340         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
66341         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
66342         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
66343         LDKDirectedChannelTransactionParameters channel_parameters_conv;
66344         channel_parameters_conv.inner = untag_ptr(channel_parameters);
66345         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
66346         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
66347         channel_parameters_conv.is_owned = false;
66348         void* entropy_source_ptr = untag_ptr(entropy_source);
66349         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
66350         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
66351         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
66352         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
66353         return tag_ptr(ret_conv, true);
66354 }
66355
66356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
66357         LDKTrustedCommitmentTransaction this_arg_conv;
66358         this_arg_conv.inner = untag_ptr(this_arg);
66359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66361         this_arg_conv.is_owned = false;
66362         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
66363         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
66364         int64_t ret_ref = tag_ptr(ret_copy, true);
66365         return ret_ref;
66366 }
66367
66368 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) {
66369         LDKTrustedCommitmentTransaction this_arg_conv;
66370         this_arg_conv.inner = untag_ptr(this_arg);
66371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66373         this_arg_conv.is_owned = false;
66374         LDKCVec_u8Z destination_script_ref;
66375         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
66376         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
66377         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
66378         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
66379         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
66380         return tag_ptr(ret_conv, true);
66381 }
66382
66383 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) {
66384         LDKPublicKey broadcaster_payment_basepoint_ref;
66385         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
66386         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
66387         LDKPublicKey countersignatory_payment_basepoint_ref;
66388         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
66389         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
66390         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
66391         return ret_conv;
66392 }
66393
66394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66395         LDKInitFeatures a_conv;
66396         a_conv.inner = untag_ptr(a);
66397         a_conv.is_owned = ptr_is_owned(a);
66398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66399         a_conv.is_owned = false;
66400         LDKInitFeatures b_conv;
66401         b_conv.inner = untag_ptr(b);
66402         b_conv.is_owned = ptr_is_owned(b);
66403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66404         b_conv.is_owned = false;
66405         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
66406         return ret_conv;
66407 }
66408
66409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66410         LDKNodeFeatures a_conv;
66411         a_conv.inner = untag_ptr(a);
66412         a_conv.is_owned = ptr_is_owned(a);
66413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66414         a_conv.is_owned = false;
66415         LDKNodeFeatures b_conv;
66416         b_conv.inner = untag_ptr(b);
66417         b_conv.is_owned = ptr_is_owned(b);
66418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66419         b_conv.is_owned = false;
66420         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
66421         return ret_conv;
66422 }
66423
66424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66425         LDKChannelFeatures a_conv;
66426         a_conv.inner = untag_ptr(a);
66427         a_conv.is_owned = ptr_is_owned(a);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66429         a_conv.is_owned = false;
66430         LDKChannelFeatures b_conv;
66431         b_conv.inner = untag_ptr(b);
66432         b_conv.is_owned = ptr_is_owned(b);
66433         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66434         b_conv.is_owned = false;
66435         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
66436         return ret_conv;
66437 }
66438
66439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66440         LDKBolt11InvoiceFeatures a_conv;
66441         a_conv.inner = untag_ptr(a);
66442         a_conv.is_owned = ptr_is_owned(a);
66443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66444         a_conv.is_owned = false;
66445         LDKBolt11InvoiceFeatures b_conv;
66446         b_conv.inner = untag_ptr(b);
66447         b_conv.is_owned = ptr_is_owned(b);
66448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66449         b_conv.is_owned = false;
66450         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
66451         return ret_conv;
66452 }
66453
66454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66455         LDKOfferFeatures a_conv;
66456         a_conv.inner = untag_ptr(a);
66457         a_conv.is_owned = ptr_is_owned(a);
66458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66459         a_conv.is_owned = false;
66460         LDKOfferFeatures b_conv;
66461         b_conv.inner = untag_ptr(b);
66462         b_conv.is_owned = ptr_is_owned(b);
66463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66464         b_conv.is_owned = false;
66465         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
66466         return ret_conv;
66467 }
66468
66469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66470         LDKInvoiceRequestFeatures a_conv;
66471         a_conv.inner = untag_ptr(a);
66472         a_conv.is_owned = ptr_is_owned(a);
66473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66474         a_conv.is_owned = false;
66475         LDKInvoiceRequestFeatures b_conv;
66476         b_conv.inner = untag_ptr(b);
66477         b_conv.is_owned = ptr_is_owned(b);
66478         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66479         b_conv.is_owned = false;
66480         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
66481         return ret_conv;
66482 }
66483
66484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66485         LDKBolt12InvoiceFeatures a_conv;
66486         a_conv.inner = untag_ptr(a);
66487         a_conv.is_owned = ptr_is_owned(a);
66488         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66489         a_conv.is_owned = false;
66490         LDKBolt12InvoiceFeatures b_conv;
66491         b_conv.inner = untag_ptr(b);
66492         b_conv.is_owned = ptr_is_owned(b);
66493         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66494         b_conv.is_owned = false;
66495         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
66496         return ret_conv;
66497 }
66498
66499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66500         LDKBlindedHopFeatures a_conv;
66501         a_conv.inner = untag_ptr(a);
66502         a_conv.is_owned = ptr_is_owned(a);
66503         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66504         a_conv.is_owned = false;
66505         LDKBlindedHopFeatures b_conv;
66506         b_conv.inner = untag_ptr(b);
66507         b_conv.is_owned = ptr_is_owned(b);
66508         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66509         b_conv.is_owned = false;
66510         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
66511         return ret_conv;
66512 }
66513
66514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66515         LDKChannelTypeFeatures a_conv;
66516         a_conv.inner = untag_ptr(a);
66517         a_conv.is_owned = ptr_is_owned(a);
66518         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66519         a_conv.is_owned = false;
66520         LDKChannelTypeFeatures b_conv;
66521         b_conv.inner = untag_ptr(b);
66522         b_conv.is_owned = ptr_is_owned(b);
66523         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66524         b_conv.is_owned = false;
66525         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
66526         return ret_conv;
66527 }
66528
66529 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
66530         LDKInitFeatures ret_var = InitFeatures_clone(arg);
66531         int64_t ret_ref = 0;
66532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66534         return ret_ref;
66535 }
66536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66537         LDKInitFeatures arg_conv;
66538         arg_conv.inner = untag_ptr(arg);
66539         arg_conv.is_owned = ptr_is_owned(arg);
66540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66541         arg_conv.is_owned = false;
66542         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
66543         return ret_conv;
66544 }
66545
66546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66547         LDKInitFeatures orig_conv;
66548         orig_conv.inner = untag_ptr(orig);
66549         orig_conv.is_owned = ptr_is_owned(orig);
66550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66551         orig_conv.is_owned = false;
66552         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
66553         int64_t ret_ref = 0;
66554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66556         return ret_ref;
66557 }
66558
66559 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
66560         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
66561         int64_t ret_ref = 0;
66562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66564         return ret_ref;
66565 }
66566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66567         LDKNodeFeatures arg_conv;
66568         arg_conv.inner = untag_ptr(arg);
66569         arg_conv.is_owned = ptr_is_owned(arg);
66570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66571         arg_conv.is_owned = false;
66572         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
66573         return ret_conv;
66574 }
66575
66576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66577         LDKNodeFeatures orig_conv;
66578         orig_conv.inner = untag_ptr(orig);
66579         orig_conv.is_owned = ptr_is_owned(orig);
66580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66581         orig_conv.is_owned = false;
66582         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
66583         int64_t ret_ref = 0;
66584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66586         return ret_ref;
66587 }
66588
66589 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
66590         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
66591         int64_t ret_ref = 0;
66592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66594         return ret_ref;
66595 }
66596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66597         LDKChannelFeatures arg_conv;
66598         arg_conv.inner = untag_ptr(arg);
66599         arg_conv.is_owned = ptr_is_owned(arg);
66600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66601         arg_conv.is_owned = false;
66602         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
66603         return ret_conv;
66604 }
66605
66606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66607         LDKChannelFeatures orig_conv;
66608         orig_conv.inner = untag_ptr(orig);
66609         orig_conv.is_owned = ptr_is_owned(orig);
66610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66611         orig_conv.is_owned = false;
66612         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
66613         int64_t ret_ref = 0;
66614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66616         return ret_ref;
66617 }
66618
66619 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
66620         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
66621         int64_t ret_ref = 0;
66622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66624         return ret_ref;
66625 }
66626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66627         LDKBolt11InvoiceFeatures arg_conv;
66628         arg_conv.inner = untag_ptr(arg);
66629         arg_conv.is_owned = ptr_is_owned(arg);
66630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66631         arg_conv.is_owned = false;
66632         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
66633         return ret_conv;
66634 }
66635
66636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66637         LDKBolt11InvoiceFeatures orig_conv;
66638         orig_conv.inner = untag_ptr(orig);
66639         orig_conv.is_owned = ptr_is_owned(orig);
66640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66641         orig_conv.is_owned = false;
66642         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
66643         int64_t ret_ref = 0;
66644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66646         return ret_ref;
66647 }
66648
66649 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
66650         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
66651         int64_t ret_ref = 0;
66652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66654         return ret_ref;
66655 }
66656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66657         LDKOfferFeatures arg_conv;
66658         arg_conv.inner = untag_ptr(arg);
66659         arg_conv.is_owned = ptr_is_owned(arg);
66660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66661         arg_conv.is_owned = false;
66662         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
66663         return ret_conv;
66664 }
66665
66666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66667         LDKOfferFeatures orig_conv;
66668         orig_conv.inner = untag_ptr(orig);
66669         orig_conv.is_owned = ptr_is_owned(orig);
66670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66671         orig_conv.is_owned = false;
66672         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
66673         int64_t ret_ref = 0;
66674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66676         return ret_ref;
66677 }
66678
66679 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
66680         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
66681         int64_t ret_ref = 0;
66682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66684         return ret_ref;
66685 }
66686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66687         LDKInvoiceRequestFeatures arg_conv;
66688         arg_conv.inner = untag_ptr(arg);
66689         arg_conv.is_owned = ptr_is_owned(arg);
66690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66691         arg_conv.is_owned = false;
66692         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
66693         return ret_conv;
66694 }
66695
66696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66697         LDKInvoiceRequestFeatures orig_conv;
66698         orig_conv.inner = untag_ptr(orig);
66699         orig_conv.is_owned = ptr_is_owned(orig);
66700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66701         orig_conv.is_owned = false;
66702         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
66703         int64_t ret_ref = 0;
66704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66706         return ret_ref;
66707 }
66708
66709 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
66710         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
66711         int64_t ret_ref = 0;
66712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66714         return ret_ref;
66715 }
66716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66717         LDKBolt12InvoiceFeatures arg_conv;
66718         arg_conv.inner = untag_ptr(arg);
66719         arg_conv.is_owned = ptr_is_owned(arg);
66720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66721         arg_conv.is_owned = false;
66722         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
66723         return ret_conv;
66724 }
66725
66726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66727         LDKBolt12InvoiceFeatures orig_conv;
66728         orig_conv.inner = untag_ptr(orig);
66729         orig_conv.is_owned = ptr_is_owned(orig);
66730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66731         orig_conv.is_owned = false;
66732         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
66733         int64_t ret_ref = 0;
66734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66736         return ret_ref;
66737 }
66738
66739 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
66740         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
66741         int64_t ret_ref = 0;
66742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66744         return ret_ref;
66745 }
66746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66747         LDKBlindedHopFeatures arg_conv;
66748         arg_conv.inner = untag_ptr(arg);
66749         arg_conv.is_owned = ptr_is_owned(arg);
66750         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66751         arg_conv.is_owned = false;
66752         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
66753         return ret_conv;
66754 }
66755
66756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66757         LDKBlindedHopFeatures orig_conv;
66758         orig_conv.inner = untag_ptr(orig);
66759         orig_conv.is_owned = ptr_is_owned(orig);
66760         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66761         orig_conv.is_owned = false;
66762         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
66763         int64_t ret_ref = 0;
66764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66766         return ret_ref;
66767 }
66768
66769 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
66770         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
66771         int64_t ret_ref = 0;
66772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66774         return ret_ref;
66775 }
66776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66777         LDKChannelTypeFeatures arg_conv;
66778         arg_conv.inner = untag_ptr(arg);
66779         arg_conv.is_owned = ptr_is_owned(arg);
66780         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66781         arg_conv.is_owned = false;
66782         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
66783         return ret_conv;
66784 }
66785
66786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66787         LDKChannelTypeFeatures orig_conv;
66788         orig_conv.inner = untag_ptr(orig);
66789         orig_conv.is_owned = ptr_is_owned(orig);
66790         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66791         orig_conv.is_owned = false;
66792         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
66793         int64_t ret_ref = 0;
66794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66796         return ret_ref;
66797 }
66798
66799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66800         LDKInitFeatures o_conv;
66801         o_conv.inner = untag_ptr(o);
66802         o_conv.is_owned = ptr_is_owned(o);
66803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66804         o_conv.is_owned = false;
66805         int64_t ret_conv = InitFeatures_hash(&o_conv);
66806         return ret_conv;
66807 }
66808
66809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66810         LDKNodeFeatures o_conv;
66811         o_conv.inner = untag_ptr(o);
66812         o_conv.is_owned = ptr_is_owned(o);
66813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66814         o_conv.is_owned = false;
66815         int64_t ret_conv = NodeFeatures_hash(&o_conv);
66816         return ret_conv;
66817 }
66818
66819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66820         LDKChannelFeatures o_conv;
66821         o_conv.inner = untag_ptr(o);
66822         o_conv.is_owned = ptr_is_owned(o);
66823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66824         o_conv.is_owned = false;
66825         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
66826         return ret_conv;
66827 }
66828
66829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66830         LDKBolt11InvoiceFeatures o_conv;
66831         o_conv.inner = untag_ptr(o);
66832         o_conv.is_owned = ptr_is_owned(o);
66833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66834         o_conv.is_owned = false;
66835         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
66836         return ret_conv;
66837 }
66838
66839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66840         LDKOfferFeatures o_conv;
66841         o_conv.inner = untag_ptr(o);
66842         o_conv.is_owned = ptr_is_owned(o);
66843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66844         o_conv.is_owned = false;
66845         int64_t ret_conv = OfferFeatures_hash(&o_conv);
66846         return ret_conv;
66847 }
66848
66849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66850         LDKInvoiceRequestFeatures o_conv;
66851         o_conv.inner = untag_ptr(o);
66852         o_conv.is_owned = ptr_is_owned(o);
66853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66854         o_conv.is_owned = false;
66855         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
66856         return ret_conv;
66857 }
66858
66859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66860         LDKBolt12InvoiceFeatures o_conv;
66861         o_conv.inner = untag_ptr(o);
66862         o_conv.is_owned = ptr_is_owned(o);
66863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66864         o_conv.is_owned = false;
66865         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
66866         return ret_conv;
66867 }
66868
66869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66870         LDKBlindedHopFeatures o_conv;
66871         o_conv.inner = untag_ptr(o);
66872         o_conv.is_owned = ptr_is_owned(o);
66873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66874         o_conv.is_owned = false;
66875         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
66876         return ret_conv;
66877 }
66878
66879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
66880         LDKChannelTypeFeatures o_conv;
66881         o_conv.inner = untag_ptr(o);
66882         o_conv.is_owned = ptr_is_owned(o);
66883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66884         o_conv.is_owned = false;
66885         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
66886         return ret_conv;
66887 }
66888
66889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66890         LDKInitFeatures this_obj_conv;
66891         this_obj_conv.inner = untag_ptr(this_obj);
66892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66894         InitFeatures_free(this_obj_conv);
66895 }
66896
66897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66898         LDKNodeFeatures this_obj_conv;
66899         this_obj_conv.inner = untag_ptr(this_obj);
66900         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66902         NodeFeatures_free(this_obj_conv);
66903 }
66904
66905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66906         LDKChannelFeatures this_obj_conv;
66907         this_obj_conv.inner = untag_ptr(this_obj);
66908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66910         ChannelFeatures_free(this_obj_conv);
66911 }
66912
66913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66914         LDKBolt11InvoiceFeatures this_obj_conv;
66915         this_obj_conv.inner = untag_ptr(this_obj);
66916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66918         Bolt11InvoiceFeatures_free(this_obj_conv);
66919 }
66920
66921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66922         LDKOfferFeatures this_obj_conv;
66923         this_obj_conv.inner = untag_ptr(this_obj);
66924         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66926         OfferFeatures_free(this_obj_conv);
66927 }
66928
66929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66930         LDKInvoiceRequestFeatures this_obj_conv;
66931         this_obj_conv.inner = untag_ptr(this_obj);
66932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66934         InvoiceRequestFeatures_free(this_obj_conv);
66935 }
66936
66937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66938         LDKBolt12InvoiceFeatures this_obj_conv;
66939         this_obj_conv.inner = untag_ptr(this_obj);
66940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66942         Bolt12InvoiceFeatures_free(this_obj_conv);
66943 }
66944
66945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66946         LDKBlindedHopFeatures this_obj_conv;
66947         this_obj_conv.inner = untag_ptr(this_obj);
66948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66950         BlindedHopFeatures_free(this_obj_conv);
66951 }
66952
66953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66954         LDKChannelTypeFeatures this_obj_conv;
66955         this_obj_conv.inner = untag_ptr(this_obj);
66956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66958         ChannelTypeFeatures_free(this_obj_conv);
66959 }
66960
66961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
66962         LDKInitFeatures ret_var = InitFeatures_empty();
66963         int64_t ret_ref = 0;
66964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66966         return ret_ref;
66967 }
66968
66969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66970         LDKInitFeatures this_arg_conv;
66971         this_arg_conv.inner = untag_ptr(this_arg);
66972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66974         this_arg_conv.is_owned = false;
66975         LDKInitFeatures other_conv;
66976         other_conv.inner = untag_ptr(other);
66977         other_conv.is_owned = ptr_is_owned(other);
66978         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66979         other_conv.is_owned = false;
66980         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66981         return ret_conv;
66982 }
66983
66984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66985         LDKInitFeatures this_arg_conv;
66986         this_arg_conv.inner = untag_ptr(this_arg);
66987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66989         this_arg_conv.is_owned = false;
66990         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
66991         return ret_conv;
66992 }
66993
66994 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) {
66995         LDKInitFeatures this_arg_conv;
66996         this_arg_conv.inner = untag_ptr(this_arg);
66997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66999         this_arg_conv.is_owned = false;
67000         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67001         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
67002         return tag_ptr(ret_conv, true);
67003 }
67004
67005 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) {
67006         LDKInitFeatures this_arg_conv;
67007         this_arg_conv.inner = untag_ptr(this_arg);
67008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67010         this_arg_conv.is_owned = false;
67011         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67012         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67013         return tag_ptr(ret_conv, true);
67014 }
67015
67016 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) {
67017         LDKInitFeatures this_arg_conv;
67018         this_arg_conv.inner = untag_ptr(this_arg);
67019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67021         this_arg_conv.is_owned = false;
67022         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67023         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
67024         return tag_ptr(ret_conv, true);
67025 }
67026
67027 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) {
67028         LDKInitFeatures this_arg_conv;
67029         this_arg_conv.inner = untag_ptr(this_arg);
67030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67032         this_arg_conv.is_owned = false;
67033         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67034         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67035         return tag_ptr(ret_conv, true);
67036 }
67037
67038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
67039         LDKNodeFeatures ret_var = NodeFeatures_empty();
67040         int64_t ret_ref = 0;
67041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67043         return ret_ref;
67044 }
67045
67046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67047         LDKNodeFeatures this_arg_conv;
67048         this_arg_conv.inner = untag_ptr(this_arg);
67049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67051         this_arg_conv.is_owned = false;
67052         LDKNodeFeatures other_conv;
67053         other_conv.inner = untag_ptr(other);
67054         other_conv.is_owned = ptr_is_owned(other);
67055         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67056         other_conv.is_owned = false;
67057         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67058         return ret_conv;
67059 }
67060
67061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67062         LDKNodeFeatures this_arg_conv;
67063         this_arg_conv.inner = untag_ptr(this_arg);
67064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67066         this_arg_conv.is_owned = false;
67067         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
67068         return ret_conv;
67069 }
67070
67071 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) {
67072         LDKNodeFeatures this_arg_conv;
67073         this_arg_conv.inner = untag_ptr(this_arg);
67074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67076         this_arg_conv.is_owned = false;
67077         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67078         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
67079         return tag_ptr(ret_conv, true);
67080 }
67081
67082 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) {
67083         LDKNodeFeatures this_arg_conv;
67084         this_arg_conv.inner = untag_ptr(this_arg);
67085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67087         this_arg_conv.is_owned = false;
67088         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67089         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67090         return tag_ptr(ret_conv, true);
67091 }
67092
67093 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) {
67094         LDKNodeFeatures this_arg_conv;
67095         this_arg_conv.inner = untag_ptr(this_arg);
67096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67098         this_arg_conv.is_owned = false;
67099         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67100         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
67101         return tag_ptr(ret_conv, true);
67102 }
67103
67104 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) {
67105         LDKNodeFeatures this_arg_conv;
67106         this_arg_conv.inner = untag_ptr(this_arg);
67107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67109         this_arg_conv.is_owned = false;
67110         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67111         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67112         return tag_ptr(ret_conv, true);
67113 }
67114
67115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
67116         LDKChannelFeatures ret_var = ChannelFeatures_empty();
67117         int64_t ret_ref = 0;
67118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67120         return ret_ref;
67121 }
67122
67123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67124         LDKChannelFeatures this_arg_conv;
67125         this_arg_conv.inner = untag_ptr(this_arg);
67126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67128         this_arg_conv.is_owned = false;
67129         LDKChannelFeatures other_conv;
67130         other_conv.inner = untag_ptr(other);
67131         other_conv.is_owned = ptr_is_owned(other);
67132         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67133         other_conv.is_owned = false;
67134         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67135         return ret_conv;
67136 }
67137
67138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67139         LDKChannelFeatures this_arg_conv;
67140         this_arg_conv.inner = untag_ptr(this_arg);
67141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67143         this_arg_conv.is_owned = false;
67144         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
67145         return ret_conv;
67146 }
67147
67148 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) {
67149         LDKChannelFeatures this_arg_conv;
67150         this_arg_conv.inner = untag_ptr(this_arg);
67151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67153         this_arg_conv.is_owned = false;
67154         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67155         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
67156         return tag_ptr(ret_conv, true);
67157 }
67158
67159 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) {
67160         LDKChannelFeatures this_arg_conv;
67161         this_arg_conv.inner = untag_ptr(this_arg);
67162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67164         this_arg_conv.is_owned = false;
67165         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67166         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67167         return tag_ptr(ret_conv, true);
67168 }
67169
67170 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) {
67171         LDKChannelFeatures this_arg_conv;
67172         this_arg_conv.inner = untag_ptr(this_arg);
67173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67175         this_arg_conv.is_owned = false;
67176         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67177         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
67178         return tag_ptr(ret_conv, true);
67179 }
67180
67181 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) {
67182         LDKChannelFeatures this_arg_conv;
67183         this_arg_conv.inner = untag_ptr(this_arg);
67184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67186         this_arg_conv.is_owned = false;
67187         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67188         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67189         return tag_ptr(ret_conv, true);
67190 }
67191
67192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
67193         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
67194         int64_t ret_ref = 0;
67195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67197         return ret_ref;
67198 }
67199
67200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67201         LDKBolt11InvoiceFeatures this_arg_conv;
67202         this_arg_conv.inner = untag_ptr(this_arg);
67203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67205         this_arg_conv.is_owned = false;
67206         LDKBolt11InvoiceFeatures other_conv;
67207         other_conv.inner = untag_ptr(other);
67208         other_conv.is_owned = ptr_is_owned(other);
67209         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67210         other_conv.is_owned = false;
67211         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67212         return ret_conv;
67213 }
67214
67215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67216         LDKBolt11InvoiceFeatures this_arg_conv;
67217         this_arg_conv.inner = untag_ptr(this_arg);
67218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67220         this_arg_conv.is_owned = false;
67221         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
67222         return ret_conv;
67223 }
67224
67225 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) {
67226         LDKBolt11InvoiceFeatures this_arg_conv;
67227         this_arg_conv.inner = untag_ptr(this_arg);
67228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67230         this_arg_conv.is_owned = false;
67231         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67232         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
67233         return tag_ptr(ret_conv, true);
67234 }
67235
67236 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) {
67237         LDKBolt11InvoiceFeatures this_arg_conv;
67238         this_arg_conv.inner = untag_ptr(this_arg);
67239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67241         this_arg_conv.is_owned = false;
67242         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67243         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67244         return tag_ptr(ret_conv, true);
67245 }
67246
67247 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) {
67248         LDKBolt11InvoiceFeatures this_arg_conv;
67249         this_arg_conv.inner = untag_ptr(this_arg);
67250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67252         this_arg_conv.is_owned = false;
67253         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67254         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
67255         return tag_ptr(ret_conv, true);
67256 }
67257
67258 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) {
67259         LDKBolt11InvoiceFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67265         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67266         return tag_ptr(ret_conv, true);
67267 }
67268
67269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
67270         LDKOfferFeatures ret_var = OfferFeatures_empty();
67271         int64_t ret_ref = 0;
67272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67274         return ret_ref;
67275 }
67276
67277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67278         LDKOfferFeatures this_arg_conv;
67279         this_arg_conv.inner = untag_ptr(this_arg);
67280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67282         this_arg_conv.is_owned = false;
67283         LDKOfferFeatures other_conv;
67284         other_conv.inner = untag_ptr(other);
67285         other_conv.is_owned = ptr_is_owned(other);
67286         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67287         other_conv.is_owned = false;
67288         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67289         return ret_conv;
67290 }
67291
67292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67293         LDKOfferFeatures this_arg_conv;
67294         this_arg_conv.inner = untag_ptr(this_arg);
67295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67297         this_arg_conv.is_owned = false;
67298         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
67299         return ret_conv;
67300 }
67301
67302 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) {
67303         LDKOfferFeatures this_arg_conv;
67304         this_arg_conv.inner = untag_ptr(this_arg);
67305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67307         this_arg_conv.is_owned = false;
67308         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67309         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
67310         return tag_ptr(ret_conv, true);
67311 }
67312
67313 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) {
67314         LDKOfferFeatures this_arg_conv;
67315         this_arg_conv.inner = untag_ptr(this_arg);
67316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67318         this_arg_conv.is_owned = false;
67319         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67320         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67321         return tag_ptr(ret_conv, true);
67322 }
67323
67324 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) {
67325         LDKOfferFeatures this_arg_conv;
67326         this_arg_conv.inner = untag_ptr(this_arg);
67327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67329         this_arg_conv.is_owned = false;
67330         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67331         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
67332         return tag_ptr(ret_conv, true);
67333 }
67334
67335 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) {
67336         LDKOfferFeatures this_arg_conv;
67337         this_arg_conv.inner = untag_ptr(this_arg);
67338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67340         this_arg_conv.is_owned = false;
67341         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67342         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67343         return tag_ptr(ret_conv, true);
67344 }
67345
67346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
67347         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
67348         int64_t ret_ref = 0;
67349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67351         return ret_ref;
67352 }
67353
67354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67355         LDKInvoiceRequestFeatures this_arg_conv;
67356         this_arg_conv.inner = untag_ptr(this_arg);
67357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67359         this_arg_conv.is_owned = false;
67360         LDKInvoiceRequestFeatures other_conv;
67361         other_conv.inner = untag_ptr(other);
67362         other_conv.is_owned = ptr_is_owned(other);
67363         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67364         other_conv.is_owned = false;
67365         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67366         return ret_conv;
67367 }
67368
67369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67370         LDKInvoiceRequestFeatures this_arg_conv;
67371         this_arg_conv.inner = untag_ptr(this_arg);
67372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67374         this_arg_conv.is_owned = false;
67375         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
67376         return ret_conv;
67377 }
67378
67379 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) {
67380         LDKInvoiceRequestFeatures this_arg_conv;
67381         this_arg_conv.inner = untag_ptr(this_arg);
67382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67384         this_arg_conv.is_owned = false;
67385         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67386         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
67387         return tag_ptr(ret_conv, true);
67388 }
67389
67390 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) {
67391         LDKInvoiceRequestFeatures this_arg_conv;
67392         this_arg_conv.inner = untag_ptr(this_arg);
67393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67395         this_arg_conv.is_owned = false;
67396         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67397         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67398         return tag_ptr(ret_conv, true);
67399 }
67400
67401 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) {
67402         LDKInvoiceRequestFeatures this_arg_conv;
67403         this_arg_conv.inner = untag_ptr(this_arg);
67404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67406         this_arg_conv.is_owned = false;
67407         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67408         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
67409         return tag_ptr(ret_conv, true);
67410 }
67411
67412 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) {
67413         LDKInvoiceRequestFeatures this_arg_conv;
67414         this_arg_conv.inner = untag_ptr(this_arg);
67415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67417         this_arg_conv.is_owned = false;
67418         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67419         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67420         return tag_ptr(ret_conv, true);
67421 }
67422
67423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
67424         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
67425         int64_t ret_ref = 0;
67426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67428         return ret_ref;
67429 }
67430
67431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67432         LDKBolt12InvoiceFeatures this_arg_conv;
67433         this_arg_conv.inner = untag_ptr(this_arg);
67434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67436         this_arg_conv.is_owned = false;
67437         LDKBolt12InvoiceFeatures other_conv;
67438         other_conv.inner = untag_ptr(other);
67439         other_conv.is_owned = ptr_is_owned(other);
67440         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67441         other_conv.is_owned = false;
67442         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67443         return ret_conv;
67444 }
67445
67446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67447         LDKBolt12InvoiceFeatures this_arg_conv;
67448         this_arg_conv.inner = untag_ptr(this_arg);
67449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67451         this_arg_conv.is_owned = false;
67452         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
67453         return ret_conv;
67454 }
67455
67456 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) {
67457         LDKBolt12InvoiceFeatures this_arg_conv;
67458         this_arg_conv.inner = untag_ptr(this_arg);
67459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67461         this_arg_conv.is_owned = false;
67462         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67463         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
67464         return tag_ptr(ret_conv, true);
67465 }
67466
67467 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) {
67468         LDKBolt12InvoiceFeatures this_arg_conv;
67469         this_arg_conv.inner = untag_ptr(this_arg);
67470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67472         this_arg_conv.is_owned = false;
67473         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67474         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67475         return tag_ptr(ret_conv, true);
67476 }
67477
67478 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) {
67479         LDKBolt12InvoiceFeatures this_arg_conv;
67480         this_arg_conv.inner = untag_ptr(this_arg);
67481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67483         this_arg_conv.is_owned = false;
67484         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67485         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
67486         return tag_ptr(ret_conv, true);
67487 }
67488
67489 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) {
67490         LDKBolt12InvoiceFeatures this_arg_conv;
67491         this_arg_conv.inner = untag_ptr(this_arg);
67492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67494         this_arg_conv.is_owned = false;
67495         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67496         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67497         return tag_ptr(ret_conv, true);
67498 }
67499
67500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
67501         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
67502         int64_t ret_ref = 0;
67503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67505         return ret_ref;
67506 }
67507
67508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67509         LDKBlindedHopFeatures this_arg_conv;
67510         this_arg_conv.inner = untag_ptr(this_arg);
67511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67513         this_arg_conv.is_owned = false;
67514         LDKBlindedHopFeatures other_conv;
67515         other_conv.inner = untag_ptr(other);
67516         other_conv.is_owned = ptr_is_owned(other);
67517         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67518         other_conv.is_owned = false;
67519         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67520         return ret_conv;
67521 }
67522
67523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67524         LDKBlindedHopFeatures this_arg_conv;
67525         this_arg_conv.inner = untag_ptr(this_arg);
67526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67528         this_arg_conv.is_owned = false;
67529         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
67530         return ret_conv;
67531 }
67532
67533 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) {
67534         LDKBlindedHopFeatures this_arg_conv;
67535         this_arg_conv.inner = untag_ptr(this_arg);
67536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67538         this_arg_conv.is_owned = false;
67539         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67540         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
67541         return tag_ptr(ret_conv, true);
67542 }
67543
67544 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) {
67545         LDKBlindedHopFeatures this_arg_conv;
67546         this_arg_conv.inner = untag_ptr(this_arg);
67547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67549         this_arg_conv.is_owned = false;
67550         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67551         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67552         return tag_ptr(ret_conv, true);
67553 }
67554
67555 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) {
67556         LDKBlindedHopFeatures this_arg_conv;
67557         this_arg_conv.inner = untag_ptr(this_arg);
67558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67560         this_arg_conv.is_owned = false;
67561         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67562         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
67563         return tag_ptr(ret_conv, true);
67564 }
67565
67566 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) {
67567         LDKBlindedHopFeatures this_arg_conv;
67568         this_arg_conv.inner = untag_ptr(this_arg);
67569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67571         this_arg_conv.is_owned = false;
67572         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67573         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67574         return tag_ptr(ret_conv, true);
67575 }
67576
67577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
67578         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
67579         int64_t ret_ref = 0;
67580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67582         return ret_ref;
67583 }
67584
67585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
67586         LDKChannelTypeFeatures this_arg_conv;
67587         this_arg_conv.inner = untag_ptr(this_arg);
67588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67590         this_arg_conv.is_owned = false;
67591         LDKChannelTypeFeatures other_conv;
67592         other_conv.inner = untag_ptr(other);
67593         other_conv.is_owned = ptr_is_owned(other);
67594         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
67595         other_conv.is_owned = false;
67596         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
67597         return ret_conv;
67598 }
67599
67600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
67601         LDKChannelTypeFeatures this_arg_conv;
67602         this_arg_conv.inner = untag_ptr(this_arg);
67603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67605         this_arg_conv.is_owned = false;
67606         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
67607         return ret_conv;
67608 }
67609
67610 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) {
67611         LDKChannelTypeFeatures this_arg_conv;
67612         this_arg_conv.inner = untag_ptr(this_arg);
67613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67615         this_arg_conv.is_owned = false;
67616         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67617         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
67618         return tag_ptr(ret_conv, true);
67619 }
67620
67621 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) {
67622         LDKChannelTypeFeatures this_arg_conv;
67623         this_arg_conv.inner = untag_ptr(this_arg);
67624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67626         this_arg_conv.is_owned = false;
67627         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67628         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
67629         return tag_ptr(ret_conv, true);
67630 }
67631
67632 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) {
67633         LDKChannelTypeFeatures this_arg_conv;
67634         this_arg_conv.inner = untag_ptr(this_arg);
67635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67637         this_arg_conv.is_owned = false;
67638         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67639         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
67640         return tag_ptr(ret_conv, true);
67641 }
67642
67643 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) {
67644         LDKChannelTypeFeatures this_arg_conv;
67645         this_arg_conv.inner = untag_ptr(this_arg);
67646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67648         this_arg_conv.is_owned = false;
67649         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
67650         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
67651         return tag_ptr(ret_conv, true);
67652 }
67653
67654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67655         LDKInitFeatures obj_conv;
67656         obj_conv.inner = untag_ptr(obj);
67657         obj_conv.is_owned = ptr_is_owned(obj);
67658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67659         obj_conv.is_owned = false;
67660         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
67661         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67662         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67663         CVec_u8Z_free(ret_var);
67664         return ret_arr;
67665 }
67666
67667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67668         LDKu8slice ser_ref;
67669         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67670         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67671         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
67672         *ret_conv = InitFeatures_read(ser_ref);
67673         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67674         return tag_ptr(ret_conv, true);
67675 }
67676
67677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67678         LDKChannelFeatures obj_conv;
67679         obj_conv.inner = untag_ptr(obj);
67680         obj_conv.is_owned = ptr_is_owned(obj);
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67682         obj_conv.is_owned = false;
67683         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
67684         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67685         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67686         CVec_u8Z_free(ret_var);
67687         return ret_arr;
67688 }
67689
67690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67691         LDKu8slice ser_ref;
67692         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67693         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67694         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
67695         *ret_conv = ChannelFeatures_read(ser_ref);
67696         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67697         return tag_ptr(ret_conv, true);
67698 }
67699
67700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67701         LDKNodeFeatures obj_conv;
67702         obj_conv.inner = untag_ptr(obj);
67703         obj_conv.is_owned = ptr_is_owned(obj);
67704         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67705         obj_conv.is_owned = false;
67706         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
67707         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67708         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67709         CVec_u8Z_free(ret_var);
67710         return ret_arr;
67711 }
67712
67713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67714         LDKu8slice ser_ref;
67715         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67716         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67717         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
67718         *ret_conv = NodeFeatures_read(ser_ref);
67719         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67720         return tag_ptr(ret_conv, true);
67721 }
67722
67723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67724         LDKBolt11InvoiceFeatures obj_conv;
67725         obj_conv.inner = untag_ptr(obj);
67726         obj_conv.is_owned = ptr_is_owned(obj);
67727         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67728         obj_conv.is_owned = false;
67729         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
67730         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67731         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67732         CVec_u8Z_free(ret_var);
67733         return ret_arr;
67734 }
67735
67736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67737         LDKu8slice ser_ref;
67738         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67739         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67740         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
67741         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
67742         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67743         return tag_ptr(ret_conv, true);
67744 }
67745
67746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67747         LDKBolt12InvoiceFeatures obj_conv;
67748         obj_conv.inner = untag_ptr(obj);
67749         obj_conv.is_owned = ptr_is_owned(obj);
67750         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67751         obj_conv.is_owned = false;
67752         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
67753         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67754         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67755         CVec_u8Z_free(ret_var);
67756         return ret_arr;
67757 }
67758
67759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67760         LDKu8slice ser_ref;
67761         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67762         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67763         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
67764         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
67765         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67766         return tag_ptr(ret_conv, true);
67767 }
67768
67769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67770         LDKBlindedHopFeatures obj_conv;
67771         obj_conv.inner = untag_ptr(obj);
67772         obj_conv.is_owned = ptr_is_owned(obj);
67773         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67774         obj_conv.is_owned = false;
67775         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
67776         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67777         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67778         CVec_u8Z_free(ret_var);
67779         return ret_arr;
67780 }
67781
67782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67783         LDKu8slice ser_ref;
67784         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67785         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67786         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
67787         *ret_conv = BlindedHopFeatures_read(ser_ref);
67788         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67789         return tag_ptr(ret_conv, true);
67790 }
67791
67792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
67793         LDKChannelTypeFeatures obj_conv;
67794         obj_conv.inner = untag_ptr(obj);
67795         obj_conv.is_owned = ptr_is_owned(obj);
67796         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67797         obj_conv.is_owned = false;
67798         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
67799         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67800         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67801         CVec_u8Z_free(ret_var);
67802         return ret_arr;
67803 }
67804
67805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67806         LDKu8slice ser_ref;
67807         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67808         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67809         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
67810         *ret_conv = ChannelTypeFeatures_read(ser_ref);
67811         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67812         return tag_ptr(ret_conv, true);
67813 }
67814
67815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67816         LDKInitFeatures this_arg_conv;
67817         this_arg_conv.inner = untag_ptr(this_arg);
67818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67820         this_arg_conv.is_owned = false;
67821         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
67822 }
67823
67824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67825         LDKInitFeatures this_arg_conv;
67826         this_arg_conv.inner = untag_ptr(this_arg);
67827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67829         this_arg_conv.is_owned = false;
67830         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
67831 }
67832
67833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
67834         LDKInitFeatures this_arg_conv;
67835         this_arg_conv.inner = untag_ptr(this_arg);
67836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67838         this_arg_conv.is_owned = false;
67839         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
67840         return ret_conv;
67841 }
67842
67843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67844         LDKNodeFeatures this_arg_conv;
67845         this_arg_conv.inner = untag_ptr(this_arg);
67846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67848         this_arg_conv.is_owned = false;
67849         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
67850 }
67851
67852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67853         LDKNodeFeatures this_arg_conv;
67854         this_arg_conv.inner = untag_ptr(this_arg);
67855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67857         this_arg_conv.is_owned = false;
67858         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
67859 }
67860
67861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
67862         LDKNodeFeatures this_arg_conv;
67863         this_arg_conv.inner = untag_ptr(this_arg);
67864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67866         this_arg_conv.is_owned = false;
67867         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
67868         return ret_conv;
67869 }
67870
67871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
67872         LDKInitFeatures this_arg_conv;
67873         this_arg_conv.inner = untag_ptr(this_arg);
67874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67876         this_arg_conv.is_owned = false;
67877         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
67878         return ret_conv;
67879 }
67880
67881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
67882         LDKNodeFeatures this_arg_conv;
67883         this_arg_conv.inner = untag_ptr(this_arg);
67884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67886         this_arg_conv.is_owned = false;
67887         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
67888         return ret_conv;
67889 }
67890
67891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67892         LDKInitFeatures this_arg_conv;
67893         this_arg_conv.inner = untag_ptr(this_arg);
67894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67896         this_arg_conv.is_owned = false;
67897         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
67898 }
67899
67900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67901         LDKInitFeatures this_arg_conv;
67902         this_arg_conv.inner = untag_ptr(this_arg);
67903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67905         this_arg_conv.is_owned = false;
67906         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
67907 }
67908
67909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
67910         LDKInitFeatures this_arg_conv;
67911         this_arg_conv.inner = untag_ptr(this_arg);
67912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67914         this_arg_conv.is_owned = false;
67915         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
67916         return ret_conv;
67917 }
67918
67919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67920         LDKInitFeatures this_arg_conv;
67921         this_arg_conv.inner = untag_ptr(this_arg);
67922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67924         this_arg_conv.is_owned = false;
67925         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
67926 }
67927
67928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67929         LDKInitFeatures this_arg_conv;
67930         this_arg_conv.inner = untag_ptr(this_arg);
67931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67933         this_arg_conv.is_owned = false;
67934         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
67935 }
67936
67937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
67938         LDKInitFeatures this_arg_conv;
67939         this_arg_conv.inner = untag_ptr(this_arg);
67940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67942         this_arg_conv.is_owned = false;
67943         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
67944         return ret_conv;
67945 }
67946
67947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67948         LDKNodeFeatures this_arg_conv;
67949         this_arg_conv.inner = untag_ptr(this_arg);
67950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67952         this_arg_conv.is_owned = false;
67953         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
67954 }
67955
67956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67957         LDKNodeFeatures this_arg_conv;
67958         this_arg_conv.inner = untag_ptr(this_arg);
67959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67961         this_arg_conv.is_owned = false;
67962         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
67963 }
67964
67965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
67966         LDKNodeFeatures this_arg_conv;
67967         this_arg_conv.inner = untag_ptr(this_arg);
67968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67970         this_arg_conv.is_owned = false;
67971         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
67972         return ret_conv;
67973 }
67974
67975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
67976         LDKInitFeatures this_arg_conv;
67977         this_arg_conv.inner = untag_ptr(this_arg);
67978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67980         this_arg_conv.is_owned = false;
67981         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
67982         return ret_conv;
67983 }
67984
67985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
67986         LDKNodeFeatures this_arg_conv;
67987         this_arg_conv.inner = untag_ptr(this_arg);
67988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67990         this_arg_conv.is_owned = false;
67991         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
67992         return ret_conv;
67993 }
67994
67995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67996         LDKInitFeatures this_arg_conv;
67997         this_arg_conv.inner = untag_ptr(this_arg);
67998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68000         this_arg_conv.is_owned = false;
68001         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
68002 }
68003
68004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68005         LDKInitFeatures this_arg_conv;
68006         this_arg_conv.inner = untag_ptr(this_arg);
68007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68009         this_arg_conv.is_owned = false;
68010         InitFeatures_set_gossip_queries_required(&this_arg_conv);
68011 }
68012
68013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
68014         LDKInitFeatures this_arg_conv;
68015         this_arg_conv.inner = untag_ptr(this_arg);
68016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68018         this_arg_conv.is_owned = false;
68019         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
68020         return ret_conv;
68021 }
68022
68023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68024         LDKNodeFeatures this_arg_conv;
68025         this_arg_conv.inner = untag_ptr(this_arg);
68026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68028         this_arg_conv.is_owned = false;
68029         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
68030 }
68031
68032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68033         LDKNodeFeatures this_arg_conv;
68034         this_arg_conv.inner = untag_ptr(this_arg);
68035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68037         this_arg_conv.is_owned = false;
68038         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
68039 }
68040
68041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
68042         LDKNodeFeatures this_arg_conv;
68043         this_arg_conv.inner = untag_ptr(this_arg);
68044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68046         this_arg_conv.is_owned = false;
68047         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
68048         return ret_conv;
68049 }
68050
68051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
68052         LDKInitFeatures this_arg_conv;
68053         this_arg_conv.inner = untag_ptr(this_arg);
68054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68056         this_arg_conv.is_owned = false;
68057         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
68058         return ret_conv;
68059 }
68060
68061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
68062         LDKNodeFeatures this_arg_conv;
68063         this_arg_conv.inner = untag_ptr(this_arg);
68064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68066         this_arg_conv.is_owned = false;
68067         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
68068         return ret_conv;
68069 }
68070
68071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68072         LDKInitFeatures this_arg_conv;
68073         this_arg_conv.inner = untag_ptr(this_arg);
68074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68076         this_arg_conv.is_owned = false;
68077         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
68078 }
68079
68080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68081         LDKInitFeatures this_arg_conv;
68082         this_arg_conv.inner = untag_ptr(this_arg);
68083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68085         this_arg_conv.is_owned = false;
68086         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
68087 }
68088
68089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
68090         LDKInitFeatures this_arg_conv;
68091         this_arg_conv.inner = untag_ptr(this_arg);
68092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68094         this_arg_conv.is_owned = false;
68095         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
68096         return ret_conv;
68097 }
68098
68099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68100         LDKNodeFeatures this_arg_conv;
68101         this_arg_conv.inner = untag_ptr(this_arg);
68102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68104         this_arg_conv.is_owned = false;
68105         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
68106 }
68107
68108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68109         LDKNodeFeatures this_arg_conv;
68110         this_arg_conv.inner = untag_ptr(this_arg);
68111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68113         this_arg_conv.is_owned = false;
68114         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
68115 }
68116
68117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
68118         LDKNodeFeatures this_arg_conv;
68119         this_arg_conv.inner = untag_ptr(this_arg);
68120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68122         this_arg_conv.is_owned = false;
68123         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
68124         return ret_conv;
68125 }
68126
68127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68128         LDKBolt11InvoiceFeatures this_arg_conv;
68129         this_arg_conv.inner = untag_ptr(this_arg);
68130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68132         this_arg_conv.is_owned = false;
68133         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
68134 }
68135
68136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68137         LDKBolt11InvoiceFeatures this_arg_conv;
68138         this_arg_conv.inner = untag_ptr(this_arg);
68139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68141         this_arg_conv.is_owned = false;
68142         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
68143 }
68144
68145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
68146         LDKBolt11InvoiceFeatures this_arg_conv;
68147         this_arg_conv.inner = untag_ptr(this_arg);
68148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68150         this_arg_conv.is_owned = false;
68151         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
68152         return ret_conv;
68153 }
68154
68155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
68156         LDKInitFeatures this_arg_conv;
68157         this_arg_conv.inner = untag_ptr(this_arg);
68158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68160         this_arg_conv.is_owned = false;
68161         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
68162         return ret_conv;
68163 }
68164
68165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
68166         LDKNodeFeatures this_arg_conv;
68167         this_arg_conv.inner = untag_ptr(this_arg);
68168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68170         this_arg_conv.is_owned = false;
68171         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
68172         return ret_conv;
68173 }
68174
68175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
68176         LDKBolt11InvoiceFeatures 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         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
68182         return ret_conv;
68183 }
68184
68185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68186         LDKInitFeatures this_arg_conv;
68187         this_arg_conv.inner = untag_ptr(this_arg);
68188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68190         this_arg_conv.is_owned = false;
68191         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
68192 }
68193
68194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68195         LDKInitFeatures this_arg_conv;
68196         this_arg_conv.inner = untag_ptr(this_arg);
68197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68199         this_arg_conv.is_owned = false;
68200         InitFeatures_set_static_remote_key_required(&this_arg_conv);
68201 }
68202
68203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68204         LDKInitFeatures this_arg_conv;
68205         this_arg_conv.inner = untag_ptr(this_arg);
68206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68208         this_arg_conv.is_owned = false;
68209         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
68210         return ret_conv;
68211 }
68212
68213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68214         LDKNodeFeatures this_arg_conv;
68215         this_arg_conv.inner = untag_ptr(this_arg);
68216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68218         this_arg_conv.is_owned = false;
68219         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
68220 }
68221
68222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68223         LDKNodeFeatures this_arg_conv;
68224         this_arg_conv.inner = untag_ptr(this_arg);
68225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68227         this_arg_conv.is_owned = false;
68228         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
68229 }
68230
68231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68232         LDKNodeFeatures this_arg_conv;
68233         this_arg_conv.inner = untag_ptr(this_arg);
68234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68236         this_arg_conv.is_owned = false;
68237         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
68238         return ret_conv;
68239 }
68240
68241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68242         LDKChannelTypeFeatures this_arg_conv;
68243         this_arg_conv.inner = untag_ptr(this_arg);
68244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68246         this_arg_conv.is_owned = false;
68247         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
68248 }
68249
68250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68251         LDKChannelTypeFeatures this_arg_conv;
68252         this_arg_conv.inner = untag_ptr(this_arg);
68253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68255         this_arg_conv.is_owned = false;
68256         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
68257 }
68258
68259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68260         LDKChannelTypeFeatures this_arg_conv;
68261         this_arg_conv.inner = untag_ptr(this_arg);
68262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68264         this_arg_conv.is_owned = false;
68265         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
68266         return ret_conv;
68267 }
68268
68269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68270         LDKInitFeatures this_arg_conv;
68271         this_arg_conv.inner = untag_ptr(this_arg);
68272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68274         this_arg_conv.is_owned = false;
68275         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
68276         return ret_conv;
68277 }
68278
68279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68280         LDKNodeFeatures this_arg_conv;
68281         this_arg_conv.inner = untag_ptr(this_arg);
68282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68284         this_arg_conv.is_owned = false;
68285         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
68286         return ret_conv;
68287 }
68288
68289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68290         LDKChannelTypeFeatures this_arg_conv;
68291         this_arg_conv.inner = untag_ptr(this_arg);
68292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68294         this_arg_conv.is_owned = false;
68295         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
68296         return ret_conv;
68297 }
68298
68299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68300         LDKInitFeatures this_arg_conv;
68301         this_arg_conv.inner = untag_ptr(this_arg);
68302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68304         this_arg_conv.is_owned = false;
68305         InitFeatures_set_payment_secret_optional(&this_arg_conv);
68306 }
68307
68308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68309         LDKInitFeatures this_arg_conv;
68310         this_arg_conv.inner = untag_ptr(this_arg);
68311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68313         this_arg_conv.is_owned = false;
68314         InitFeatures_set_payment_secret_required(&this_arg_conv);
68315 }
68316
68317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68318         LDKInitFeatures this_arg_conv;
68319         this_arg_conv.inner = untag_ptr(this_arg);
68320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68322         this_arg_conv.is_owned = false;
68323         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
68324         return ret_conv;
68325 }
68326
68327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68328         LDKNodeFeatures this_arg_conv;
68329         this_arg_conv.inner = untag_ptr(this_arg);
68330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68332         this_arg_conv.is_owned = false;
68333         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
68334 }
68335
68336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68337         LDKNodeFeatures this_arg_conv;
68338         this_arg_conv.inner = untag_ptr(this_arg);
68339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68341         this_arg_conv.is_owned = false;
68342         NodeFeatures_set_payment_secret_required(&this_arg_conv);
68343 }
68344
68345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68346         LDKNodeFeatures this_arg_conv;
68347         this_arg_conv.inner = untag_ptr(this_arg);
68348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68350         this_arg_conv.is_owned = false;
68351         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
68352         return ret_conv;
68353 }
68354
68355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68356         LDKBolt11InvoiceFeatures this_arg_conv;
68357         this_arg_conv.inner = untag_ptr(this_arg);
68358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68360         this_arg_conv.is_owned = false;
68361         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
68362 }
68363
68364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68365         LDKBolt11InvoiceFeatures this_arg_conv;
68366         this_arg_conv.inner = untag_ptr(this_arg);
68367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68369         this_arg_conv.is_owned = false;
68370         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
68371 }
68372
68373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68374         LDKBolt11InvoiceFeatures this_arg_conv;
68375         this_arg_conv.inner = untag_ptr(this_arg);
68376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68378         this_arg_conv.is_owned = false;
68379         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
68380         return ret_conv;
68381 }
68382
68383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68384         LDKInitFeatures this_arg_conv;
68385         this_arg_conv.inner = untag_ptr(this_arg);
68386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68388         this_arg_conv.is_owned = false;
68389         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
68390         return ret_conv;
68391 }
68392
68393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68394         LDKNodeFeatures this_arg_conv;
68395         this_arg_conv.inner = untag_ptr(this_arg);
68396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68398         this_arg_conv.is_owned = false;
68399         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
68400         return ret_conv;
68401 }
68402
68403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68404         LDKBolt11InvoiceFeatures this_arg_conv;
68405         this_arg_conv.inner = untag_ptr(this_arg);
68406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68408         this_arg_conv.is_owned = false;
68409         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
68410         return ret_conv;
68411 }
68412
68413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68414         LDKInitFeatures this_arg_conv;
68415         this_arg_conv.inner = untag_ptr(this_arg);
68416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68418         this_arg_conv.is_owned = false;
68419         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
68420 }
68421
68422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68423         LDKInitFeatures this_arg_conv;
68424         this_arg_conv.inner = untag_ptr(this_arg);
68425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68427         this_arg_conv.is_owned = false;
68428         InitFeatures_set_basic_mpp_required(&this_arg_conv);
68429 }
68430
68431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68432         LDKInitFeatures this_arg_conv;
68433         this_arg_conv.inner = untag_ptr(this_arg);
68434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68436         this_arg_conv.is_owned = false;
68437         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
68438         return ret_conv;
68439 }
68440
68441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68442         LDKNodeFeatures this_arg_conv;
68443         this_arg_conv.inner = untag_ptr(this_arg);
68444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68446         this_arg_conv.is_owned = false;
68447         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
68448 }
68449
68450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68451         LDKNodeFeatures this_arg_conv;
68452         this_arg_conv.inner = untag_ptr(this_arg);
68453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68455         this_arg_conv.is_owned = false;
68456         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
68457 }
68458
68459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68460         LDKNodeFeatures this_arg_conv;
68461         this_arg_conv.inner = untag_ptr(this_arg);
68462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68464         this_arg_conv.is_owned = false;
68465         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
68466         return ret_conv;
68467 }
68468
68469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68470         LDKBolt11InvoiceFeatures this_arg_conv;
68471         this_arg_conv.inner = untag_ptr(this_arg);
68472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68474         this_arg_conv.is_owned = false;
68475         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
68476 }
68477
68478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68479         LDKBolt11InvoiceFeatures this_arg_conv;
68480         this_arg_conv.inner = untag_ptr(this_arg);
68481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68483         this_arg_conv.is_owned = false;
68484         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
68485 }
68486
68487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68488         LDKBolt11InvoiceFeatures this_arg_conv;
68489         this_arg_conv.inner = untag_ptr(this_arg);
68490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68492         this_arg_conv.is_owned = false;
68493         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
68494         return ret_conv;
68495 }
68496
68497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68498         LDKBolt12InvoiceFeatures this_arg_conv;
68499         this_arg_conv.inner = untag_ptr(this_arg);
68500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68502         this_arg_conv.is_owned = false;
68503         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
68504 }
68505
68506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68507         LDKBolt12InvoiceFeatures this_arg_conv;
68508         this_arg_conv.inner = untag_ptr(this_arg);
68509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68511         this_arg_conv.is_owned = false;
68512         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
68513 }
68514
68515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68516         LDKBolt12InvoiceFeatures this_arg_conv;
68517         this_arg_conv.inner = untag_ptr(this_arg);
68518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68520         this_arg_conv.is_owned = false;
68521         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
68522         return ret_conv;
68523 }
68524
68525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68526         LDKInitFeatures this_arg_conv;
68527         this_arg_conv.inner = untag_ptr(this_arg);
68528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68530         this_arg_conv.is_owned = false;
68531         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
68532         return ret_conv;
68533 }
68534
68535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68536         LDKNodeFeatures this_arg_conv;
68537         this_arg_conv.inner = untag_ptr(this_arg);
68538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68540         this_arg_conv.is_owned = false;
68541         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
68542         return ret_conv;
68543 }
68544
68545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68546         LDKBolt11InvoiceFeatures this_arg_conv;
68547         this_arg_conv.inner = untag_ptr(this_arg);
68548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68550         this_arg_conv.is_owned = false;
68551         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
68552         return ret_conv;
68553 }
68554
68555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
68556         LDKBolt12InvoiceFeatures this_arg_conv;
68557         this_arg_conv.inner = untag_ptr(this_arg);
68558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68560         this_arg_conv.is_owned = false;
68561         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
68562         return ret_conv;
68563 }
68564
68565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68566         LDKInitFeatures this_arg_conv;
68567         this_arg_conv.inner = untag_ptr(this_arg);
68568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68570         this_arg_conv.is_owned = false;
68571         InitFeatures_set_wumbo_optional(&this_arg_conv);
68572 }
68573
68574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68575         LDKInitFeatures this_arg_conv;
68576         this_arg_conv.inner = untag_ptr(this_arg);
68577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68579         this_arg_conv.is_owned = false;
68580         InitFeatures_set_wumbo_required(&this_arg_conv);
68581 }
68582
68583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
68584         LDKInitFeatures this_arg_conv;
68585         this_arg_conv.inner = untag_ptr(this_arg);
68586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68588         this_arg_conv.is_owned = false;
68589         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
68590         return ret_conv;
68591 }
68592
68593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68594         LDKNodeFeatures this_arg_conv;
68595         this_arg_conv.inner = untag_ptr(this_arg);
68596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68598         this_arg_conv.is_owned = false;
68599         NodeFeatures_set_wumbo_optional(&this_arg_conv);
68600 }
68601
68602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68603         LDKNodeFeatures this_arg_conv;
68604         this_arg_conv.inner = untag_ptr(this_arg);
68605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68607         this_arg_conv.is_owned = false;
68608         NodeFeatures_set_wumbo_required(&this_arg_conv);
68609 }
68610
68611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
68612         LDKNodeFeatures this_arg_conv;
68613         this_arg_conv.inner = untag_ptr(this_arg);
68614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68616         this_arg_conv.is_owned = false;
68617         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
68618         return ret_conv;
68619 }
68620
68621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
68622         LDKInitFeatures this_arg_conv;
68623         this_arg_conv.inner = untag_ptr(this_arg);
68624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68626         this_arg_conv.is_owned = false;
68627         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
68628         return ret_conv;
68629 }
68630
68631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
68632         LDKNodeFeatures this_arg_conv;
68633         this_arg_conv.inner = untag_ptr(this_arg);
68634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68636         this_arg_conv.is_owned = false;
68637         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
68638         return ret_conv;
68639 }
68640
68641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68642         LDKInitFeatures this_arg_conv;
68643         this_arg_conv.inner = untag_ptr(this_arg);
68644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68646         this_arg_conv.is_owned = false;
68647         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
68648 }
68649
68650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68651         LDKInitFeatures this_arg_conv;
68652         this_arg_conv.inner = untag_ptr(this_arg);
68653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68655         this_arg_conv.is_owned = false;
68656         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
68657 }
68658
68659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68660         LDKInitFeatures this_arg_conv;
68661         this_arg_conv.inner = untag_ptr(this_arg);
68662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68664         this_arg_conv.is_owned = false;
68665         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
68666         return ret_conv;
68667 }
68668
68669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68670         LDKNodeFeatures this_arg_conv;
68671         this_arg_conv.inner = untag_ptr(this_arg);
68672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68674         this_arg_conv.is_owned = false;
68675         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
68676 }
68677
68678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68679         LDKNodeFeatures this_arg_conv;
68680         this_arg_conv.inner = untag_ptr(this_arg);
68681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68683         this_arg_conv.is_owned = false;
68684         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
68685 }
68686
68687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68688         LDKNodeFeatures this_arg_conv;
68689         this_arg_conv.inner = untag_ptr(this_arg);
68690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68692         this_arg_conv.is_owned = false;
68693         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
68694         return ret_conv;
68695 }
68696
68697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68698         LDKChannelTypeFeatures this_arg_conv;
68699         this_arg_conv.inner = untag_ptr(this_arg);
68700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68702         this_arg_conv.is_owned = false;
68703         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
68704 }
68705
68706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68707         LDKChannelTypeFeatures this_arg_conv;
68708         this_arg_conv.inner = untag_ptr(this_arg);
68709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68711         this_arg_conv.is_owned = false;
68712         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
68713 }
68714
68715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68716         LDKChannelTypeFeatures this_arg_conv;
68717         this_arg_conv.inner = untag_ptr(this_arg);
68718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68720         this_arg_conv.is_owned = false;
68721         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
68722         return ret_conv;
68723 }
68724
68725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68726         LDKInitFeatures this_arg_conv;
68727         this_arg_conv.inner = untag_ptr(this_arg);
68728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68730         this_arg_conv.is_owned = false;
68731         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
68732         return ret_conv;
68733 }
68734
68735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68736         LDKNodeFeatures this_arg_conv;
68737         this_arg_conv.inner = untag_ptr(this_arg);
68738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68740         this_arg_conv.is_owned = false;
68741         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
68742         return ret_conv;
68743 }
68744
68745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68746         LDKChannelTypeFeatures this_arg_conv;
68747         this_arg_conv.inner = untag_ptr(this_arg);
68748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68750         this_arg_conv.is_owned = false;
68751         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
68752         return ret_conv;
68753 }
68754
68755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68756         LDKInitFeatures this_arg_conv;
68757         this_arg_conv.inner = untag_ptr(this_arg);
68758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68760         this_arg_conv.is_owned = false;
68761         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
68762 }
68763
68764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68765         LDKInitFeatures this_arg_conv;
68766         this_arg_conv.inner = untag_ptr(this_arg);
68767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68769         this_arg_conv.is_owned = false;
68770         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
68771 }
68772
68773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68774         LDKInitFeatures this_arg_conv;
68775         this_arg_conv.inner = untag_ptr(this_arg);
68776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68778         this_arg_conv.is_owned = false;
68779         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
68780         return ret_conv;
68781 }
68782
68783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68784         LDKNodeFeatures this_arg_conv;
68785         this_arg_conv.inner = untag_ptr(this_arg);
68786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68788         this_arg_conv.is_owned = false;
68789         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
68790 }
68791
68792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68793         LDKNodeFeatures this_arg_conv;
68794         this_arg_conv.inner = untag_ptr(this_arg);
68795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68797         this_arg_conv.is_owned = false;
68798         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
68799 }
68800
68801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68802         LDKNodeFeatures this_arg_conv;
68803         this_arg_conv.inner = untag_ptr(this_arg);
68804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68806         this_arg_conv.is_owned = false;
68807         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
68808         return ret_conv;
68809 }
68810
68811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68812         LDKChannelTypeFeatures this_arg_conv;
68813         this_arg_conv.inner = untag_ptr(this_arg);
68814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68816         this_arg_conv.is_owned = false;
68817         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
68818 }
68819
68820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68821         LDKChannelTypeFeatures this_arg_conv;
68822         this_arg_conv.inner = untag_ptr(this_arg);
68823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68825         this_arg_conv.is_owned = false;
68826         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
68827 }
68828
68829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68830         LDKChannelTypeFeatures this_arg_conv;
68831         this_arg_conv.inner = untag_ptr(this_arg);
68832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68834         this_arg_conv.is_owned = false;
68835         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
68836         return ret_conv;
68837 }
68838
68839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68840         LDKInitFeatures this_arg_conv;
68841         this_arg_conv.inner = untag_ptr(this_arg);
68842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68844         this_arg_conv.is_owned = false;
68845         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
68846         return ret_conv;
68847 }
68848
68849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68850         LDKNodeFeatures this_arg_conv;
68851         this_arg_conv.inner = untag_ptr(this_arg);
68852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68854         this_arg_conv.is_owned = false;
68855         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
68856         return ret_conv;
68857 }
68858
68859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
68860         LDKChannelTypeFeatures this_arg_conv;
68861         this_arg_conv.inner = untag_ptr(this_arg);
68862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68864         this_arg_conv.is_owned = false;
68865         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
68866         return ret_conv;
68867 }
68868
68869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68870         LDKInitFeatures this_arg_conv;
68871         this_arg_conv.inner = untag_ptr(this_arg);
68872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68874         this_arg_conv.is_owned = false;
68875         InitFeatures_set_route_blinding_optional(&this_arg_conv);
68876 }
68877
68878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68879         LDKInitFeatures this_arg_conv;
68880         this_arg_conv.inner = untag_ptr(this_arg);
68881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68883         this_arg_conv.is_owned = false;
68884         InitFeatures_set_route_blinding_required(&this_arg_conv);
68885 }
68886
68887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
68888         LDKInitFeatures this_arg_conv;
68889         this_arg_conv.inner = untag_ptr(this_arg);
68890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68892         this_arg_conv.is_owned = false;
68893         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
68894         return ret_conv;
68895 }
68896
68897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68898         LDKNodeFeatures this_arg_conv;
68899         this_arg_conv.inner = untag_ptr(this_arg);
68900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68902         this_arg_conv.is_owned = false;
68903         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
68904 }
68905
68906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68907         LDKNodeFeatures this_arg_conv;
68908         this_arg_conv.inner = untag_ptr(this_arg);
68909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68911         this_arg_conv.is_owned = false;
68912         NodeFeatures_set_route_blinding_required(&this_arg_conv);
68913 }
68914
68915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
68916         LDKNodeFeatures this_arg_conv;
68917         this_arg_conv.inner = untag_ptr(this_arg);
68918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68920         this_arg_conv.is_owned = false;
68921         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
68922         return ret_conv;
68923 }
68924
68925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
68926         LDKInitFeatures this_arg_conv;
68927         this_arg_conv.inner = untag_ptr(this_arg);
68928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68930         this_arg_conv.is_owned = false;
68931         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
68932         return ret_conv;
68933 }
68934
68935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
68936         LDKNodeFeatures this_arg_conv;
68937         this_arg_conv.inner = untag_ptr(this_arg);
68938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68940         this_arg_conv.is_owned = false;
68941         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
68942         return ret_conv;
68943 }
68944
68945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68946         LDKInitFeatures this_arg_conv;
68947         this_arg_conv.inner = untag_ptr(this_arg);
68948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68950         this_arg_conv.is_owned = false;
68951         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
68952 }
68953
68954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68955         LDKInitFeatures this_arg_conv;
68956         this_arg_conv.inner = untag_ptr(this_arg);
68957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68959         this_arg_conv.is_owned = false;
68960         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
68961 }
68962
68963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
68964         LDKInitFeatures this_arg_conv;
68965         this_arg_conv.inner = untag_ptr(this_arg);
68966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68968         this_arg_conv.is_owned = false;
68969         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
68970         return ret_conv;
68971 }
68972
68973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68974         LDKNodeFeatures this_arg_conv;
68975         this_arg_conv.inner = untag_ptr(this_arg);
68976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68978         this_arg_conv.is_owned = false;
68979         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
68980 }
68981
68982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68983         LDKNodeFeatures this_arg_conv;
68984         this_arg_conv.inner = untag_ptr(this_arg);
68985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68987         this_arg_conv.is_owned = false;
68988         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
68989 }
68990
68991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
68992         LDKNodeFeatures this_arg_conv;
68993         this_arg_conv.inner = untag_ptr(this_arg);
68994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68996         this_arg_conv.is_owned = false;
68997         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
68998         return ret_conv;
68999 }
69000
69001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
69002         LDKInitFeatures this_arg_conv;
69003         this_arg_conv.inner = untag_ptr(this_arg);
69004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69006         this_arg_conv.is_owned = false;
69007         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
69008         return ret_conv;
69009 }
69010
69011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
69012         LDKNodeFeatures this_arg_conv;
69013         this_arg_conv.inner = untag_ptr(this_arg);
69014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69016         this_arg_conv.is_owned = false;
69017         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
69018         return ret_conv;
69019 }
69020
69021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69022         LDKInitFeatures this_arg_conv;
69023         this_arg_conv.inner = untag_ptr(this_arg);
69024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69026         this_arg_conv.is_owned = false;
69027         InitFeatures_set_taproot_optional(&this_arg_conv);
69028 }
69029
69030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69031         LDKInitFeatures this_arg_conv;
69032         this_arg_conv.inner = untag_ptr(this_arg);
69033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69035         this_arg_conv.is_owned = false;
69036         InitFeatures_set_taproot_required(&this_arg_conv);
69037 }
69038
69039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
69040         LDKInitFeatures this_arg_conv;
69041         this_arg_conv.inner = untag_ptr(this_arg);
69042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69044         this_arg_conv.is_owned = false;
69045         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
69046         return ret_conv;
69047 }
69048
69049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69050         LDKNodeFeatures this_arg_conv;
69051         this_arg_conv.inner = untag_ptr(this_arg);
69052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69054         this_arg_conv.is_owned = false;
69055         NodeFeatures_set_taproot_optional(&this_arg_conv);
69056 }
69057
69058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69059         LDKNodeFeatures this_arg_conv;
69060         this_arg_conv.inner = untag_ptr(this_arg);
69061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69063         this_arg_conv.is_owned = false;
69064         NodeFeatures_set_taproot_required(&this_arg_conv);
69065 }
69066
69067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
69068         LDKNodeFeatures this_arg_conv;
69069         this_arg_conv.inner = untag_ptr(this_arg);
69070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69072         this_arg_conv.is_owned = false;
69073         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
69074         return ret_conv;
69075 }
69076
69077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69078         LDKChannelTypeFeatures this_arg_conv;
69079         this_arg_conv.inner = untag_ptr(this_arg);
69080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69082         this_arg_conv.is_owned = false;
69083         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
69084 }
69085
69086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69087         LDKChannelTypeFeatures this_arg_conv;
69088         this_arg_conv.inner = untag_ptr(this_arg);
69089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69091         this_arg_conv.is_owned = false;
69092         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
69093 }
69094
69095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
69096         LDKChannelTypeFeatures this_arg_conv;
69097         this_arg_conv.inner = untag_ptr(this_arg);
69098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69100         this_arg_conv.is_owned = false;
69101         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
69102         return ret_conv;
69103 }
69104
69105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
69106         LDKInitFeatures this_arg_conv;
69107         this_arg_conv.inner = untag_ptr(this_arg);
69108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69110         this_arg_conv.is_owned = false;
69111         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
69112         return ret_conv;
69113 }
69114
69115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
69116         LDKNodeFeatures this_arg_conv;
69117         this_arg_conv.inner = untag_ptr(this_arg);
69118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69120         this_arg_conv.is_owned = false;
69121         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
69122         return ret_conv;
69123 }
69124
69125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
69126         LDKChannelTypeFeatures this_arg_conv;
69127         this_arg_conv.inner = untag_ptr(this_arg);
69128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69130         this_arg_conv.is_owned = false;
69131         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
69132         return ret_conv;
69133 }
69134
69135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69136         LDKInitFeatures this_arg_conv;
69137         this_arg_conv.inner = untag_ptr(this_arg);
69138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69140         this_arg_conv.is_owned = false;
69141         InitFeatures_set_onion_messages_optional(&this_arg_conv);
69142 }
69143
69144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69145         LDKInitFeatures this_arg_conv;
69146         this_arg_conv.inner = untag_ptr(this_arg);
69147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69149         this_arg_conv.is_owned = false;
69150         InitFeatures_set_onion_messages_required(&this_arg_conv);
69151 }
69152
69153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
69154         LDKInitFeatures this_arg_conv;
69155         this_arg_conv.inner = untag_ptr(this_arg);
69156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69158         this_arg_conv.is_owned = false;
69159         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
69160         return ret_conv;
69161 }
69162
69163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69164         LDKNodeFeatures this_arg_conv;
69165         this_arg_conv.inner = untag_ptr(this_arg);
69166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69168         this_arg_conv.is_owned = false;
69169         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
69170 }
69171
69172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69173         LDKNodeFeatures this_arg_conv;
69174         this_arg_conv.inner = untag_ptr(this_arg);
69175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69177         this_arg_conv.is_owned = false;
69178         NodeFeatures_set_onion_messages_required(&this_arg_conv);
69179 }
69180
69181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
69182         LDKNodeFeatures this_arg_conv;
69183         this_arg_conv.inner = untag_ptr(this_arg);
69184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69186         this_arg_conv.is_owned = false;
69187         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
69188         return ret_conv;
69189 }
69190
69191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
69192         LDKInitFeatures this_arg_conv;
69193         this_arg_conv.inner = untag_ptr(this_arg);
69194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69196         this_arg_conv.is_owned = false;
69197         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
69198         return ret_conv;
69199 }
69200
69201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
69202         LDKNodeFeatures this_arg_conv;
69203         this_arg_conv.inner = untag_ptr(this_arg);
69204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69206         this_arg_conv.is_owned = false;
69207         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
69208         return ret_conv;
69209 }
69210
69211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69212         LDKInitFeatures this_arg_conv;
69213         this_arg_conv.inner = untag_ptr(this_arg);
69214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69216         this_arg_conv.is_owned = false;
69217         InitFeatures_set_channel_type_optional(&this_arg_conv);
69218 }
69219
69220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69221         LDKInitFeatures this_arg_conv;
69222         this_arg_conv.inner = untag_ptr(this_arg);
69223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69225         this_arg_conv.is_owned = false;
69226         InitFeatures_set_channel_type_required(&this_arg_conv);
69227 }
69228
69229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
69230         LDKInitFeatures this_arg_conv;
69231         this_arg_conv.inner = untag_ptr(this_arg);
69232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69234         this_arg_conv.is_owned = false;
69235         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
69236         return ret_conv;
69237 }
69238
69239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69240         LDKNodeFeatures this_arg_conv;
69241         this_arg_conv.inner = untag_ptr(this_arg);
69242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69244         this_arg_conv.is_owned = false;
69245         NodeFeatures_set_channel_type_optional(&this_arg_conv);
69246 }
69247
69248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69249         LDKNodeFeatures this_arg_conv;
69250         this_arg_conv.inner = untag_ptr(this_arg);
69251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69253         this_arg_conv.is_owned = false;
69254         NodeFeatures_set_channel_type_required(&this_arg_conv);
69255 }
69256
69257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
69258         LDKNodeFeatures this_arg_conv;
69259         this_arg_conv.inner = untag_ptr(this_arg);
69260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69262         this_arg_conv.is_owned = false;
69263         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
69264         return ret_conv;
69265 }
69266
69267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
69268         LDKInitFeatures this_arg_conv;
69269         this_arg_conv.inner = untag_ptr(this_arg);
69270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69272         this_arg_conv.is_owned = false;
69273         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
69274         return ret_conv;
69275 }
69276
69277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
69278         LDKNodeFeatures this_arg_conv;
69279         this_arg_conv.inner = untag_ptr(this_arg);
69280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69282         this_arg_conv.is_owned = false;
69283         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
69284         return ret_conv;
69285 }
69286
69287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69288         LDKInitFeatures this_arg_conv;
69289         this_arg_conv.inner = untag_ptr(this_arg);
69290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69292         this_arg_conv.is_owned = false;
69293         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
69294 }
69295
69296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69297         LDKInitFeatures this_arg_conv;
69298         this_arg_conv.inner = untag_ptr(this_arg);
69299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69301         this_arg_conv.is_owned = false;
69302         InitFeatures_set_scid_privacy_required(&this_arg_conv);
69303 }
69304
69305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
69306         LDKInitFeatures this_arg_conv;
69307         this_arg_conv.inner = untag_ptr(this_arg);
69308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69310         this_arg_conv.is_owned = false;
69311         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
69312         return ret_conv;
69313 }
69314
69315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69316         LDKNodeFeatures this_arg_conv;
69317         this_arg_conv.inner = untag_ptr(this_arg);
69318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69320         this_arg_conv.is_owned = false;
69321         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
69322 }
69323
69324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69325         LDKNodeFeatures this_arg_conv;
69326         this_arg_conv.inner = untag_ptr(this_arg);
69327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69329         this_arg_conv.is_owned = false;
69330         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
69331 }
69332
69333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
69334         LDKNodeFeatures this_arg_conv;
69335         this_arg_conv.inner = untag_ptr(this_arg);
69336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69338         this_arg_conv.is_owned = false;
69339         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
69340         return ret_conv;
69341 }
69342
69343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69344         LDKChannelTypeFeatures this_arg_conv;
69345         this_arg_conv.inner = untag_ptr(this_arg);
69346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69348         this_arg_conv.is_owned = false;
69349         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
69350 }
69351
69352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69353         LDKChannelTypeFeatures this_arg_conv;
69354         this_arg_conv.inner = untag_ptr(this_arg);
69355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69357         this_arg_conv.is_owned = false;
69358         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
69359 }
69360
69361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
69362         LDKChannelTypeFeatures this_arg_conv;
69363         this_arg_conv.inner = untag_ptr(this_arg);
69364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69366         this_arg_conv.is_owned = false;
69367         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
69368         return ret_conv;
69369 }
69370
69371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
69372         LDKInitFeatures this_arg_conv;
69373         this_arg_conv.inner = untag_ptr(this_arg);
69374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69376         this_arg_conv.is_owned = false;
69377         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
69378         return ret_conv;
69379 }
69380
69381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
69382         LDKNodeFeatures this_arg_conv;
69383         this_arg_conv.inner = untag_ptr(this_arg);
69384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69386         this_arg_conv.is_owned = false;
69387         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
69388         return ret_conv;
69389 }
69390
69391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
69392         LDKChannelTypeFeatures this_arg_conv;
69393         this_arg_conv.inner = untag_ptr(this_arg);
69394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69396         this_arg_conv.is_owned = false;
69397         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
69398         return ret_conv;
69399 }
69400
69401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69402         LDKBolt11InvoiceFeatures this_arg_conv;
69403         this_arg_conv.inner = untag_ptr(this_arg);
69404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69406         this_arg_conv.is_owned = false;
69407         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
69408 }
69409
69410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69411         LDKBolt11InvoiceFeatures this_arg_conv;
69412         this_arg_conv.inner = untag_ptr(this_arg);
69413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69415         this_arg_conv.is_owned = false;
69416         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
69417 }
69418
69419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
69420         LDKBolt11InvoiceFeatures this_arg_conv;
69421         this_arg_conv.inner = untag_ptr(this_arg);
69422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69424         this_arg_conv.is_owned = false;
69425         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
69426         return ret_conv;
69427 }
69428
69429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
69430         LDKBolt11InvoiceFeatures this_arg_conv;
69431         this_arg_conv.inner = untag_ptr(this_arg);
69432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69434         this_arg_conv.is_owned = false;
69435         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
69436         return ret_conv;
69437 }
69438
69439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69440         LDKInitFeatures this_arg_conv;
69441         this_arg_conv.inner = untag_ptr(this_arg);
69442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69444         this_arg_conv.is_owned = false;
69445         InitFeatures_set_zero_conf_optional(&this_arg_conv);
69446 }
69447
69448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69449         LDKInitFeatures this_arg_conv;
69450         this_arg_conv.inner = untag_ptr(this_arg);
69451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69453         this_arg_conv.is_owned = false;
69454         InitFeatures_set_zero_conf_required(&this_arg_conv);
69455 }
69456
69457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
69458         LDKInitFeatures this_arg_conv;
69459         this_arg_conv.inner = untag_ptr(this_arg);
69460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69462         this_arg_conv.is_owned = false;
69463         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
69464         return ret_conv;
69465 }
69466
69467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69468         LDKNodeFeatures this_arg_conv;
69469         this_arg_conv.inner = untag_ptr(this_arg);
69470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69472         this_arg_conv.is_owned = false;
69473         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
69474 }
69475
69476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69477         LDKNodeFeatures this_arg_conv;
69478         this_arg_conv.inner = untag_ptr(this_arg);
69479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69481         this_arg_conv.is_owned = false;
69482         NodeFeatures_set_zero_conf_required(&this_arg_conv);
69483 }
69484
69485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
69486         LDKNodeFeatures this_arg_conv;
69487         this_arg_conv.inner = untag_ptr(this_arg);
69488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69490         this_arg_conv.is_owned = false;
69491         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
69492         return ret_conv;
69493 }
69494
69495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69496         LDKChannelTypeFeatures this_arg_conv;
69497         this_arg_conv.inner = untag_ptr(this_arg);
69498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69500         this_arg_conv.is_owned = false;
69501         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
69502 }
69503
69504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69505         LDKChannelTypeFeatures this_arg_conv;
69506         this_arg_conv.inner = untag_ptr(this_arg);
69507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69509         this_arg_conv.is_owned = false;
69510         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
69511 }
69512
69513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
69514         LDKChannelTypeFeatures this_arg_conv;
69515         this_arg_conv.inner = untag_ptr(this_arg);
69516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69518         this_arg_conv.is_owned = false;
69519         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
69520         return ret_conv;
69521 }
69522
69523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
69524         LDKInitFeatures this_arg_conv;
69525         this_arg_conv.inner = untag_ptr(this_arg);
69526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69528         this_arg_conv.is_owned = false;
69529         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
69530         return ret_conv;
69531 }
69532
69533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
69534         LDKNodeFeatures this_arg_conv;
69535         this_arg_conv.inner = untag_ptr(this_arg);
69536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69538         this_arg_conv.is_owned = false;
69539         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
69540         return ret_conv;
69541 }
69542
69543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
69544         LDKChannelTypeFeatures this_arg_conv;
69545         this_arg_conv.inner = untag_ptr(this_arg);
69546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69548         this_arg_conv.is_owned = false;
69549         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
69550         return ret_conv;
69551 }
69552
69553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69554         LDKNodeFeatures this_arg_conv;
69555         this_arg_conv.inner = untag_ptr(this_arg);
69556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69558         this_arg_conv.is_owned = false;
69559         NodeFeatures_set_keysend_optional(&this_arg_conv);
69560 }
69561
69562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69563         LDKNodeFeatures this_arg_conv;
69564         this_arg_conv.inner = untag_ptr(this_arg);
69565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69567         this_arg_conv.is_owned = false;
69568         NodeFeatures_set_keysend_required(&this_arg_conv);
69569 }
69570
69571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
69572         LDKNodeFeatures this_arg_conv;
69573         this_arg_conv.inner = untag_ptr(this_arg);
69574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69576         this_arg_conv.is_owned = false;
69577         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
69578         return ret_conv;
69579 }
69580
69581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
69582         LDKNodeFeatures this_arg_conv;
69583         this_arg_conv.inner = untag_ptr(this_arg);
69584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69586         this_arg_conv.is_owned = false;
69587         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
69588         return ret_conv;
69589 }
69590
69591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69592         LDKInitFeatures this_arg_conv;
69593         this_arg_conv.inner = untag_ptr(this_arg);
69594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69596         this_arg_conv.is_owned = false;
69597         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
69598 }
69599
69600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69601         LDKInitFeatures this_arg_conv;
69602         this_arg_conv.inner = untag_ptr(this_arg);
69603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69605         this_arg_conv.is_owned = false;
69606         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
69607 }
69608
69609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
69610         LDKInitFeatures this_arg_conv;
69611         this_arg_conv.inner = untag_ptr(this_arg);
69612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69614         this_arg_conv.is_owned = false;
69615         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
69616         return ret_conv;
69617 }
69618
69619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69620         LDKNodeFeatures this_arg_conv;
69621         this_arg_conv.inner = untag_ptr(this_arg);
69622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69624         this_arg_conv.is_owned = false;
69625         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
69626 }
69627
69628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69629         LDKNodeFeatures this_arg_conv;
69630         this_arg_conv.inner = untag_ptr(this_arg);
69631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69633         this_arg_conv.is_owned = false;
69634         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
69635 }
69636
69637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
69638         LDKNodeFeatures this_arg_conv;
69639         this_arg_conv.inner = untag_ptr(this_arg);
69640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69642         this_arg_conv.is_owned = false;
69643         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
69644         return ret_conv;
69645 }
69646
69647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
69648         LDKBolt11InvoiceFeatures this_arg_conv;
69649         this_arg_conv.inner = untag_ptr(this_arg);
69650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69652         this_arg_conv.is_owned = false;
69653         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
69654 }
69655
69656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
69657         LDKBolt11InvoiceFeatures this_arg_conv;
69658         this_arg_conv.inner = untag_ptr(this_arg);
69659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69661         this_arg_conv.is_owned = false;
69662         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
69663 }
69664
69665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
69666         LDKBolt11InvoiceFeatures this_arg_conv;
69667         this_arg_conv.inner = untag_ptr(this_arg);
69668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69670         this_arg_conv.is_owned = false;
69671         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
69672         return ret_conv;
69673 }
69674
69675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
69676         LDKInitFeatures this_arg_conv;
69677         this_arg_conv.inner = untag_ptr(this_arg);
69678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69680         this_arg_conv.is_owned = false;
69681         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
69682         return ret_conv;
69683 }
69684
69685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
69686         LDKNodeFeatures this_arg_conv;
69687         this_arg_conv.inner = untag_ptr(this_arg);
69688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69690         this_arg_conv.is_owned = false;
69691         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
69692         return ret_conv;
69693 }
69694
69695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
69696         LDKBolt11InvoiceFeatures this_arg_conv;
69697         this_arg_conv.inner = untag_ptr(this_arg);
69698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69700         this_arg_conv.is_owned = false;
69701         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
69702         return ret_conv;
69703 }
69704
69705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69706         LDKShutdownScript this_obj_conv;
69707         this_obj_conv.inner = untag_ptr(this_obj);
69708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69710         ShutdownScript_free(this_obj_conv);
69711 }
69712
69713 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
69714         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
69715         int64_t ret_ref = 0;
69716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69718         return ret_ref;
69719 }
69720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69721         LDKShutdownScript arg_conv;
69722         arg_conv.inner = untag_ptr(arg);
69723         arg_conv.is_owned = ptr_is_owned(arg);
69724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69725         arg_conv.is_owned = false;
69726         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
69727         return ret_conv;
69728 }
69729
69730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69731         LDKShutdownScript orig_conv;
69732         orig_conv.inner = untag_ptr(orig);
69733         orig_conv.is_owned = ptr_is_owned(orig);
69734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69735         orig_conv.is_owned = false;
69736         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
69737         int64_t ret_ref = 0;
69738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69740         return ret_ref;
69741 }
69742
69743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69744         LDKShutdownScript a_conv;
69745         a_conv.inner = untag_ptr(a);
69746         a_conv.is_owned = ptr_is_owned(a);
69747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69748         a_conv.is_owned = false;
69749         LDKShutdownScript b_conv;
69750         b_conv.inner = untag_ptr(b);
69751         b_conv.is_owned = ptr_is_owned(b);
69752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69753         b_conv.is_owned = false;
69754         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
69755         return ret_conv;
69756 }
69757
69758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69759         LDKInvalidShutdownScript this_obj_conv;
69760         this_obj_conv.inner = untag_ptr(this_obj);
69761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69763         InvalidShutdownScript_free(this_obj_conv);
69764 }
69765
69766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
69767         LDKInvalidShutdownScript this_ptr_conv;
69768         this_ptr_conv.inner = untag_ptr(this_ptr);
69769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69771         this_ptr_conv.is_owned = false;
69772         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
69773         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69774         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69775         CVec_u8Z_free(ret_var);
69776         return ret_arr;
69777 }
69778
69779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69780         LDKInvalidShutdownScript this_ptr_conv;
69781         this_ptr_conv.inner = untag_ptr(this_ptr);
69782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69784         this_ptr_conv.is_owned = false;
69785         LDKCVec_u8Z val_ref;
69786         val_ref.datalen = (*env)->GetArrayLength(env, val);
69787         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
69788         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
69789         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
69790 }
69791
69792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
69793         LDKCVec_u8Z script_arg_ref;
69794         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
69795         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
69796         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
69797         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
69798         int64_t ret_ref = 0;
69799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69801         return ret_ref;
69802 }
69803
69804 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
69805         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
69806         int64_t ret_ref = 0;
69807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69809         return ret_ref;
69810 }
69811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69812         LDKInvalidShutdownScript arg_conv;
69813         arg_conv.inner = untag_ptr(arg);
69814         arg_conv.is_owned = ptr_is_owned(arg);
69815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69816         arg_conv.is_owned = false;
69817         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
69818         return ret_conv;
69819 }
69820
69821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69822         LDKInvalidShutdownScript orig_conv;
69823         orig_conv.inner = untag_ptr(orig);
69824         orig_conv.is_owned = ptr_is_owned(orig);
69825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69826         orig_conv.is_owned = false;
69827         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
69828         int64_t ret_ref = 0;
69829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69831         return ret_ref;
69832 }
69833
69834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
69835         LDKShutdownScript obj_conv;
69836         obj_conv.inner = untag_ptr(obj);
69837         obj_conv.is_owned = ptr_is_owned(obj);
69838         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69839         obj_conv.is_owned = false;
69840         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
69841         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69842         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69843         CVec_u8Z_free(ret_var);
69844         return ret_arr;
69845 }
69846
69847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69848         LDKu8slice ser_ref;
69849         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69850         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69851         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
69852         *ret_conv = ShutdownScript_read(ser_ref);
69853         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69854         return tag_ptr(ret_conv, true);
69855 }
69856
69857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
69858         uint8_t pubkey_hash_arr[20];
69859         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
69860         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
69861         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
69862         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
69863         int64_t ret_ref = 0;
69864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69866         return ret_ref;
69867 }
69868
69869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
69870         uint8_t script_hash_arr[32];
69871         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
69872         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
69873         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
69874         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
69875         int64_t ret_ref = 0;
69876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69878         return ret_ref;
69879 }
69880
69881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int64_t witness_program) {
69882         void* witness_program_ptr = untag_ptr(witness_program);
69883         CHECK_ACCESS(witness_program_ptr);
69884         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
69885         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
69886         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
69887         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
69888         return tag_ptr(ret_conv, true);
69889 }
69890
69891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
69892         LDKShutdownScript this_arg_conv;
69893         this_arg_conv.inner = untag_ptr(this_arg);
69894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69896         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
69897         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
69898         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69899         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69900         CVec_u8Z_free(ret_var);
69901         return ret_arr;
69902 }
69903
69904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
69905         LDKShutdownScript this_arg_conv;
69906         this_arg_conv.inner = untag_ptr(this_arg);
69907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69909         this_arg_conv.is_owned = false;
69910         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69911         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
69912         return ret_arr;
69913 }
69914
69915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
69916         LDKShutdownScript this_arg_conv;
69917         this_arg_conv.inner = untag_ptr(this_arg);
69918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69920         this_arg_conv.is_owned = false;
69921         LDKInitFeatures features_conv;
69922         features_conv.inner = untag_ptr(features);
69923         features_conv.is_owned = ptr_is_owned(features);
69924         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
69925         features_conv.is_owned = false;
69926         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
69927         return ret_conv;
69928 }
69929
69930 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69931         LDKShutdownScript o_conv;
69932         o_conv.inner = untag_ptr(o);
69933         o_conv.is_owned = ptr_is_owned(o);
69934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69935         o_conv.is_owned = false;
69936         LDKStr ret_str = ShutdownScript_to_str(&o_conv);
69937         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69938         Str_free(ret_str);
69939         return ret_conv;
69940 }
69941
69942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69943         LDKChannelId this_obj_conv;
69944         this_obj_conv.inner = untag_ptr(this_obj);
69945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69947         ChannelId_free(this_obj_conv);
69948 }
69949
69950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelId_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
69951         LDKChannelId this_ptr_conv;
69952         this_ptr_conv.inner = untag_ptr(this_ptr);
69953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69955         this_ptr_conv.is_owned = false;
69956         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69957         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelId_get_a(&this_ptr_conv));
69958         return ret_arr;
69959 }
69960
69961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelId_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69962         LDKChannelId this_ptr_conv;
69963         this_ptr_conv.inner = untag_ptr(this_ptr);
69964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69966         this_ptr_conv.is_owned = false;
69967         LDKThirtyTwoBytes val_ref;
69968         CHECK((*env)->GetArrayLength(env, val) == 32);
69969         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69970         ChannelId_set_a(&this_ptr_conv, val_ref);
69971 }
69972
69973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
69974         LDKThirtyTwoBytes a_arg_ref;
69975         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
69976         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
69977         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
69978         int64_t ret_ref = 0;
69979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69981         return ret_ref;
69982 }
69983
69984 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
69985         LDKChannelId ret_var = ChannelId_clone(arg);
69986         int64_t ret_ref = 0;
69987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69989         return ret_ref;
69990 }
69991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69992         LDKChannelId arg_conv;
69993         arg_conv.inner = untag_ptr(arg);
69994         arg_conv.is_owned = ptr_is_owned(arg);
69995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69996         arg_conv.is_owned = false;
69997         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
69998         return ret_conv;
69999 }
70000
70001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70002         LDKChannelId orig_conv;
70003         orig_conv.inner = untag_ptr(orig);
70004         orig_conv.is_owned = ptr_is_owned(orig);
70005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70006         orig_conv.is_owned = false;
70007         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
70008         int64_t ret_ref = 0;
70009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70011         return ret_ref;
70012 }
70013
70014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70015         LDKChannelId a_conv;
70016         a_conv.inner = untag_ptr(a);
70017         a_conv.is_owned = ptr_is_owned(a);
70018         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70019         a_conv.is_owned = false;
70020         LDKChannelId b_conv;
70021         b_conv.inner = untag_ptr(b);
70022         b_conv.is_owned = ptr_is_owned(b);
70023         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70024         b_conv.is_owned = false;
70025         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
70026         return ret_conv;
70027 }
70028
70029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1hash(JNIEnv *env, jclass clz, int64_t o) {
70030         LDKChannelId o_conv;
70031         o_conv.inner = untag_ptr(o);
70032         o_conv.is_owned = ptr_is_owned(o);
70033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70034         o_conv.is_owned = false;
70035         int64_t ret_conv = ChannelId_hash(&o_conv);
70036         return ret_conv;
70037 }
70038
70039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v1_1from_1funding_1txid(JNIEnv *env, jclass clz, int8_tArray txid, int16_t output_index) {
70040         uint8_t txid_arr[32];
70041         CHECK((*env)->GetArrayLength(env, txid) == 32);
70042         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
70043         uint8_t (*txid_ref)[32] = &txid_arr;
70044         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
70045         int64_t ret_ref = 0;
70046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70048         return ret_ref;
70049 }
70050
70051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v1_1from_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t outpoint) {
70052         LDKOutPoint outpoint_conv;
70053         outpoint_conv.inner = untag_ptr(outpoint);
70054         outpoint_conv.is_owned = ptr_is_owned(outpoint);
70055         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
70056         outpoint_conv = OutPoint_clone(&outpoint_conv);
70057         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
70058         int64_t ret_ref = 0;
70059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70061         return ret_ref;
70062 }
70063
70064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1temporary_1from_1entropy_1source(JNIEnv *env, jclass clz, int64_t entropy_source) {
70065         void* entropy_source_ptr = untag_ptr(entropy_source);
70066         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70067         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70068         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
70069         int64_t ret_ref = 0;
70070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70072         return ret_ref;
70073 }
70074
70075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray data) {
70076         LDKThirtyTwoBytes data_ref;
70077         CHECK((*env)->GetArrayLength(env, data) == 32);
70078         (*env)->GetByteArrayRegion(env, data, 0, 32, data_ref.data);
70079         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
70080         int64_t ret_ref = 0;
70081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70083         return ret_ref;
70084 }
70085
70086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1new_1zero(JNIEnv *env, jclass clz) {
70087         LDKChannelId ret_var = ChannelId_new_zero();
70088         int64_t ret_ref = 0;
70089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70091         return ret_ref;
70092 }
70093
70094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelId_1is_1zero(JNIEnv *env, jclass clz, int64_t this_arg) {
70095         LDKChannelId this_arg_conv;
70096         this_arg_conv.inner = untag_ptr(this_arg);
70097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70099         this_arg_conv.is_owned = false;
70100         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
70101         return ret_conv;
70102 }
70103
70104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v2_1from_1revocation_1basepoints(JNIEnv *env, jclass clz, int64_t ours, int64_t theirs) {
70105         LDKRevocationBasepoint ours_conv;
70106         ours_conv.inner = untag_ptr(ours);
70107         ours_conv.is_owned = ptr_is_owned(ours);
70108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
70109         ours_conv.is_owned = false;
70110         LDKRevocationBasepoint theirs_conv;
70111         theirs_conv.inner = untag_ptr(theirs);
70112         theirs_conv.is_owned = ptr_is_owned(theirs);
70113         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
70114         theirs_conv.is_owned = false;
70115         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
70116         int64_t ret_ref = 0;
70117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70119         return ret_ref;
70120 }
70121
70122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1temporary_1v2_1from_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t our_revocation_basepoint) {
70123         LDKRevocationBasepoint our_revocation_basepoint_conv;
70124         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
70125         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
70126         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
70127         our_revocation_basepoint_conv.is_owned = false;
70128         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
70129         int64_t ret_ref = 0;
70130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70132         return ret_ref;
70133 }
70134
70135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelId_1write(JNIEnv *env, jclass clz, int64_t obj) {
70136         LDKChannelId obj_conv;
70137         obj_conv.inner = untag_ptr(obj);
70138         obj_conv.is_owned = ptr_is_owned(obj);
70139         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70140         obj_conv.is_owned = false;
70141         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
70142         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70143         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70144         CVec_u8Z_free(ret_var);
70145         return ret_arr;
70146 }
70147
70148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70149         LDKu8slice ser_ref;
70150         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70151         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70152         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
70153         *ret_conv = ChannelId_read(ser_ref);
70154         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70155         return tag_ptr(ret_conv, true);
70156 }
70157
70158 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ChannelId_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
70159         LDKChannelId o_conv;
70160         o_conv.inner = untag_ptr(o);
70161         o_conv.is_owned = ptr_is_owned(o);
70162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70163         o_conv.is_owned = false;
70164         LDKStr ret_str = ChannelId_to_str(&o_conv);
70165         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
70166         Str_free(ret_str);
70167         return ret_conv;
70168 }
70169
70170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70171         if (!ptr_is_owned(this_ptr)) return;
70172         void* this_ptr_ptr = untag_ptr(this_ptr);
70173         CHECK_ACCESS(this_ptr_ptr);
70174         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
70175         FREE(untag_ptr(this_ptr));
70176         Retry_free(this_ptr_conv);
70177 }
70178
70179 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
70180         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
70181         *ret_copy = Retry_clone(arg);
70182         int64_t ret_ref = tag_ptr(ret_copy, true);
70183         return ret_ref;
70184 }
70185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70186         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
70187         int64_t ret_conv = Retry_clone_ptr(arg_conv);
70188         return ret_conv;
70189 }
70190
70191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70192         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
70193         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
70194         *ret_copy = Retry_clone(orig_conv);
70195         int64_t ret_ref = tag_ptr(ret_copy, true);
70196         return ret_ref;
70197 }
70198
70199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
70200         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
70201         *ret_copy = Retry_attempts(a);
70202         int64_t ret_ref = tag_ptr(ret_copy, true);
70203         return ret_ref;
70204 }
70205
70206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
70207         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
70208         *ret_copy = Retry_timeout(a);
70209         int64_t ret_ref = tag_ptr(ret_copy, true);
70210         return ret_ref;
70211 }
70212
70213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70214         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
70215         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
70216         jboolean ret_conv = Retry_eq(a_conv, b_conv);
70217         return ret_conv;
70218 }
70219
70220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
70221         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
70222         int64_t ret_conv = Retry_hash(o_conv);
70223         return ret_conv;
70224 }
70225
70226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
70227         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
70228         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
70229         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70230         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70231         CVec_u8Z_free(ret_var);
70232         return ret_arr;
70233 }
70234
70235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70236         LDKu8slice ser_ref;
70237         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70238         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70239         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
70240         *ret_conv = Retry_read(ser_ref);
70241         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70242         return tag_ptr(ret_conv, true);
70243 }
70244
70245 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70246         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
70247         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
70248         return ret_conv;
70249 }
70250
70251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
70252         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
70253         return ret_conv;
70254 }
70255
70256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
70257         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
70258         return ret_conv;
70259 }
70260
70261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
70262         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
70263         return ret_conv;
70264 }
70265
70266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70267         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
70268         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
70269         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
70270         return ret_conv;
70271 }
70272
70273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70274         if (!ptr_is_owned(this_ptr)) return;
70275         void* this_ptr_ptr = untag_ptr(this_ptr);
70276         CHECK_ACCESS(this_ptr_ptr);
70277         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
70278         FREE(untag_ptr(this_ptr));
70279         PaymentSendFailure_free(this_ptr_conv);
70280 }
70281
70282 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
70283         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70284         *ret_copy = PaymentSendFailure_clone(arg);
70285         int64_t ret_ref = tag_ptr(ret_copy, true);
70286         return ret_ref;
70287 }
70288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70289         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
70290         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
70291         return ret_conv;
70292 }
70293
70294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70295         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
70296         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70297         *ret_copy = PaymentSendFailure_clone(orig_conv);
70298         int64_t ret_ref = tag_ptr(ret_copy, true);
70299         return ret_ref;
70300 }
70301
70302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
70303         void* a_ptr = untag_ptr(a);
70304         CHECK_ACCESS(a_ptr);
70305         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
70306         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
70307         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70308         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
70309         int64_t ret_ref = tag_ptr(ret_copy, true);
70310         return ret_ref;
70311 }
70312
70313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
70314         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
70315         a_constr.datalen = (*env)->GetArrayLength(env, a);
70316         if (a_constr.datalen > 0)
70317                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
70318         else
70319                 a_constr.data = NULL;
70320         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
70321         for (size_t w = 0; w < a_constr.datalen; w++) {
70322                 int64_t a_conv_22 = a_vals[w];
70323                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
70324                 CHECK_ACCESS(a_conv_22_ptr);
70325                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
70326                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
70327                 a_constr.data[w] = a_conv_22_conv;
70328         }
70329         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
70330         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70331         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
70332         int64_t ret_ref = tag_ptr(ret_copy, true);
70333         return ret_ref;
70334 }
70335
70336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
70337         LDKCVec_APIErrorZ a_constr;
70338         a_constr.datalen = (*env)->GetArrayLength(env, a);
70339         if (a_constr.datalen > 0)
70340                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
70341         else
70342                 a_constr.data = NULL;
70343         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
70344         for (size_t k = 0; k < a_constr.datalen; k++) {
70345                 int64_t a_conv_10 = a_vals[k];
70346                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
70347                 CHECK_ACCESS(a_conv_10_ptr);
70348                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
70349                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
70350                 a_constr.data[k] = a_conv_10_conv;
70351         }
70352         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
70353         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70354         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
70355         int64_t ret_ref = tag_ptr(ret_copy, true);
70356         return ret_ref;
70357 }
70358
70359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
70360         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70361         *ret_copy = PaymentSendFailure_duplicate_payment();
70362         int64_t ret_ref = tag_ptr(ret_copy, true);
70363         return ret_ref;
70364 }
70365
70366 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) {
70367         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
70368         results_constr.datalen = (*env)->GetArrayLength(env, results);
70369         if (results_constr.datalen > 0)
70370                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
70371         else
70372                 results_constr.data = NULL;
70373         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
70374         for (size_t w = 0; w < results_constr.datalen; w++) {
70375                 int64_t results_conv_22 = results_vals[w];
70376                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
70377                 CHECK_ACCESS(results_conv_22_ptr);
70378                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
70379                 results_constr.data[w] = results_conv_22_conv;
70380         }
70381         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
70382         LDKRouteParameters failed_paths_retry_conv;
70383         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
70384         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
70385         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
70386         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
70387         LDKThirtyTwoBytes payment_id_ref;
70388         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
70389         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
70390         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
70391         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
70392         int64_t ret_ref = tag_ptr(ret_copy, true);
70393         return ret_ref;
70394 }
70395
70396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70397         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
70398         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
70399         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
70400         return ret_conv;
70401 }
70402
70403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70404         if (!ptr_is_owned(this_ptr)) return;
70405         void* this_ptr_ptr = untag_ptr(this_ptr);
70406         CHECK_ACCESS(this_ptr_ptr);
70407         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
70408         FREE(untag_ptr(this_ptr));
70409         ProbeSendFailure_free(this_ptr_conv);
70410 }
70411
70412 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
70413         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
70414         *ret_copy = ProbeSendFailure_clone(arg);
70415         int64_t ret_ref = tag_ptr(ret_copy, true);
70416         return ret_ref;
70417 }
70418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70419         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
70420         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
70421         return ret_conv;
70422 }
70423
70424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70425         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
70426         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
70427         *ret_copy = ProbeSendFailure_clone(orig_conv);
70428         int64_t ret_ref = tag_ptr(ret_copy, true);
70429         return ret_ref;
70430 }
70431
70432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
70433         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
70434         *ret_copy = ProbeSendFailure_route_not_found();
70435         int64_t ret_ref = tag_ptr(ret_copy, true);
70436         return ret_ref;
70437 }
70438
70439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
70440         void* a_ptr = untag_ptr(a);
70441         CHECK_ACCESS(a_ptr);
70442         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
70443         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
70444         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
70445         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
70446         int64_t ret_ref = tag_ptr(ret_copy, true);
70447         return ret_ref;
70448 }
70449
70450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70451         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
70452         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
70453         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
70454         return ret_conv;
70455 }
70456
70457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70458         LDKRecipientOnionFields this_obj_conv;
70459         this_obj_conv.inner = untag_ptr(this_obj);
70460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70462         RecipientOnionFields_free(this_obj_conv);
70463 }
70464
70465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
70466         LDKRecipientOnionFields this_ptr_conv;
70467         this_ptr_conv.inner = untag_ptr(this_ptr);
70468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70470         this_ptr_conv.is_owned = false;
70471         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
70472         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
70473         int64_t ret_ref = tag_ptr(ret_copy, true);
70474         return ret_ref;
70475 }
70476
70477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70478         LDKRecipientOnionFields this_ptr_conv;
70479         this_ptr_conv.inner = untag_ptr(this_ptr);
70480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70482         this_ptr_conv.is_owned = false;
70483         void* val_ptr = untag_ptr(val);
70484         CHECK_ACCESS(val_ptr);
70485         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
70486         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
70487         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
70488 }
70489
70490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
70491         LDKRecipientOnionFields this_ptr_conv;
70492         this_ptr_conv.inner = untag_ptr(this_ptr);
70493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70495         this_ptr_conv.is_owned = false;
70496         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
70497         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
70498         int64_t ret_ref = tag_ptr(ret_copy, true);
70499         return ret_ref;
70500 }
70501
70502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70503         LDKRecipientOnionFields this_ptr_conv;
70504         this_ptr_conv.inner = untag_ptr(this_ptr);
70505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70507         this_ptr_conv.is_owned = false;
70508         void* val_ptr = untag_ptr(val);
70509         CHECK_ACCESS(val_ptr);
70510         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
70511         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
70512         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
70513 }
70514
70515 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
70516         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
70517         int64_t ret_ref = 0;
70518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70520         return ret_ref;
70521 }
70522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70523         LDKRecipientOnionFields arg_conv;
70524         arg_conv.inner = untag_ptr(arg);
70525         arg_conv.is_owned = ptr_is_owned(arg);
70526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70527         arg_conv.is_owned = false;
70528         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
70529         return ret_conv;
70530 }
70531
70532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70533         LDKRecipientOnionFields orig_conv;
70534         orig_conv.inner = untag_ptr(orig);
70535         orig_conv.is_owned = ptr_is_owned(orig);
70536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70537         orig_conv.is_owned = false;
70538         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
70539         int64_t ret_ref = 0;
70540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70542         return ret_ref;
70543 }
70544
70545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70546         LDKRecipientOnionFields a_conv;
70547         a_conv.inner = untag_ptr(a);
70548         a_conv.is_owned = ptr_is_owned(a);
70549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70550         a_conv.is_owned = false;
70551         LDKRecipientOnionFields b_conv;
70552         b_conv.inner = untag_ptr(b);
70553         b_conv.is_owned = ptr_is_owned(b);
70554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70555         b_conv.is_owned = false;
70556         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
70557         return ret_conv;
70558 }
70559
70560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
70561         LDKRecipientOnionFields obj_conv;
70562         obj_conv.inner = untag_ptr(obj);
70563         obj_conv.is_owned = ptr_is_owned(obj);
70564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70565         obj_conv.is_owned = false;
70566         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
70567         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70568         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70569         CVec_u8Z_free(ret_var);
70570         return ret_arr;
70571 }
70572
70573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70574         LDKu8slice ser_ref;
70575         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70576         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70577         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
70578         *ret_conv = RecipientOnionFields_read(ser_ref);
70579         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70580         return tag_ptr(ret_conv, true);
70581 }
70582
70583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
70584         LDKThirtyTwoBytes payment_secret_ref;
70585         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
70586         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
70587         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
70588         int64_t ret_ref = 0;
70589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70591         return ret_ref;
70592 }
70593
70594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
70595         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
70596         int64_t ret_ref = 0;
70597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70599         return ret_ref;
70600 }
70601
70602 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) {
70603         LDKRecipientOnionFields this_arg_conv;
70604         this_arg_conv.inner = untag_ptr(this_arg);
70605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70607         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
70608         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
70609         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
70610         if (custom_tlvs_constr.datalen > 0)
70611                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
70612         else
70613                 custom_tlvs_constr.data = NULL;
70614         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
70615         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
70616                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
70617                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
70618                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
70619                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
70620                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
70621                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
70622         }
70623         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
70624         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
70625         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
70626         return tag_ptr(ret_conv, true);
70627 }
70628
70629 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
70630         LDKRecipientOnionFields this_arg_conv;
70631         this_arg_conv.inner = untag_ptr(this_arg);
70632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70634         this_arg_conv.is_owned = false;
70635         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
70636         int64_tArray ret_arr = NULL;
70637         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70638         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70639         for (size_t x = 0; x < ret_var.datalen; x++) {
70640                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
70641                 *ret_conv_23_conv = ret_var.data[x];
70642                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
70643         }
70644         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70645         FREE(ret_var.data);
70646         return ret_arr;
70647 }
70648
70649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70650         if (!ptr_is_owned(this_ptr)) return;
70651         void* this_ptr_ptr = untag_ptr(this_ptr);
70652         CHECK_ACCESS(this_ptr_ptr);
70653         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
70654         FREE(untag_ptr(this_ptr));
70655         CustomMessageReader_free(this_ptr_conv);
70656 }
70657
70658 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
70659         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
70660         *ret_ret = Type_clone(arg);
70661         return tag_ptr(ret_ret, true);
70662 }
70663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70664         void* arg_ptr = untag_ptr(arg);
70665         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
70666         LDKType* arg_conv = (LDKType*)arg_ptr;
70667         int64_t ret_conv = Type_clone_ptr(arg_conv);
70668         return ret_conv;
70669 }
70670
70671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70672         void* orig_ptr = untag_ptr(orig);
70673         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
70674         LDKType* orig_conv = (LDKType*)orig_ptr;
70675         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
70676         *ret_ret = Type_clone(orig_conv);
70677         return tag_ptr(ret_ret, true);
70678 }
70679
70680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70681         if (!ptr_is_owned(this_ptr)) return;
70682         void* this_ptr_ptr = untag_ptr(this_ptr);
70683         CHECK_ACCESS(this_ptr_ptr);
70684         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
70685         FREE(untag_ptr(this_ptr));
70686         Type_free(this_ptr_conv);
70687 }
70688
70689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70690         LDKOfferId this_obj_conv;
70691         this_obj_conv.inner = untag_ptr(this_obj);
70692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70694         OfferId_free(this_obj_conv);
70695 }
70696
70697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferId_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
70698         LDKOfferId this_ptr_conv;
70699         this_ptr_conv.inner = untag_ptr(this_ptr);
70700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70702         this_ptr_conv.is_owned = false;
70703         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70704         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OfferId_get_a(&this_ptr_conv));
70705         return ret_arr;
70706 }
70707
70708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferId_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70709         LDKOfferId this_ptr_conv;
70710         this_ptr_conv.inner = untag_ptr(this_ptr);
70711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70713         this_ptr_conv.is_owned = false;
70714         LDKThirtyTwoBytes val_ref;
70715         CHECK((*env)->GetArrayLength(env, val) == 32);
70716         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
70717         OfferId_set_a(&this_ptr_conv, val_ref);
70718 }
70719
70720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
70721         LDKThirtyTwoBytes a_arg_ref;
70722         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
70723         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
70724         LDKOfferId ret_var = OfferId_new(a_arg_ref);
70725         int64_t ret_ref = 0;
70726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70728         return ret_ref;
70729 }
70730
70731 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
70732         LDKOfferId ret_var = OfferId_clone(arg);
70733         int64_t ret_ref = 0;
70734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70736         return ret_ref;
70737 }
70738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70739         LDKOfferId arg_conv;
70740         arg_conv.inner = untag_ptr(arg);
70741         arg_conv.is_owned = ptr_is_owned(arg);
70742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70743         arg_conv.is_owned = false;
70744         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
70745         return ret_conv;
70746 }
70747
70748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70749         LDKOfferId orig_conv;
70750         orig_conv.inner = untag_ptr(orig);
70751         orig_conv.is_owned = ptr_is_owned(orig);
70752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70753         orig_conv.is_owned = false;
70754         LDKOfferId ret_var = OfferId_clone(&orig_conv);
70755         int64_t ret_ref = 0;
70756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70758         return ret_ref;
70759 }
70760
70761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70762         LDKOfferId a_conv;
70763         a_conv.inner = untag_ptr(a);
70764         a_conv.is_owned = ptr_is_owned(a);
70765         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70766         a_conv.is_owned = false;
70767         LDKOfferId b_conv;
70768         b_conv.inner = untag_ptr(b);
70769         b_conv.is_owned = ptr_is_owned(b);
70770         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70771         b_conv.is_owned = false;
70772         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
70773         return ret_conv;
70774 }
70775
70776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferId_1write(JNIEnv *env, jclass clz, int64_t obj) {
70777         LDKOfferId obj_conv;
70778         obj_conv.inner = untag_ptr(obj);
70779         obj_conv.is_owned = ptr_is_owned(obj);
70780         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70781         obj_conv.is_owned = false;
70782         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
70783         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70784         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70785         CVec_u8Z_free(ret_var);
70786         return ret_arr;
70787 }
70788
70789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70790         LDKu8slice ser_ref;
70791         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70792         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70793         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
70794         *ret_conv = OfferId_read(ser_ref);
70795         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70796         return tag_ptr(ret_conv, true);
70797 }
70798
70799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70800         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
70801         this_obj_conv.inner = untag_ptr(this_obj);
70802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70804         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
70805 }
70806
70807 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
70808         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
70809         int64_t ret_ref = 0;
70810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70812         return ret_ref;
70813 }
70814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70815         LDKOfferWithExplicitMetadataBuilder arg_conv;
70816         arg_conv.inner = untag_ptr(arg);
70817         arg_conv.is_owned = ptr_is_owned(arg);
70818         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70819         arg_conv.is_owned = false;
70820         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
70821         return ret_conv;
70822 }
70823
70824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70825         LDKOfferWithExplicitMetadataBuilder orig_conv;
70826         orig_conv.inner = untag_ptr(orig);
70827         orig_conv.is_owned = ptr_is_owned(orig);
70828         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70829         orig_conv.is_owned = false;
70830         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
70831         int64_t ret_ref = 0;
70832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70834         return ret_ref;
70835 }
70836
70837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70838         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
70839         this_obj_conv.inner = untag_ptr(this_obj);
70840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70842         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
70843 }
70844
70845 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
70846         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
70847         int64_t ret_ref = 0;
70848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70850         return ret_ref;
70851 }
70852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70853         LDKOfferWithDerivedMetadataBuilder arg_conv;
70854         arg_conv.inner = untag_ptr(arg);
70855         arg_conv.is_owned = ptr_is_owned(arg);
70856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70857         arg_conv.is_owned = false;
70858         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
70859         return ret_conv;
70860 }
70861
70862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70863         LDKOfferWithDerivedMetadataBuilder orig_conv;
70864         orig_conv.inner = untag_ptr(orig);
70865         orig_conv.is_owned = ptr_is_owned(orig);
70866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70867         orig_conv.is_owned = false;
70868         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
70869         int64_t ret_ref = 0;
70870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70872         return ret_ref;
70873 }
70874
70875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1new(JNIEnv *env, jclass clz, int8_tArray signing_pubkey) {
70876         LDKPublicKey signing_pubkey_ref;
70877         CHECK((*env)->GetArrayLength(env, signing_pubkey) == 33);
70878         (*env)->GetByteArrayRegion(env, signing_pubkey, 0, 33, signing_pubkey_ref.compressed_form);
70879         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
70880         int64_t ret_ref = 0;
70881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70883         return ret_ref;
70884 }
70885
70886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1metadata(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray metadata) {
70887         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70888         this_arg_conv.inner = untag_ptr(this_arg);
70889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70891         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70892         LDKCVec_u8Z metadata_ref;
70893         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
70894         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
70895         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
70896         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
70897         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
70898         return tag_ptr(ret_conv, true);
70899 }
70900
70901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
70902         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70903         this_arg_conv.inner = untag_ptr(this_arg);
70904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70906         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70907         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
70908         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
70909 }
70910
70911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
70912         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70913         this_arg_conv.inner = untag_ptr(this_arg);
70914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70916         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70917         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
70918 }
70919
70920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
70921         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70922         this_arg_conv.inner = untag_ptr(this_arg);
70923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70925         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70926         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
70927 }
70928
70929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
70930         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70931         this_arg_conv.inner = untag_ptr(this_arg);
70932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70934         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70935         LDKStr description_conv = java_to_owned_str(env, description);
70936         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
70937 }
70938
70939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
70940         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70941         this_arg_conv.inner = untag_ptr(this_arg);
70942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70944         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70945         LDKStr issuer_conv = java_to_owned_str(env, issuer);
70946         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
70947 }
70948
70949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
70950         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70951         this_arg_conv.inner = untag_ptr(this_arg);
70952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70954         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70955         LDKBlindedPath path_conv;
70956         path_conv.inner = untag_ptr(path);
70957         path_conv.is_owned = ptr_is_owned(path);
70958         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70959         path_conv = BlindedPath_clone(&path_conv);
70960         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
70961 }
70962
70963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
70964         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70965         this_arg_conv.inner = untag_ptr(this_arg);
70966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70968         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70969         void* quantity_ptr = untag_ptr(quantity);
70970         CHECK_ACCESS(quantity_ptr);
70971         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
70972         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
70973         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
70974 }
70975
70976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
70977         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
70978         this_arg_conv.inner = untag_ptr(this_arg);
70979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70981         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
70982         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
70983         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
70984         return tag_ptr(ret_conv, true);
70985 }
70986
70987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1deriving_1signing_1pubkey(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t expanded_key, int64_t entropy_source) {
70988         LDKPublicKey node_id_ref;
70989         CHECK((*env)->GetArrayLength(env, node_id) == 33);
70990         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
70991         LDKExpandedKey expanded_key_conv;
70992         expanded_key_conv.inner = untag_ptr(expanded_key);
70993         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
70994         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
70995         expanded_key_conv.is_owned = false;
70996         void* entropy_source_ptr = untag_ptr(entropy_source);
70997         CHECK_ACCESS(entropy_source_ptr);
70998         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70999         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
71000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71001                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
71002         }
71003         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
71004         int64_t ret_ref = 0;
71005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71007         return ret_ref;
71008 }
71009
71010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
71011         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71012         this_arg_conv.inner = untag_ptr(this_arg);
71013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71015         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71016         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
71017         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
71018 }
71019
71020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
71021         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71022         this_arg_conv.inner = untag_ptr(this_arg);
71023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71025         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71026         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
71027 }
71028
71029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
71030         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71031         this_arg_conv.inner = untag_ptr(this_arg);
71032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71034         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71035         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
71036 }
71037
71038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
71039         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71040         this_arg_conv.inner = untag_ptr(this_arg);
71041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71043         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71044         LDKStr description_conv = java_to_owned_str(env, description);
71045         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
71046 }
71047
71048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
71049         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71050         this_arg_conv.inner = untag_ptr(this_arg);
71051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71053         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71054         LDKStr issuer_conv = java_to_owned_str(env, issuer);
71055         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
71056 }
71057
71058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
71059         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71060         this_arg_conv.inner = untag_ptr(this_arg);
71061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71063         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71064         LDKBlindedPath path_conv;
71065         path_conv.inner = untag_ptr(path);
71066         path_conv.is_owned = ptr_is_owned(path);
71067         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71068         path_conv = BlindedPath_clone(&path_conv);
71069         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
71070 }
71071
71072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
71073         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71074         this_arg_conv.inner = untag_ptr(this_arg);
71075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71077         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71078         void* quantity_ptr = untag_ptr(quantity);
71079         CHECK_ACCESS(quantity_ptr);
71080         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
71081         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
71082         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
71083 }
71084
71085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
71086         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
71087         this_arg_conv.inner = untag_ptr(this_arg);
71088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71090         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
71091         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
71092         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
71093         return tag_ptr(ret_conv, true);
71094 }
71095
71096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71097         LDKOffer this_obj_conv;
71098         this_obj_conv.inner = untag_ptr(this_obj);
71099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71101         Offer_free(this_obj_conv);
71102 }
71103
71104 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
71105         LDKOffer ret_var = Offer_clone(arg);
71106         int64_t ret_ref = 0;
71107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71109         return ret_ref;
71110 }
71111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71112         LDKOffer arg_conv;
71113         arg_conv.inner = untag_ptr(arg);
71114         arg_conv.is_owned = ptr_is_owned(arg);
71115         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71116         arg_conv.is_owned = false;
71117         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
71118         return ret_conv;
71119 }
71120
71121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71122         LDKOffer orig_conv;
71123         orig_conv.inner = untag_ptr(orig);
71124         orig_conv.is_owned = ptr_is_owned(orig);
71125         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71126         orig_conv.is_owned = false;
71127         LDKOffer ret_var = Offer_clone(&orig_conv);
71128         int64_t ret_ref = 0;
71129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71131         return ret_ref;
71132 }
71133
71134 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
71135         LDKOffer this_arg_conv;
71136         this_arg_conv.inner = untag_ptr(this_arg);
71137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71139         this_arg_conv.is_owned = false;
71140         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
71141         jobjectArray ret_arr = NULL;
71142         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
71143         ;
71144         for (size_t i = 0; i < ret_var.datalen; i++) {
71145                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
71146                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
71147                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
71148         }
71149         
71150         FREE(ret_var.data);
71151         return ret_arr;
71152 }
71153
71154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71155         LDKOffer this_arg_conv;
71156         this_arg_conv.inner = untag_ptr(this_arg);
71157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71159         this_arg_conv.is_owned = false;
71160         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71161         *ret_copy = Offer_metadata(&this_arg_conv);
71162         int64_t ret_ref = tag_ptr(ret_copy, true);
71163         return ret_ref;
71164 }
71165
71166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
71167         LDKOffer this_arg_conv;
71168         this_arg_conv.inner = untag_ptr(this_arg);
71169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71171         this_arg_conv.is_owned = false;
71172         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
71173         *ret_copy = Offer_amount(&this_arg_conv);
71174         int64_t ret_ref = tag_ptr(ret_copy, true);
71175         return ret_ref;
71176 }
71177
71178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
71179         LDKOffer this_arg_conv;
71180         this_arg_conv.inner = untag_ptr(this_arg);
71181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71183         this_arg_conv.is_owned = false;
71184         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
71185         int64_t ret_ref = 0;
71186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71188         return ret_ref;
71189 }
71190
71191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71192         LDKOffer this_arg_conv;
71193         this_arg_conv.inner = untag_ptr(this_arg);
71194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71196         this_arg_conv.is_owned = false;
71197         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
71198         int64_t ret_ref = 0;
71199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71201         return ret_ref;
71202 }
71203
71204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
71205         LDKOffer this_arg_conv;
71206         this_arg_conv.inner = untag_ptr(this_arg);
71207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71209         this_arg_conv.is_owned = false;
71210         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71211         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
71212         int64_t ret_ref = tag_ptr(ret_copy, true);
71213         return ret_ref;
71214 }
71215
71216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
71217         LDKOffer this_arg_conv;
71218         this_arg_conv.inner = untag_ptr(this_arg);
71219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71221         this_arg_conv.is_owned = false;
71222         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
71223         int64_t ret_ref = 0;
71224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71226         return ret_ref;
71227 }
71228
71229 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
71230         LDKOffer this_arg_conv;
71231         this_arg_conv.inner = untag_ptr(this_arg);
71232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71234         this_arg_conv.is_owned = false;
71235         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
71236         int64_tArray ret_arr = NULL;
71237         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
71238         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
71239         for (size_t n = 0; n < ret_var.datalen; n++) {
71240                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
71241                 int64_t ret_conv_13_ref = 0;
71242                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
71243                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
71244                 ret_arr_ptr[n] = ret_conv_13_ref;
71245         }
71246         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
71247         FREE(ret_var.data);
71248         return ret_arr;
71249 }
71250
71251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71252         LDKOffer this_arg_conv;
71253         this_arg_conv.inner = untag_ptr(this_arg);
71254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71256         this_arg_conv.is_owned = false;
71257         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71258         *ret_copy = Offer_supported_quantity(&this_arg_conv);
71259         int64_t ret_ref = tag_ptr(ret_copy, true);
71260         return ret_ref;
71261 }
71262
71263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
71264         LDKOffer this_arg_conv;
71265         this_arg_conv.inner = untag_ptr(this_arg);
71266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71268         this_arg_conv.is_owned = false;
71269         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71270         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
71271         return ret_arr;
71272 }
71273
71274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
71275         LDKOffer this_arg_conv;
71276         this_arg_conv.inner = untag_ptr(this_arg);
71277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71279         this_arg_conv.is_owned = false;
71280         LDKOfferId ret_var = Offer_id(&this_arg_conv);
71281         int64_t ret_ref = 0;
71282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71284         return ret_ref;
71285 }
71286
71287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
71288         LDKOffer this_arg_conv;
71289         this_arg_conv.inner = untag_ptr(this_arg);
71290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71292         this_arg_conv.is_owned = false;
71293         LDKThirtyTwoBytes chain_ref;
71294         CHECK((*env)->GetArrayLength(env, chain) == 32);
71295         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
71296         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
71297         return ret_conv;
71298 }
71299
71300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
71301         LDKOffer this_arg_conv;
71302         this_arg_conv.inner = untag_ptr(this_arg);
71303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71305         this_arg_conv.is_owned = false;
71306         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
71307         return ret_conv;
71308 }
71309
71310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
71311         LDKOffer this_arg_conv;
71312         this_arg_conv.inner = untag_ptr(this_arg);
71313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71315         this_arg_conv.is_owned = false;
71316         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
71317         return ret_conv;
71318 }
71319
71320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
71321         LDKOffer this_arg_conv;
71322         this_arg_conv.inner = untag_ptr(this_arg);
71323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71325         this_arg_conv.is_owned = false;
71326         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
71327         return ret_conv;
71328 }
71329
71330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71331         LDKOffer this_arg_conv;
71332         this_arg_conv.inner = untag_ptr(this_arg);
71333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71335         this_arg_conv.is_owned = false;
71336         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
71337         return ret_conv;
71338 }
71339
71340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice_1deriving_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
71341         LDKOffer this_arg_conv;
71342         this_arg_conv.inner = untag_ptr(this_arg);
71343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71345         this_arg_conv.is_owned = false;
71346         LDKExpandedKey expanded_key_conv;
71347         expanded_key_conv.inner = untag_ptr(expanded_key);
71348         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
71349         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
71350         expanded_key_conv.is_owned = false;
71351         void* entropy_source_ptr = untag_ptr(entropy_source);
71352         CHECK_ACCESS(entropy_source_ptr);
71353         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
71354         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
71355                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71356                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
71357         }
71358         LDKThirtyTwoBytes payment_id_ref;
71359         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71360         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71361         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
71362         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
71363         return tag_ptr(ret_conv, true);
71364 }
71365
71366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice_1deriving_1metadata(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer_id, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
71367         LDKOffer this_arg_conv;
71368         this_arg_conv.inner = untag_ptr(this_arg);
71369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71371         this_arg_conv.is_owned = false;
71372         LDKPublicKey payer_id_ref;
71373         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
71374         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
71375         LDKExpandedKey expanded_key_conv;
71376         expanded_key_conv.inner = untag_ptr(expanded_key);
71377         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
71378         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
71379         expanded_key_conv.is_owned = false;
71380         void* entropy_source_ptr = untag_ptr(entropy_source);
71381         CHECK_ACCESS(entropy_source_ptr);
71382         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
71383         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
71384                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71385                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
71386         }
71387         LDKThirtyTwoBytes payment_id_ref;
71388         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71389         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71390         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
71391         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
71392         return tag_ptr(ret_conv, true);
71393 }
71394
71395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
71396         LDKOffer this_arg_conv;
71397         this_arg_conv.inner = untag_ptr(this_arg);
71398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71400         this_arg_conv.is_owned = false;
71401         LDKCVec_u8Z metadata_ref;
71402         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
71403         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
71404         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
71405         LDKPublicKey payer_id_ref;
71406         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
71407         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
71408         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
71409         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
71410         return tag_ptr(ret_conv, true);
71411 }
71412
71413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1hash(JNIEnv *env, jclass clz, int64_t o) {
71414         LDKOffer o_conv;
71415         o_conv.inner = untag_ptr(o);
71416         o_conv.is_owned = ptr_is_owned(o);
71417         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71418         o_conv.is_owned = false;
71419         int64_t ret_conv = Offer_hash(&o_conv);
71420         return ret_conv;
71421 }
71422
71423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
71424         LDKOffer obj_conv;
71425         obj_conv.inner = untag_ptr(obj);
71426         obj_conv.is_owned = ptr_is_owned(obj);
71427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71428         obj_conv.is_owned = false;
71429         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
71430         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71431         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71432         CVec_u8Z_free(ret_var);
71433         return ret_arr;
71434 }
71435
71436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71437         if (!ptr_is_owned(this_ptr)) return;
71438         void* this_ptr_ptr = untag_ptr(this_ptr);
71439         CHECK_ACCESS(this_ptr_ptr);
71440         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
71441         FREE(untag_ptr(this_ptr));
71442         Amount_free(this_ptr_conv);
71443 }
71444
71445 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
71446         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
71447         *ret_copy = Amount_clone(arg);
71448         int64_t ret_ref = tag_ptr(ret_copy, true);
71449         return ret_ref;
71450 }
71451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71452         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
71453         int64_t ret_conv = Amount_clone_ptr(arg_conv);
71454         return ret_conv;
71455 }
71456
71457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71458         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
71459         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
71460         *ret_copy = Amount_clone(orig_conv);
71461         int64_t ret_ref = tag_ptr(ret_copy, true);
71462         return ret_ref;
71463 }
71464
71465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1bitcoin(JNIEnv *env, jclass clz, int64_t amount_msats) {
71466         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
71467         *ret_copy = Amount_bitcoin(amount_msats);
71468         int64_t ret_ref = tag_ptr(ret_copy, true);
71469         return ret_ref;
71470 }
71471
71472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1currency(JNIEnv *env, jclass clz, int8_tArray iso4217_code, int64_t amount) {
71473         LDKThreeBytes iso4217_code_ref;
71474         CHECK((*env)->GetArrayLength(env, iso4217_code) == 3);
71475         (*env)->GetByteArrayRegion(env, iso4217_code, 0, 3, iso4217_code_ref.data);
71476         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
71477         *ret_copy = Amount_currency(iso4217_code_ref, amount);
71478         int64_t ret_ref = tag_ptr(ret_copy, true);
71479         return ret_ref;
71480 }
71481
71482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71483         if (!ptr_is_owned(this_ptr)) return;
71484         void* this_ptr_ptr = untag_ptr(this_ptr);
71485         CHECK_ACCESS(this_ptr_ptr);
71486         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
71487         FREE(untag_ptr(this_ptr));
71488         Quantity_free(this_ptr_conv);
71489 }
71490
71491 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
71492         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71493         *ret_copy = Quantity_clone(arg);
71494         int64_t ret_ref = tag_ptr(ret_copy, true);
71495         return ret_ref;
71496 }
71497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71498         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
71499         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
71500         return ret_conv;
71501 }
71502
71503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71504         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
71505         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71506         *ret_copy = Quantity_clone(orig_conv);
71507         int64_t ret_ref = tag_ptr(ret_copy, true);
71508         return ret_ref;
71509 }
71510
71511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1bounded(JNIEnv *env, jclass clz, int64_t a) {
71512         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71513         *ret_copy = Quantity_bounded(a);
71514         int64_t ret_ref = tag_ptr(ret_copy, true);
71515         return ret_ref;
71516 }
71517
71518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1unbounded(JNIEnv *env, jclass clz) {
71519         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71520         *ret_copy = Quantity_unbounded();
71521         int64_t ret_ref = tag_ptr(ret_copy, true);
71522         return ret_ref;
71523 }
71524
71525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1one(JNIEnv *env, jclass clz) {
71526         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71527         *ret_copy = Quantity_one();
71528         int64_t ret_ref = tag_ptr(ret_copy, true);
71529         return ret_ref;
71530 }
71531
71532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
71533         LDKStr s_conv = java_to_owned_str(env, s);
71534         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
71535         *ret_conv = Offer_from_str(s_conv);
71536         return tag_ptr(ret_conv, true);
71537 }
71538
71539 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Offer_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
71540         LDKOffer o_conv;
71541         o_conv.inner = untag_ptr(o);
71542         o_conv.is_owned = ptr_is_owned(o);
71543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71544         o_conv.is_owned = false;
71545         LDKStr ret_str = Offer_to_str(&o_conv);
71546         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
71547         Str_free(ret_str);
71548         return ret_conv;
71549 }
71550
71551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71552         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
71553         this_obj_conv.inner = untag_ptr(this_obj);
71554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71556         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
71557 }
71558
71559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71560         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
71561         this_obj_conv.inner = untag_ptr(this_obj);
71562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71564         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
71565 }
71566
71567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
71568         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
71569         this_arg_conv.inner = untag_ptr(this_arg);
71570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71572         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
71573         
71574         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
71575         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
71576         return tag_ptr(ret_conv, true);
71577 }
71578
71579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int32_t relative_expiry_secs) {
71580         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
71581         this_arg_conv.inner = untag_ptr(this_arg);
71582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71584         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
71585         
71586         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
71587 }
71588
71589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v0_1p2wsh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray script_hash) {
71590         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
71591         this_arg_conv.inner = untag_ptr(this_arg);
71592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71594         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
71595         
71596         uint8_t script_hash_arr[32];
71597         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
71598         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
71599         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
71600         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
71601 }
71602
71603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v0_1p2wpkh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey_hash) {
71604         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
71605         this_arg_conv.inner = untag_ptr(this_arg);
71606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71608         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
71609         
71610         uint8_t pubkey_hash_arr[20];
71611         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
71612         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
71613         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
71614         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
71615 }
71616
71617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v1_1p2tr_1tweaked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray utput_key) {
71618         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
71619         this_arg_conv.inner = untag_ptr(this_arg);
71620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71622         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
71623         
71624         LDKTweakedPublicKey utput_key_ref;
71625         CHECK((*env)->GetArrayLength(env, utput_key) == 32);
71626         (*env)->GetByteArrayRegion(env, utput_key, 0, 32, utput_key_ref.x_coordinate);
71627         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
71628 }
71629
71630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1allow_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
71631         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
71632         this_arg_conv.inner = untag_ptr(this_arg);
71633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71635         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
71636         
71637         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
71638 }
71639
71640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1build_1and_1sign(JNIEnv *env, jclass clz, int64_t this_arg) {
71641         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
71642         this_arg_conv.inner = untag_ptr(this_arg);
71643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71645         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
71646         
71647         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
71648         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
71649         return tag_ptr(ret_conv, true);
71650 }
71651
71652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int32_t relative_expiry_secs) {
71653         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
71654         this_arg_conv.inner = untag_ptr(this_arg);
71655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71657         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
71658         
71659         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
71660 }
71661
71662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v0_1p2wsh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray script_hash) {
71663         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
71664         this_arg_conv.inner = untag_ptr(this_arg);
71665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71667         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
71668         
71669         uint8_t script_hash_arr[32];
71670         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
71671         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
71672         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
71673         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
71674 }
71675
71676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v0_1p2wpkh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey_hash) {
71677         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
71678         this_arg_conv.inner = untag_ptr(this_arg);
71679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71681         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
71682         
71683         uint8_t pubkey_hash_arr[20];
71684         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
71685         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
71686         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
71687         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
71688 }
71689
71690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v1_1p2tr_1tweaked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray utput_key) {
71691         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
71692         this_arg_conv.inner = untag_ptr(this_arg);
71693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71695         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
71696         
71697         LDKTweakedPublicKey utput_key_ref;
71698         CHECK((*env)->GetArrayLength(env, utput_key) == 32);
71699         (*env)->GetByteArrayRegion(env, utput_key, 0, 32, utput_key_ref.x_coordinate);
71700         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
71701 }
71702
71703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1allow_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
71704         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
71705         this_arg_conv.inner = untag_ptr(this_arg);
71706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71708         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
71709         
71710         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
71711 }
71712
71713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71714         LDKUnsignedBolt12Invoice this_obj_conv;
71715         this_obj_conv.inner = untag_ptr(this_obj);
71716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71718         UnsignedBolt12Invoice_free(this_obj_conv);
71719 }
71720
71721 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
71722         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
71723         int64_t ret_ref = 0;
71724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71726         return ret_ref;
71727 }
71728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71729         LDKUnsignedBolt12Invoice arg_conv;
71730         arg_conv.inner = untag_ptr(arg);
71731         arg_conv.is_owned = ptr_is_owned(arg);
71732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71733         arg_conv.is_owned = false;
71734         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
71735         return ret_conv;
71736 }
71737
71738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71739         LDKUnsignedBolt12Invoice orig_conv;
71740         orig_conv.inner = untag_ptr(orig);
71741         orig_conv.is_owned = ptr_is_owned(orig);
71742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71743         orig_conv.is_owned = false;
71744         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
71745         int64_t ret_ref = 0;
71746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71748         return ret_ref;
71749 }
71750
71751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignBolt12InvoiceFn_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71752         if (!ptr_is_owned(this_ptr)) return;
71753         void* this_ptr_ptr = untag_ptr(this_ptr);
71754         CHECK_ACCESS(this_ptr_ptr);
71755         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
71756         FREE(untag_ptr(this_ptr));
71757         SignBolt12InvoiceFn_free(this_ptr_conv);
71758 }
71759
71760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
71761         LDKUnsignedBolt12Invoice this_arg_conv;
71762         this_arg_conv.inner = untag_ptr(this_arg);
71763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71765         this_arg_conv.is_owned = false;
71766         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
71767         int64_t ret_ref = 0;
71768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71770         return ret_ref;
71771 }
71772
71773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71774         LDKBolt12Invoice this_obj_conv;
71775         this_obj_conv.inner = untag_ptr(this_obj);
71776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71778         Bolt12Invoice_free(this_obj_conv);
71779 }
71780
71781 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
71782         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
71783         int64_t ret_ref = 0;
71784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71786         return ret_ref;
71787 }
71788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71789         LDKBolt12Invoice arg_conv;
71790         arg_conv.inner = untag_ptr(arg);
71791         arg_conv.is_owned = ptr_is_owned(arg);
71792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71793         arg_conv.is_owned = false;
71794         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
71795         return ret_conv;
71796 }
71797
71798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71799         LDKBolt12Invoice orig_conv;
71800         orig_conv.inner = untag_ptr(orig);
71801         orig_conv.is_owned = ptr_is_owned(orig);
71802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71803         orig_conv.is_owned = false;
71804         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
71805         int64_t ret_ref = 0;
71806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71808         return ret_ref;
71809 }
71810
71811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
71812         LDKUnsignedBolt12Invoice this_arg_conv;
71813         this_arg_conv.inner = untag_ptr(this_arg);
71814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71816         this_arg_conv.is_owned = false;
71817         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
71818         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
71819         int64_t ret_ref = tag_ptr(ret_copy, true);
71820         return ret_ref;
71821 }
71822
71823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
71824         LDKUnsignedBolt12Invoice this_arg_conv;
71825         this_arg_conv.inner = untag_ptr(this_arg);
71826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71828         this_arg_conv.is_owned = false;
71829         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
71830         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
71831         return ret_arr;
71832 }
71833
71834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71835         LDKUnsignedBolt12Invoice 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71841         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
71842         int64_t ret_ref = tag_ptr(ret_copy, true);
71843         return ret_ref;
71844 }
71845
71846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
71847         LDKUnsignedBolt12Invoice this_arg_conv;
71848         this_arg_conv.inner = untag_ptr(this_arg);
71849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71851         this_arg_conv.is_owned = false;
71852         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
71853         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
71854         int64_t ret_ref = tag_ptr(ret_copy, true);
71855         return ret_ref;
71856 }
71857
71858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71859         LDKUnsignedBolt12Invoice this_arg_conv;
71860         this_arg_conv.inner = untag_ptr(this_arg);
71861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71863         this_arg_conv.is_owned = false;
71864         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
71865         int64_t ret_ref = 0;
71866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71868         return ret_ref;
71869 }
71870
71871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
71872         LDKUnsignedBolt12Invoice this_arg_conv;
71873         this_arg_conv.inner = untag_ptr(this_arg);
71874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71876         this_arg_conv.is_owned = false;
71877         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
71878         int64_t ret_ref = 0;
71879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71881         return ret_ref;
71882 }
71883
71884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
71885         LDKUnsignedBolt12Invoice this_arg_conv;
71886         this_arg_conv.inner = untag_ptr(this_arg);
71887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71889         this_arg_conv.is_owned = false;
71890         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71891         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
71892         int64_t ret_ref = tag_ptr(ret_copy, true);
71893         return ret_ref;
71894 }
71895
71896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
71897         LDKUnsignedBolt12Invoice this_arg_conv;
71898         this_arg_conv.inner = untag_ptr(this_arg);
71899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71901         this_arg_conv.is_owned = false;
71902         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
71903         int64_t ret_ref = 0;
71904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71906         return ret_ref;
71907 }
71908
71909 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
71910         LDKUnsignedBolt12Invoice this_arg_conv;
71911         this_arg_conv.inner = untag_ptr(this_arg);
71912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71914         this_arg_conv.is_owned = false;
71915         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
71916         int64_tArray ret_arr = NULL;
71917         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
71918         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
71919         for (size_t n = 0; n < ret_var.datalen; n++) {
71920                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
71921                 int64_t ret_conv_13_ref = 0;
71922                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
71923                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
71924                 ret_arr_ptr[n] = ret_conv_13_ref;
71925         }
71926         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
71927         FREE(ret_var.data);
71928         return ret_arr;
71929 }
71930
71931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71932         LDKUnsignedBolt12Invoice this_arg_conv;
71933         this_arg_conv.inner = untag_ptr(this_arg);
71934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71936         this_arg_conv.is_owned = false;
71937         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
71938         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
71939         int64_t ret_ref = tag_ptr(ret_copy, true);
71940         return ret_ref;
71941 }
71942
71943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71944         LDKUnsignedBolt12Invoice this_arg_conv;
71945         this_arg_conv.inner = untag_ptr(this_arg);
71946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71948         this_arg_conv.is_owned = false;
71949         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
71950         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71951         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71952         return ret_arr;
71953 }
71954
71955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71956         LDKUnsignedBolt12Invoice this_arg_conv;
71957         this_arg_conv.inner = untag_ptr(this_arg);
71958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71960         this_arg_conv.is_owned = false;
71961         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
71962         int64_t ret_ref = 0;
71963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71965         return ret_ref;
71966 }
71967
71968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71969         LDKUnsignedBolt12Invoice this_arg_conv;
71970         this_arg_conv.inner = untag_ptr(this_arg);
71971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71973         this_arg_conv.is_owned = false;
71974         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71975         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
71976         int64_t ret_ref = tag_ptr(ret_copy, true);
71977         return ret_ref;
71978 }
71979
71980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
71981         LDKUnsignedBolt12Invoice this_arg_conv;
71982         this_arg_conv.inner = untag_ptr(this_arg);
71983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71985         this_arg_conv.is_owned = false;
71986         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71987         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
71988         return ret_arr;
71989 }
71990
71991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
71992         LDKUnsignedBolt12Invoice this_arg_conv;
71993         this_arg_conv.inner = untag_ptr(this_arg);
71994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71996         this_arg_conv.is_owned = false;
71997         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
71998         int64_t ret_ref = 0;
71999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72001         return ret_ref;
72002 }
72003
72004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
72005         LDKUnsignedBolt12Invoice this_arg_conv;
72006         this_arg_conv.inner = untag_ptr(this_arg);
72007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72009         this_arg_conv.is_owned = false;
72010         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
72011         return ret_conv;
72012 }
72013
72014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72015         LDKUnsignedBolt12Invoice this_arg_conv;
72016         this_arg_conv.inner = untag_ptr(this_arg);
72017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72019         this_arg_conv.is_owned = false;
72020         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
72021         return ret_conv;
72022 }
72023
72024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
72025         LDKUnsignedBolt12Invoice this_arg_conv;
72026         this_arg_conv.inner = untag_ptr(this_arg);
72027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72029         this_arg_conv.is_owned = false;
72030         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
72031         return ret_conv;
72032 }
72033
72034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
72035         LDKUnsignedBolt12Invoice this_arg_conv;
72036         this_arg_conv.inner = untag_ptr(this_arg);
72037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72039         this_arg_conv.is_owned = false;
72040         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72041         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
72042         return ret_arr;
72043 }
72044
72045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
72046         LDKUnsignedBolt12Invoice this_arg_conv;
72047         this_arg_conv.inner = untag_ptr(this_arg);
72048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72050         this_arg_conv.is_owned = false;
72051         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
72052         return ret_conv;
72053 }
72054
72055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72056         LDKUnsignedBolt12Invoice this_arg_conv;
72057         this_arg_conv.inner = untag_ptr(this_arg);
72058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72060         this_arg_conv.is_owned = false;
72061         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
72062         int64_t ret_ref = 0;
72063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72065         return ret_ref;
72066 }
72067
72068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
72069         LDKUnsignedBolt12Invoice this_arg_conv;
72070         this_arg_conv.inner = untag_ptr(this_arg);
72071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72073         this_arg_conv.is_owned = false;
72074         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72075         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
72076         return ret_arr;
72077 }
72078
72079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
72080         LDKBolt12Invoice this_arg_conv;
72081         this_arg_conv.inner = untag_ptr(this_arg);
72082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72084         this_arg_conv.is_owned = false;
72085         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
72086         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
72087         int64_t ret_ref = tag_ptr(ret_copy, true);
72088         return ret_ref;
72089 }
72090
72091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
72092         LDKBolt12Invoice this_arg_conv;
72093         this_arg_conv.inner = untag_ptr(this_arg);
72094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72096         this_arg_conv.is_owned = false;
72097         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
72099         return ret_arr;
72100 }
72101
72102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72103         LDKBolt12Invoice this_arg_conv;
72104         this_arg_conv.inner = untag_ptr(this_arg);
72105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72107         this_arg_conv.is_owned = false;
72108         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
72109         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
72110         int64_t ret_ref = tag_ptr(ret_copy, true);
72111         return ret_ref;
72112 }
72113
72114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
72115         LDKBolt12Invoice this_arg_conv;
72116         this_arg_conv.inner = untag_ptr(this_arg);
72117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72119         this_arg_conv.is_owned = false;
72120         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
72121         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
72122         int64_t ret_ref = tag_ptr(ret_copy, true);
72123         return ret_ref;
72124 }
72125
72126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72127         LDKBolt12Invoice this_arg_conv;
72128         this_arg_conv.inner = untag_ptr(this_arg);
72129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72131         this_arg_conv.is_owned = false;
72132         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_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_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
72140         LDKBolt12Invoice this_arg_conv;
72141         this_arg_conv.inner = untag_ptr(this_arg);
72142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72144         this_arg_conv.is_owned = false;
72145         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
72146         int64_t ret_ref = 0;
72147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72149         return ret_ref;
72150 }
72151
72152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72153         LDKBolt12Invoice this_arg_conv;
72154         this_arg_conv.inner = untag_ptr(this_arg);
72155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72157         this_arg_conv.is_owned = false;
72158         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72159         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
72160         int64_t ret_ref = tag_ptr(ret_copy, true);
72161         return ret_ref;
72162 }
72163
72164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
72165         LDKBolt12Invoice this_arg_conv;
72166         this_arg_conv.inner = untag_ptr(this_arg);
72167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72169         this_arg_conv.is_owned = false;
72170         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
72171         int64_t ret_ref = 0;
72172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72174         return ret_ref;
72175 }
72176
72177 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
72178         LDKBolt12Invoice this_arg_conv;
72179         this_arg_conv.inner = untag_ptr(this_arg);
72180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72182         this_arg_conv.is_owned = false;
72183         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
72184         int64_tArray ret_arr = NULL;
72185         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72186         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72187         for (size_t n = 0; n < ret_var.datalen; n++) {
72188                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
72189                 int64_t ret_conv_13_ref = 0;
72190                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
72191                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
72192                 ret_arr_ptr[n] = ret_conv_13_ref;
72193         }
72194         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72195         FREE(ret_var.data);
72196         return ret_arr;
72197 }
72198
72199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72200         LDKBolt12Invoice this_arg_conv;
72201         this_arg_conv.inner = untag_ptr(this_arg);
72202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72204         this_arg_conv.is_owned = false;
72205         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
72206         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
72207         int64_t ret_ref = tag_ptr(ret_copy, true);
72208         return ret_ref;
72209 }
72210
72211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72212         LDKBolt12Invoice this_arg_conv;
72213         this_arg_conv.inner = untag_ptr(this_arg);
72214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72216         this_arg_conv.is_owned = false;
72217         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
72218         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72219         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72220         return ret_arr;
72221 }
72222
72223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72224         LDKBolt12Invoice this_arg_conv;
72225         this_arg_conv.inner = untag_ptr(this_arg);
72226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72228         this_arg_conv.is_owned = false;
72229         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
72230         int64_t ret_ref = 0;
72231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72233         return ret_ref;
72234 }
72235
72236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72237         LDKBolt12Invoice this_arg_conv;
72238         this_arg_conv.inner = untag_ptr(this_arg);
72239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72241         this_arg_conv.is_owned = false;
72242         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72243         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
72244         int64_t ret_ref = tag_ptr(ret_copy, true);
72245         return ret_ref;
72246 }
72247
72248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
72249         LDKBolt12Invoice this_arg_conv;
72250         this_arg_conv.inner = untag_ptr(this_arg);
72251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72253         this_arg_conv.is_owned = false;
72254         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72255         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
72256         return ret_arr;
72257 }
72258
72259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
72260         LDKBolt12Invoice this_arg_conv;
72261         this_arg_conv.inner = untag_ptr(this_arg);
72262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72264         this_arg_conv.is_owned = false;
72265         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
72266         int64_t ret_ref = 0;
72267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72269         return ret_ref;
72270 }
72271
72272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
72273         LDKBolt12Invoice this_arg_conv;
72274         this_arg_conv.inner = untag_ptr(this_arg);
72275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72277         this_arg_conv.is_owned = false;
72278         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
72279         return ret_conv;
72280 }
72281
72282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72283         LDKBolt12Invoice this_arg_conv;
72284         this_arg_conv.inner = untag_ptr(this_arg);
72285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72287         this_arg_conv.is_owned = false;
72288         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
72289         return ret_conv;
72290 }
72291
72292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
72293         LDKBolt12Invoice this_arg_conv;
72294         this_arg_conv.inner = untag_ptr(this_arg);
72295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72297         this_arg_conv.is_owned = false;
72298         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
72299         return ret_conv;
72300 }
72301
72302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
72303         LDKBolt12Invoice this_arg_conv;
72304         this_arg_conv.inner = untag_ptr(this_arg);
72305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72307         this_arg_conv.is_owned = false;
72308         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72309         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
72310         return ret_arr;
72311 }
72312
72313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
72314         LDKBolt12Invoice this_arg_conv;
72315         this_arg_conv.inner = untag_ptr(this_arg);
72316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72318         this_arg_conv.is_owned = false;
72319         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
72320         return ret_conv;
72321 }
72322
72323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72324         LDKBolt12Invoice this_arg_conv;
72325         this_arg_conv.inner = untag_ptr(this_arg);
72326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72328         this_arg_conv.is_owned = false;
72329         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
72330         int64_t ret_ref = 0;
72331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72333         return ret_ref;
72334 }
72335
72336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
72337         LDKBolt12Invoice this_arg_conv;
72338         this_arg_conv.inner = untag_ptr(this_arg);
72339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72341         this_arg_conv.is_owned = false;
72342         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72343         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
72344         return ret_arr;
72345 }
72346
72347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
72348         LDKBolt12Invoice this_arg_conv;
72349         this_arg_conv.inner = untag_ptr(this_arg);
72350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72352         this_arg_conv.is_owned = false;
72353         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
72354         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
72355         return ret_arr;
72356 }
72357
72358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
72359         LDKBolt12Invoice this_arg_conv;
72360         this_arg_conv.inner = untag_ptr(this_arg);
72361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72363         this_arg_conv.is_owned = false;
72364         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72365         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
72366         return ret_arr;
72367 }
72368
72369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
72370         LDKBolt12Invoice this_arg_conv;
72371         this_arg_conv.inner = untag_ptr(this_arg);
72372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72374         this_arg_conv.is_owned = false;
72375         LDKExpandedKey key_conv;
72376         key_conv.inner = untag_ptr(key);
72377         key_conv.is_owned = ptr_is_owned(key);
72378         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
72379         key_conv.is_owned = false;
72380         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
72381         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
72382         return tag_ptr(ret_conv, true);
72383 }
72384
72385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
72386         LDKBolt12Invoice o_conv;
72387         o_conv.inner = untag_ptr(o);
72388         o_conv.is_owned = ptr_is_owned(o);
72389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72390         o_conv.is_owned = false;
72391         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
72392         return ret_conv;
72393 }
72394
72395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
72396         LDKUnsignedBolt12Invoice obj_conv;
72397         obj_conv.inner = untag_ptr(obj);
72398         obj_conv.is_owned = ptr_is_owned(obj);
72399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72400         obj_conv.is_owned = false;
72401         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
72402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72404         CVec_u8Z_free(ret_var);
72405         return ret_arr;
72406 }
72407
72408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
72409         LDKBolt12Invoice obj_conv;
72410         obj_conv.inner = untag_ptr(obj);
72411         obj_conv.is_owned = ptr_is_owned(obj);
72412         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72413         obj_conv.is_owned = false;
72414         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
72415         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72416         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72417         CVec_u8Z_free(ret_var);
72418         return ret_arr;
72419 }
72420
72421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72422         LDKBlindedPayInfo this_obj_conv;
72423         this_obj_conv.inner = untag_ptr(this_obj);
72424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72426         BlindedPayInfo_free(this_obj_conv);
72427 }
72428
72429 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72430         LDKBlindedPayInfo this_ptr_conv;
72431         this_ptr_conv.inner = untag_ptr(this_ptr);
72432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72434         this_ptr_conv.is_owned = false;
72435         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
72436         return ret_conv;
72437 }
72438
72439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
72440         LDKBlindedPayInfo this_ptr_conv;
72441         this_ptr_conv.inner = untag_ptr(this_ptr);
72442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72444         this_ptr_conv.is_owned = false;
72445         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
72446 }
72447
72448 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
72449         LDKBlindedPayInfo this_ptr_conv;
72450         this_ptr_conv.inner = untag_ptr(this_ptr);
72451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72453         this_ptr_conv.is_owned = false;
72454         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
72455         return ret_conv;
72456 }
72457
72458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
72459         LDKBlindedPayInfo this_ptr_conv;
72460         this_ptr_conv.inner = untag_ptr(this_ptr);
72461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72463         this_ptr_conv.is_owned = false;
72464         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
72465 }
72466
72467 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
72468         LDKBlindedPayInfo this_ptr_conv;
72469         this_ptr_conv.inner = untag_ptr(this_ptr);
72470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72472         this_ptr_conv.is_owned = false;
72473         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
72474         return ret_conv;
72475 }
72476
72477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
72478         LDKBlindedPayInfo this_ptr_conv;
72479         this_ptr_conv.inner = untag_ptr(this_ptr);
72480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72482         this_ptr_conv.is_owned = false;
72483         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
72484 }
72485
72486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72487         LDKBlindedPayInfo this_ptr_conv;
72488         this_ptr_conv.inner = untag_ptr(this_ptr);
72489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72491         this_ptr_conv.is_owned = false;
72492         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
72493         return ret_conv;
72494 }
72495
72496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72497         LDKBlindedPayInfo this_ptr_conv;
72498         this_ptr_conv.inner = untag_ptr(this_ptr);
72499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72501         this_ptr_conv.is_owned = false;
72502         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
72503 }
72504
72505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72506         LDKBlindedPayInfo this_ptr_conv;
72507         this_ptr_conv.inner = untag_ptr(this_ptr);
72508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72510         this_ptr_conv.is_owned = false;
72511         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
72512         return ret_conv;
72513 }
72514
72515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72516         LDKBlindedPayInfo this_ptr_conv;
72517         this_ptr_conv.inner = untag_ptr(this_ptr);
72518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72520         this_ptr_conv.is_owned = false;
72521         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
72522 }
72523
72524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
72525         LDKBlindedPayInfo this_ptr_conv;
72526         this_ptr_conv.inner = untag_ptr(this_ptr);
72527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72529         this_ptr_conv.is_owned = false;
72530         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
72531         int64_t ret_ref = 0;
72532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72534         return ret_ref;
72535 }
72536
72537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72538         LDKBlindedPayInfo this_ptr_conv;
72539         this_ptr_conv.inner = untag_ptr(this_ptr);
72540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72542         this_ptr_conv.is_owned = false;
72543         LDKBlindedHopFeatures val_conv;
72544         val_conv.inner = untag_ptr(val);
72545         val_conv.is_owned = ptr_is_owned(val);
72546         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72547         val_conv = BlindedHopFeatures_clone(&val_conv);
72548         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
72549 }
72550
72551 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) {
72552         LDKBlindedHopFeatures features_arg_conv;
72553         features_arg_conv.inner = untag_ptr(features_arg);
72554         features_arg_conv.is_owned = ptr_is_owned(features_arg);
72555         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
72556         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
72557         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);
72558         int64_t ret_ref = 0;
72559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72561         return ret_ref;
72562 }
72563
72564 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
72565         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
72566         int64_t ret_ref = 0;
72567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72569         return ret_ref;
72570 }
72571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72572         LDKBlindedPayInfo arg_conv;
72573         arg_conv.inner = untag_ptr(arg);
72574         arg_conv.is_owned = ptr_is_owned(arg);
72575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72576         arg_conv.is_owned = false;
72577         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
72578         return ret_conv;
72579 }
72580
72581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72582         LDKBlindedPayInfo orig_conv;
72583         orig_conv.inner = untag_ptr(orig);
72584         orig_conv.is_owned = ptr_is_owned(orig);
72585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72586         orig_conv.is_owned = false;
72587         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
72588         int64_t ret_ref = 0;
72589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72591         return ret_ref;
72592 }
72593
72594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
72595         LDKBlindedPayInfo o_conv;
72596         o_conv.inner = untag_ptr(o);
72597         o_conv.is_owned = ptr_is_owned(o);
72598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72599         o_conv.is_owned = false;
72600         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
72601         return ret_conv;
72602 }
72603
72604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72605         LDKBlindedPayInfo a_conv;
72606         a_conv.inner = untag_ptr(a);
72607         a_conv.is_owned = ptr_is_owned(a);
72608         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72609         a_conv.is_owned = false;
72610         LDKBlindedPayInfo b_conv;
72611         b_conv.inner = untag_ptr(b);
72612         b_conv.is_owned = ptr_is_owned(b);
72613         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72614         b_conv.is_owned = false;
72615         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
72616         return ret_conv;
72617 }
72618
72619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
72620         LDKBlindedPayInfo obj_conv;
72621         obj_conv.inner = untag_ptr(obj);
72622         obj_conv.is_owned = ptr_is_owned(obj);
72623         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72624         obj_conv.is_owned = false;
72625         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
72626         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72627         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72628         CVec_u8Z_free(ret_var);
72629         return ret_arr;
72630 }
72631
72632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
72633         LDKu8slice ser_ref;
72634         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
72635         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
72636         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
72637         *ret_conv = BlindedPayInfo_read(ser_ref);
72638         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
72639         return tag_ptr(ret_conv, true);
72640 }
72641
72642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72643         LDKInvoiceError this_obj_conv;
72644         this_obj_conv.inner = untag_ptr(this_obj);
72645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72647         InvoiceError_free(this_obj_conv);
72648 }
72649
72650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
72651         LDKInvoiceError this_ptr_conv;
72652         this_ptr_conv.inner = untag_ptr(this_ptr);
72653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72655         this_ptr_conv.is_owned = false;
72656         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
72657         int64_t ret_ref = 0;
72658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72660         return ret_ref;
72661 }
72662
72663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72664         LDKInvoiceError this_ptr_conv;
72665         this_ptr_conv.inner = untag_ptr(this_ptr);
72666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72668         this_ptr_conv.is_owned = false;
72669         LDKErroneousField val_conv;
72670         val_conv.inner = untag_ptr(val);
72671         val_conv.is_owned = ptr_is_owned(val);
72672         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72673         val_conv = ErroneousField_clone(&val_conv);
72674         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
72675 }
72676
72677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
72678         LDKInvoiceError this_ptr_conv;
72679         this_ptr_conv.inner = untag_ptr(this_ptr);
72680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72682         this_ptr_conv.is_owned = false;
72683         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
72684         int64_t ret_ref = 0;
72685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72687         return ret_ref;
72688 }
72689
72690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72691         LDKInvoiceError this_ptr_conv;
72692         this_ptr_conv.inner = untag_ptr(this_ptr);
72693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72695         this_ptr_conv.is_owned = false;
72696         LDKUntrustedString val_conv;
72697         val_conv.inner = untag_ptr(val);
72698         val_conv.is_owned = ptr_is_owned(val);
72699         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72700         val_conv = UntrustedString_clone(&val_conv);
72701         InvoiceError_set_message(&this_ptr_conv, val_conv);
72702 }
72703
72704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
72705         LDKErroneousField erroneous_field_arg_conv;
72706         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
72707         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
72708         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
72709         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
72710         LDKUntrustedString message_arg_conv;
72711         message_arg_conv.inner = untag_ptr(message_arg);
72712         message_arg_conv.is_owned = ptr_is_owned(message_arg);
72713         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
72714         message_arg_conv = UntrustedString_clone(&message_arg_conv);
72715         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
72716         int64_t ret_ref = 0;
72717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72719         return ret_ref;
72720 }
72721
72722 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
72723         LDKInvoiceError ret_var = InvoiceError_clone(arg);
72724         int64_t ret_ref = 0;
72725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72727         return ret_ref;
72728 }
72729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72730         LDKInvoiceError arg_conv;
72731         arg_conv.inner = untag_ptr(arg);
72732         arg_conv.is_owned = ptr_is_owned(arg);
72733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72734         arg_conv.is_owned = false;
72735         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
72736         return ret_conv;
72737 }
72738
72739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72740         LDKInvoiceError orig_conv;
72741         orig_conv.inner = untag_ptr(orig);
72742         orig_conv.is_owned = ptr_is_owned(orig);
72743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72744         orig_conv.is_owned = false;
72745         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
72746         int64_t ret_ref = 0;
72747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72749         return ret_ref;
72750 }
72751
72752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72753         LDKErroneousField this_obj_conv;
72754         this_obj_conv.inner = untag_ptr(this_obj);
72755         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72757         ErroneousField_free(this_obj_conv);
72758 }
72759
72760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
72761         LDKErroneousField this_ptr_conv;
72762         this_ptr_conv.inner = untag_ptr(this_ptr);
72763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72765         this_ptr_conv.is_owned = false;
72766         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
72767         return ret_conv;
72768 }
72769
72770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72771         LDKErroneousField this_ptr_conv;
72772         this_ptr_conv.inner = untag_ptr(this_ptr);
72773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72775         this_ptr_conv.is_owned = false;
72776         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
72777 }
72778
72779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
72780         LDKErroneousField this_ptr_conv;
72781         this_ptr_conv.inner = untag_ptr(this_ptr);
72782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72784         this_ptr_conv.is_owned = false;
72785         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
72786         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
72787         int64_t ret_ref = tag_ptr(ret_copy, true);
72788         return ret_ref;
72789 }
72790
72791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72792         LDKErroneousField this_ptr_conv;
72793         this_ptr_conv.inner = untag_ptr(this_ptr);
72794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72796         this_ptr_conv.is_owned = false;
72797         void* val_ptr = untag_ptr(val);
72798         CHECK_ACCESS(val_ptr);
72799         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
72800         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
72801         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
72802 }
72803
72804 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) {
72805         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
72806         CHECK_ACCESS(suggested_value_arg_ptr);
72807         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
72808         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
72809         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
72810         int64_t ret_ref = 0;
72811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72813         return ret_ref;
72814 }
72815
72816 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
72817         LDKErroneousField ret_var = ErroneousField_clone(arg);
72818         int64_t ret_ref = 0;
72819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72821         return ret_ref;
72822 }
72823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72824         LDKErroneousField arg_conv;
72825         arg_conv.inner = untag_ptr(arg);
72826         arg_conv.is_owned = ptr_is_owned(arg);
72827         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72828         arg_conv.is_owned = false;
72829         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
72830         return ret_conv;
72831 }
72832
72833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72834         LDKErroneousField orig_conv;
72835         orig_conv.inner = untag_ptr(orig);
72836         orig_conv.is_owned = ptr_is_owned(orig);
72837         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72838         orig_conv.is_owned = false;
72839         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
72840         int64_t ret_ref = 0;
72841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72843         return ret_ref;
72844 }
72845
72846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
72847         LDKStr s_conv = java_to_owned_str(env, s);
72848         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
72849         int64_t ret_ref = 0;
72850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72852         return ret_ref;
72853 }
72854
72855 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_InvoiceError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
72856         LDKInvoiceError o_conv;
72857         o_conv.inner = untag_ptr(o);
72858         o_conv.is_owned = ptr_is_owned(o);
72859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72860         o_conv.is_owned = false;
72861         LDKStr ret_str = InvoiceError_to_str(&o_conv);
72862         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
72863         Str_free(ret_str);
72864         return ret_conv;
72865 }
72866
72867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
72868         LDKInvoiceError obj_conv;
72869         obj_conv.inner = untag_ptr(obj);
72870         obj_conv.is_owned = ptr_is_owned(obj);
72871         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72872         obj_conv.is_owned = false;
72873         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
72874         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72875         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72876         CVec_u8Z_free(ret_var);
72877         return ret_arr;
72878 }
72879
72880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
72881         LDKu8slice ser_ref;
72882         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
72883         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
72884         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
72885         *ret_conv = InvoiceError_read(ser_ref);
72886         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
72887         return tag_ptr(ret_conv, true);
72888 }
72889
72890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72891         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
72892         this_obj_conv.inner = untag_ptr(this_obj);
72893         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72895         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
72896 }
72897
72898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72899         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
72900         this_obj_conv.inner = untag_ptr(this_obj);
72901         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72903         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
72904 }
72905
72906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
72907         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
72908         this_arg_conv.inner = untag_ptr(this_arg);
72909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72911         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
72912         
72913         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
72914         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
72915         return tag_ptr(ret_conv, true);
72916 }
72917
72918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
72919         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
72920         this_arg_conv.inner = untag_ptr(this_arg);
72921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72923         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
72924         
72925         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
72926         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
72927         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
72928         return tag_ptr(ret_conv, true);
72929 }
72930
72931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
72932         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
72933         this_arg_conv.inner = untag_ptr(this_arg);
72934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72936         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
72937         
72938         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
72939         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
72940         return tag_ptr(ret_conv, true);
72941 }
72942
72943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
72944         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
72945         this_arg_conv.inner = untag_ptr(this_arg);
72946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72948         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
72949         
72950         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
72951         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
72952         return tag_ptr(ret_conv, true);
72953 }
72954
72955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
72956         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
72957         this_arg_conv.inner = untag_ptr(this_arg);
72958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72960         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
72961         
72962         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
72963         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
72964 }
72965
72966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1build_1and_1sign(JNIEnv *env, jclass clz, int64_t this_arg) {
72967         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
72968         this_arg_conv.inner = untag_ptr(this_arg);
72969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72971         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
72972         
72973         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
72974         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
72975         return tag_ptr(ret_conv, true);
72976 }
72977
72978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
72979         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
72980         this_arg_conv.inner = untag_ptr(this_arg);
72981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72983         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
72984         
72985         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
72986         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
72987         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
72988         return tag_ptr(ret_conv, true);
72989 }
72990
72991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
72992         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
72993         this_arg_conv.inner = untag_ptr(this_arg);
72994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72996         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
72997         
72998         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
72999         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
73000         return tag_ptr(ret_conv, true);
73001 }
73002
73003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
73004         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
73005         this_arg_conv.inner = untag_ptr(this_arg);
73006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73008         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
73009         
73010         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
73011         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
73012         return tag_ptr(ret_conv, true);
73013 }
73014
73015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
73016         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
73017         this_arg_conv.inner = untag_ptr(this_arg);
73018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73020         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
73021         
73022         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
73023         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
73024 }
73025
73026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73027         LDKUnsignedInvoiceRequest this_obj_conv;
73028         this_obj_conv.inner = untag_ptr(this_obj);
73029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73031         UnsignedInvoiceRequest_free(this_obj_conv);
73032 }
73033
73034 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
73035         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
73036         int64_t ret_ref = 0;
73037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73039         return ret_ref;
73040 }
73041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73042         LDKUnsignedInvoiceRequest arg_conv;
73043         arg_conv.inner = untag_ptr(arg);
73044         arg_conv.is_owned = ptr_is_owned(arg);
73045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73046         arg_conv.is_owned = false;
73047         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
73048         return ret_conv;
73049 }
73050
73051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73052         LDKUnsignedInvoiceRequest orig_conv;
73053         orig_conv.inner = untag_ptr(orig);
73054         orig_conv.is_owned = ptr_is_owned(orig);
73055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73056         orig_conv.is_owned = false;
73057         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
73058         int64_t ret_ref = 0;
73059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73061         return ret_ref;
73062 }
73063
73064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignInvoiceRequestFn_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73065         if (!ptr_is_owned(this_ptr)) return;
73066         void* this_ptr_ptr = untag_ptr(this_ptr);
73067         CHECK_ACCESS(this_ptr_ptr);
73068         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
73069         FREE(untag_ptr(this_ptr));
73070         SignInvoiceRequestFn_free(this_ptr_conv);
73071 }
73072
73073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
73074         LDKUnsignedInvoiceRequest this_arg_conv;
73075         this_arg_conv.inner = untag_ptr(this_arg);
73076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73078         this_arg_conv.is_owned = false;
73079         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
73080         int64_t ret_ref = 0;
73081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73083         return ret_ref;
73084 }
73085
73086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73087         LDKInvoiceRequest this_obj_conv;
73088         this_obj_conv.inner = untag_ptr(this_obj);
73089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73091         InvoiceRequest_free(this_obj_conv);
73092 }
73093
73094 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
73095         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
73096         int64_t ret_ref = 0;
73097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73099         return ret_ref;
73100 }
73101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73102         LDKInvoiceRequest arg_conv;
73103         arg_conv.inner = untag_ptr(arg);
73104         arg_conv.is_owned = ptr_is_owned(arg);
73105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73106         arg_conv.is_owned = false;
73107         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
73108         return ret_conv;
73109 }
73110
73111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73112         LDKInvoiceRequest orig_conv;
73113         orig_conv.inner = untag_ptr(orig);
73114         orig_conv.is_owned = ptr_is_owned(orig);
73115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73116         orig_conv.is_owned = false;
73117         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
73118         int64_t ret_ref = 0;
73119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73121         return ret_ref;
73122 }
73123
73124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73125         LDKVerifiedInvoiceRequest this_obj_conv;
73126         this_obj_conv.inner = untag_ptr(this_obj);
73127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73129         VerifiedInvoiceRequest_free(this_obj_conv);
73130 }
73131
73132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73133         LDKVerifiedInvoiceRequest this_ptr_conv;
73134         this_ptr_conv.inner = untag_ptr(this_ptr);
73135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73137         this_ptr_conv.is_owned = false;
73138         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
73139         int64_t ret_ref = 0;
73140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73142         return ret_ref;
73143 }
73144
73145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73146         LDKVerifiedInvoiceRequest this_ptr_conv;
73147         this_ptr_conv.inner = untag_ptr(this_ptr);
73148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73150         this_ptr_conv.is_owned = false;
73151         LDKOfferId val_conv;
73152         val_conv.inner = untag_ptr(val);
73153         val_conv.is_owned = ptr_is_owned(val);
73154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73155         val_conv = OfferId_clone(&val_conv);
73156         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
73157 }
73158
73159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
73160         LDKVerifiedInvoiceRequest this_ptr_conv;
73161         this_ptr_conv.inner = untag_ptr(this_ptr);
73162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73164         this_ptr_conv.is_owned = false;
73165         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
73166         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
73167         int64_t ret_ref = tag_ptr(ret_copy, true);
73168         return ret_ref;
73169 }
73170
73171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73172         LDKVerifiedInvoiceRequest this_ptr_conv;
73173         this_ptr_conv.inner = untag_ptr(this_ptr);
73174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73176         this_ptr_conv.is_owned = false;
73177         void* val_ptr = untag_ptr(val);
73178         CHECK_ACCESS(val_ptr);
73179         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
73180         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
73181         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
73182 }
73183
73184 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
73185         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
73186         int64_t ret_ref = 0;
73187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73189         return ret_ref;
73190 }
73191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73192         LDKVerifiedInvoiceRequest arg_conv;
73193         arg_conv.inner = untag_ptr(arg);
73194         arg_conv.is_owned = ptr_is_owned(arg);
73195         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73196         arg_conv.is_owned = false;
73197         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
73198         return ret_conv;
73199 }
73200
73201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73202         LDKVerifiedInvoiceRequest orig_conv;
73203         orig_conv.inner = untag_ptr(orig);
73204         orig_conv.is_owned = ptr_is_owned(orig);
73205         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73206         orig_conv.is_owned = false;
73207         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
73208         int64_t ret_ref = 0;
73209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73211         return ret_ref;
73212 }
73213
73214 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
73215         LDKUnsignedInvoiceRequest this_arg_conv;
73216         this_arg_conv.inner = untag_ptr(this_arg);
73217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73219         this_arg_conv.is_owned = false;
73220         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
73221         jobjectArray ret_arr = NULL;
73222         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
73223         ;
73224         for (size_t i = 0; i < ret_var.datalen; i++) {
73225                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
73226                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
73227                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
73228         }
73229         
73230         FREE(ret_var.data);
73231         return ret_arr;
73232 }
73233
73234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73235         LDKUnsignedInvoiceRequest this_arg_conv;
73236         this_arg_conv.inner = untag_ptr(this_arg);
73237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73239         this_arg_conv.is_owned = false;
73240         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73241         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
73242         int64_t ret_ref = tag_ptr(ret_copy, true);
73243         return ret_ref;
73244 }
73245
73246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
73247         LDKUnsignedInvoiceRequest this_arg_conv;
73248         this_arg_conv.inner = untag_ptr(this_arg);
73249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73251         this_arg_conv.is_owned = false;
73252         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
73253         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
73254         int64_t ret_ref = tag_ptr(ret_copy, true);
73255         return ret_ref;
73256 }
73257
73258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
73259         LDKUnsignedInvoiceRequest this_arg_conv;
73260         this_arg_conv.inner = untag_ptr(this_arg);
73261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73263         this_arg_conv.is_owned = false;
73264         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
73265         int64_t ret_ref = 0;
73266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73268         return ret_ref;
73269 }
73270
73271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73272         LDKUnsignedInvoiceRequest this_arg_conv;
73273         this_arg_conv.inner = untag_ptr(this_arg);
73274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73276         this_arg_conv.is_owned = false;
73277         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
73278         int64_t ret_ref = 0;
73279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73281         return ret_ref;
73282 }
73283
73284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
73285         LDKUnsignedInvoiceRequest this_arg_conv;
73286         this_arg_conv.inner = untag_ptr(this_arg);
73287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73289         this_arg_conv.is_owned = false;
73290         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73291         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
73292         int64_t ret_ref = tag_ptr(ret_copy, true);
73293         return ret_ref;
73294 }
73295
73296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
73297         LDKUnsignedInvoiceRequest this_arg_conv;
73298         this_arg_conv.inner = untag_ptr(this_arg);
73299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73301         this_arg_conv.is_owned = false;
73302         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
73303         int64_t ret_ref = 0;
73304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73306         return ret_ref;
73307 }
73308
73309 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
73310         LDKUnsignedInvoiceRequest this_arg_conv;
73311         this_arg_conv.inner = untag_ptr(this_arg);
73312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73314         this_arg_conv.is_owned = false;
73315         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
73316         int64_tArray ret_arr = NULL;
73317         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73318         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73319         for (size_t n = 0; n < ret_var.datalen; n++) {
73320                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
73321                 int64_t ret_conv_13_ref = 0;
73322                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
73323                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
73324                 ret_arr_ptr[n] = ret_conv_13_ref;
73325         }
73326         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73327         FREE(ret_var.data);
73328         return ret_arr;
73329 }
73330
73331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73332         LDKUnsignedInvoiceRequest this_arg_conv;
73333         this_arg_conv.inner = untag_ptr(this_arg);
73334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73336         this_arg_conv.is_owned = false;
73337         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
73338         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
73339         int64_t ret_ref = tag_ptr(ret_copy, true);
73340         return ret_ref;
73341 }
73342
73343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
73344         LDKUnsignedInvoiceRequest this_arg_conv;
73345         this_arg_conv.inner = untag_ptr(this_arg);
73346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73348         this_arg_conv.is_owned = false;
73349         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73350         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
73351         return ret_arr;
73352 }
73353
73354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73355         LDKUnsignedInvoiceRequest this_arg_conv;
73356         this_arg_conv.inner = untag_ptr(this_arg);
73357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73359         this_arg_conv.is_owned = false;
73360         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
73361         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73362         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73363         return ret_arr;
73364 }
73365
73366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
73367         LDKUnsignedInvoiceRequest this_arg_conv;
73368         this_arg_conv.inner = untag_ptr(this_arg);
73369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73371         this_arg_conv.is_owned = false;
73372         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
73374         return ret_arr;
73375 }
73376
73377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
73378         LDKUnsignedInvoiceRequest this_arg_conv;
73379         this_arg_conv.inner = untag_ptr(this_arg);
73380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73382         this_arg_conv.is_owned = false;
73383         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73384         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
73385         int64_t ret_ref = tag_ptr(ret_copy, true);
73386         return ret_ref;
73387 }
73388
73389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73390         LDKUnsignedInvoiceRequest this_arg_conv;
73391         this_arg_conv.inner = untag_ptr(this_arg);
73392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73394         this_arg_conv.is_owned = false;
73395         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
73396         int64_t ret_ref = 0;
73397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73399         return ret_ref;
73400 }
73401
73402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73403         LDKUnsignedInvoiceRequest this_arg_conv;
73404         this_arg_conv.inner = untag_ptr(this_arg);
73405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73407         this_arg_conv.is_owned = false;
73408         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73409         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
73410         int64_t ret_ref = tag_ptr(ret_copy, true);
73411         return ret_ref;
73412 }
73413
73414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
73415         LDKUnsignedInvoiceRequest this_arg_conv;
73416         this_arg_conv.inner = untag_ptr(this_arg);
73417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73419         this_arg_conv.is_owned = false;
73420         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73421         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
73422         return ret_arr;
73423 }
73424
73425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
73426         LDKUnsignedInvoiceRequest this_arg_conv;
73427         this_arg_conv.inner = untag_ptr(this_arg);
73428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73430         this_arg_conv.is_owned = false;
73431         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
73432         int64_t ret_ref = 0;
73433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73435         return ret_ref;
73436 }
73437
73438 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
73439         LDKInvoiceRequest this_arg_conv;
73440         this_arg_conv.inner = untag_ptr(this_arg);
73441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73443         this_arg_conv.is_owned = false;
73444         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
73445         jobjectArray ret_arr = NULL;
73446         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
73447         ;
73448         for (size_t i = 0; i < ret_var.datalen; i++) {
73449                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
73450                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
73451                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
73452         }
73453         
73454         FREE(ret_var.data);
73455         return ret_arr;
73456 }
73457
73458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73459         LDKInvoiceRequest this_arg_conv;
73460         this_arg_conv.inner = untag_ptr(this_arg);
73461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73463         this_arg_conv.is_owned = false;
73464         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73465         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
73466         int64_t ret_ref = tag_ptr(ret_copy, true);
73467         return ret_ref;
73468 }
73469
73470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
73471         LDKInvoiceRequest this_arg_conv;
73472         this_arg_conv.inner = untag_ptr(this_arg);
73473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73475         this_arg_conv.is_owned = false;
73476         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
73477         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
73478         int64_t ret_ref = tag_ptr(ret_copy, true);
73479         return ret_ref;
73480 }
73481
73482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
73483         LDKInvoiceRequest this_arg_conv;
73484         this_arg_conv.inner = untag_ptr(this_arg);
73485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73487         this_arg_conv.is_owned = false;
73488         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
73489         int64_t ret_ref = 0;
73490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73492         return ret_ref;
73493 }
73494
73495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73496         LDKInvoiceRequest this_arg_conv;
73497         this_arg_conv.inner = untag_ptr(this_arg);
73498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73500         this_arg_conv.is_owned = false;
73501         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
73502         int64_t ret_ref = 0;
73503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73505         return ret_ref;
73506 }
73507
73508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
73509         LDKInvoiceRequest this_arg_conv;
73510         this_arg_conv.inner = untag_ptr(this_arg);
73511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73513         this_arg_conv.is_owned = false;
73514         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73515         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
73516         int64_t ret_ref = tag_ptr(ret_copy, true);
73517         return ret_ref;
73518 }
73519
73520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
73521         LDKInvoiceRequest this_arg_conv;
73522         this_arg_conv.inner = untag_ptr(this_arg);
73523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73525         this_arg_conv.is_owned = false;
73526         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
73527         int64_t ret_ref = 0;
73528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73530         return ret_ref;
73531 }
73532
73533 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
73534         LDKInvoiceRequest this_arg_conv;
73535         this_arg_conv.inner = untag_ptr(this_arg);
73536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73538         this_arg_conv.is_owned = false;
73539         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
73540         int64_tArray ret_arr = NULL;
73541         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73542         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73543         for (size_t n = 0; n < ret_var.datalen; n++) {
73544                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
73545                 int64_t ret_conv_13_ref = 0;
73546                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
73547                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
73548                 ret_arr_ptr[n] = ret_conv_13_ref;
73549         }
73550         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73551         FREE(ret_var.data);
73552         return ret_arr;
73553 }
73554
73555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73556         LDKInvoiceRequest this_arg_conv;
73557         this_arg_conv.inner = untag_ptr(this_arg);
73558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73560         this_arg_conv.is_owned = false;
73561         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
73562         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
73563         int64_t ret_ref = tag_ptr(ret_copy, true);
73564         return ret_ref;
73565 }
73566
73567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
73568         LDKInvoiceRequest this_arg_conv;
73569         this_arg_conv.inner = untag_ptr(this_arg);
73570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73572         this_arg_conv.is_owned = false;
73573         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
73575         return ret_arr;
73576 }
73577
73578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73579         LDKInvoiceRequest this_arg_conv;
73580         this_arg_conv.inner = untag_ptr(this_arg);
73581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73583         this_arg_conv.is_owned = false;
73584         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
73585         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73586         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73587         return ret_arr;
73588 }
73589
73590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
73591         LDKInvoiceRequest this_arg_conv;
73592         this_arg_conv.inner = untag_ptr(this_arg);
73593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73595         this_arg_conv.is_owned = false;
73596         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73597         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
73598         return ret_arr;
73599 }
73600
73601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
73602         LDKInvoiceRequest this_arg_conv;
73603         this_arg_conv.inner = untag_ptr(this_arg);
73604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73606         this_arg_conv.is_owned = false;
73607         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73608         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
73609         int64_t ret_ref = tag_ptr(ret_copy, true);
73610         return ret_ref;
73611 }
73612
73613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73614         LDKInvoiceRequest this_arg_conv;
73615         this_arg_conv.inner = untag_ptr(this_arg);
73616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73618         this_arg_conv.is_owned = false;
73619         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
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
73626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73627         LDKInvoiceRequest this_arg_conv;
73628         this_arg_conv.inner = untag_ptr(this_arg);
73629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73631         this_arg_conv.is_owned = false;
73632         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73633         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
73634         int64_t ret_ref = tag_ptr(ret_copy, true);
73635         return ret_ref;
73636 }
73637
73638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
73639         LDKInvoiceRequest this_arg_conv;
73640         this_arg_conv.inner = untag_ptr(this_arg);
73641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73643         this_arg_conv.is_owned = false;
73644         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73645         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
73646         return ret_arr;
73647 }
73648
73649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
73650         LDKInvoiceRequest this_arg_conv;
73651         this_arg_conv.inner = untag_ptr(this_arg);
73652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73654         this_arg_conv.is_owned = false;
73655         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
73656         int64_t ret_ref = 0;
73657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73659         return ret_ref;
73660 }
73661
73662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1respond_1with(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
73663         LDKInvoiceRequest this_arg_conv;
73664         this_arg_conv.inner = untag_ptr(this_arg);
73665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73667         this_arg_conv.is_owned = false;
73668         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
73669         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
73670         if (payment_paths_constr.datalen > 0)
73671                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
73672         else
73673                 payment_paths_constr.data = NULL;
73674         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
73675         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
73676                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
73677                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
73678                 CHECK_ACCESS(payment_paths_conv_37_ptr);
73679                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
73680                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
73681                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
73682         }
73683         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
73684         LDKThirtyTwoBytes payment_hash_ref;
73685         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
73686         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
73687         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
73688         *ret_conv = InvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
73689         return tag_ptr(ret_conv, true);
73690 }
73691
73692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1respond_1with_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
73693         LDKInvoiceRequest this_arg_conv;
73694         this_arg_conv.inner = untag_ptr(this_arg);
73695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73697         this_arg_conv.is_owned = false;
73698         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
73699         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
73700         if (payment_paths_constr.datalen > 0)
73701                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
73702         else
73703                 payment_paths_constr.data = NULL;
73704         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
73705         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
73706                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
73707                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
73708                 CHECK_ACCESS(payment_paths_conv_37_ptr);
73709                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
73710                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
73711                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
73712         }
73713         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
73714         LDKThirtyTwoBytes payment_hash_ref;
73715         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
73716         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
73717         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
73718         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
73719         return tag_ptr(ret_conv, true);
73720 }
73721
73722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
73723         LDKInvoiceRequest this_arg_conv;
73724         this_arg_conv.inner = untag_ptr(this_arg);
73725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73727         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
73728         LDKExpandedKey key_conv;
73729         key_conv.inner = untag_ptr(key);
73730         key_conv.is_owned = ptr_is_owned(key);
73731         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
73732         key_conv.is_owned = false;
73733         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
73734         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
73735         return tag_ptr(ret_conv, true);
73736 }
73737
73738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
73739         LDKInvoiceRequest this_arg_conv;
73740         this_arg_conv.inner = untag_ptr(this_arg);
73741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73743         this_arg_conv.is_owned = false;
73744         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
73745         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
73746         return ret_arr;
73747 }
73748
73749 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
73750         LDKVerifiedInvoiceRequest this_arg_conv;
73751         this_arg_conv.inner = untag_ptr(this_arg);
73752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73754         this_arg_conv.is_owned = false;
73755         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
73756         jobjectArray ret_arr = NULL;
73757         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
73758         ;
73759         for (size_t i = 0; i < ret_var.datalen; i++) {
73760                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
73761                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
73762                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
73763         }
73764         
73765         FREE(ret_var.data);
73766         return ret_arr;
73767 }
73768
73769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73770         LDKVerifiedInvoiceRequest this_arg_conv;
73771         this_arg_conv.inner = untag_ptr(this_arg);
73772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73774         this_arg_conv.is_owned = false;
73775         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73776         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
73777         int64_t ret_ref = tag_ptr(ret_copy, true);
73778         return ret_ref;
73779 }
73780
73781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
73782         LDKVerifiedInvoiceRequest this_arg_conv;
73783         this_arg_conv.inner = untag_ptr(this_arg);
73784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73786         this_arg_conv.is_owned = false;
73787         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
73788         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
73789         int64_t ret_ref = tag_ptr(ret_copy, true);
73790         return ret_ref;
73791 }
73792
73793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
73794         LDKVerifiedInvoiceRequest this_arg_conv;
73795         this_arg_conv.inner = untag_ptr(this_arg);
73796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73798         this_arg_conv.is_owned = false;
73799         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
73800         int64_t ret_ref = 0;
73801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73803         return ret_ref;
73804 }
73805
73806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73807         LDKVerifiedInvoiceRequest this_arg_conv;
73808         this_arg_conv.inner = untag_ptr(this_arg);
73809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73811         this_arg_conv.is_owned = false;
73812         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
73813         int64_t ret_ref = 0;
73814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73816         return ret_ref;
73817 }
73818
73819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
73820         LDKVerifiedInvoiceRequest this_arg_conv;
73821         this_arg_conv.inner = untag_ptr(this_arg);
73822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73824         this_arg_conv.is_owned = false;
73825         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73826         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
73827         int64_t ret_ref = tag_ptr(ret_copy, true);
73828         return ret_ref;
73829 }
73830
73831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
73832         LDKVerifiedInvoiceRequest this_arg_conv;
73833         this_arg_conv.inner = untag_ptr(this_arg);
73834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73836         this_arg_conv.is_owned = false;
73837         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
73838         int64_t ret_ref = 0;
73839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73841         return ret_ref;
73842 }
73843
73844 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
73845         LDKVerifiedInvoiceRequest this_arg_conv;
73846         this_arg_conv.inner = untag_ptr(this_arg);
73847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73849         this_arg_conv.is_owned = false;
73850         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
73851         int64_tArray ret_arr = NULL;
73852         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73853         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73854         for (size_t n = 0; n < ret_var.datalen; n++) {
73855                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
73856                 int64_t ret_conv_13_ref = 0;
73857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
73858                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
73859                 ret_arr_ptr[n] = ret_conv_13_ref;
73860         }
73861         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73862         FREE(ret_var.data);
73863         return ret_arr;
73864 }
73865
73866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73867         LDKVerifiedInvoiceRequest this_arg_conv;
73868         this_arg_conv.inner = untag_ptr(this_arg);
73869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73871         this_arg_conv.is_owned = false;
73872         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
73873         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
73874         int64_t ret_ref = tag_ptr(ret_copy, true);
73875         return ret_ref;
73876 }
73877
73878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
73879         LDKVerifiedInvoiceRequest this_arg_conv;
73880         this_arg_conv.inner = untag_ptr(this_arg);
73881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73883         this_arg_conv.is_owned = false;
73884         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73885         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
73886         return ret_arr;
73887 }
73888
73889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73890         LDKVerifiedInvoiceRequest this_arg_conv;
73891         this_arg_conv.inner = untag_ptr(this_arg);
73892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73894         this_arg_conv.is_owned = false;
73895         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
73896         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73897         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73898         return ret_arr;
73899 }
73900
73901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
73902         LDKVerifiedInvoiceRequest this_arg_conv;
73903         this_arg_conv.inner = untag_ptr(this_arg);
73904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73906         this_arg_conv.is_owned = false;
73907         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73908         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
73909         return ret_arr;
73910 }
73911
73912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
73913         LDKVerifiedInvoiceRequest this_arg_conv;
73914         this_arg_conv.inner = untag_ptr(this_arg);
73915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73917         this_arg_conv.is_owned = false;
73918         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73919         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
73920         int64_t ret_ref = tag_ptr(ret_copy, true);
73921         return ret_ref;
73922 }
73923
73924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73925         LDKVerifiedInvoiceRequest this_arg_conv;
73926         this_arg_conv.inner = untag_ptr(this_arg);
73927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73929         this_arg_conv.is_owned = false;
73930         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
73931         int64_t ret_ref = 0;
73932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73934         return ret_ref;
73935 }
73936
73937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73938         LDKVerifiedInvoiceRequest this_arg_conv;
73939         this_arg_conv.inner = untag_ptr(this_arg);
73940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73942         this_arg_conv.is_owned = false;
73943         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73944         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
73945         int64_t ret_ref = tag_ptr(ret_copy, true);
73946         return ret_ref;
73947 }
73948
73949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
73950         LDKVerifiedInvoiceRequest this_arg_conv;
73951         this_arg_conv.inner = untag_ptr(this_arg);
73952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73954         this_arg_conv.is_owned = false;
73955         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73956         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
73957         return ret_arr;
73958 }
73959
73960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
73961         LDKVerifiedInvoiceRequest this_arg_conv;
73962         this_arg_conv.inner = untag_ptr(this_arg);
73963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73965         this_arg_conv.is_owned = false;
73966         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
73967         int64_t ret_ref = 0;
73968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73970         return ret_ref;
73971 }
73972
73973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1with(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
73974         LDKVerifiedInvoiceRequest this_arg_conv;
73975         this_arg_conv.inner = untag_ptr(this_arg);
73976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73978         this_arg_conv.is_owned = false;
73979         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
73980         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
73981         if (payment_paths_constr.datalen > 0)
73982                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
73983         else
73984                 payment_paths_constr.data = NULL;
73985         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
73986         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
73987                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
73988                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
73989                 CHECK_ACCESS(payment_paths_conv_37_ptr);
73990                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
73991                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
73992                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
73993         }
73994         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
73995         LDKThirtyTwoBytes payment_hash_ref;
73996         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
73997         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
73998         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
73999         *ret_conv = VerifiedInvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
74000         return tag_ptr(ret_conv, true);
74001 }
74002
74003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1with_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
74004         LDKVerifiedInvoiceRequest this_arg_conv;
74005         this_arg_conv.inner = untag_ptr(this_arg);
74006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74008         this_arg_conv.is_owned = false;
74009         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
74010         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
74011         if (payment_paths_constr.datalen > 0)
74012                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
74013         else
74014                 payment_paths_constr.data = NULL;
74015         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
74016         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
74017                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
74018                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
74019                 CHECK_ACCESS(payment_paths_conv_37_ptr);
74020                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
74021                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
74022                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
74023         }
74024         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
74025         LDKThirtyTwoBytes payment_hash_ref;
74026         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
74027         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
74028         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
74029         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
74030         return tag_ptr(ret_conv, true);
74031 }
74032
74033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1using_1derived_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
74034         LDKVerifiedInvoiceRequest this_arg_conv;
74035         this_arg_conv.inner = untag_ptr(this_arg);
74036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74038         this_arg_conv.is_owned = false;
74039         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
74040         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
74041         if (payment_paths_constr.datalen > 0)
74042                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
74043         else
74044                 payment_paths_constr.data = NULL;
74045         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
74046         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
74047                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
74048                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
74049                 CHECK_ACCESS(payment_paths_conv_37_ptr);
74050                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
74051                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
74052                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
74053         }
74054         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
74055         LDKThirtyTwoBytes payment_hash_ref;
74056         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
74057         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
74058         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
74059         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys(&this_arg_conv, payment_paths_constr, payment_hash_ref);
74060         return tag_ptr(ret_conv, true);
74061 }
74062
74063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1using_1derived_1keys_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
74064         LDKVerifiedInvoiceRequest this_arg_conv;
74065         this_arg_conv.inner = untag_ptr(this_arg);
74066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74068         this_arg_conv.is_owned = false;
74069         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
74070         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
74071         if (payment_paths_constr.datalen > 0)
74072                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
74073         else
74074                 payment_paths_constr.data = NULL;
74075         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
74076         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
74077                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
74078                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
74079                 CHECK_ACCESS(payment_paths_conv_37_ptr);
74080                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
74081                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
74082                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
74083         }
74084         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
74085         LDKThirtyTwoBytes payment_hash_ref;
74086         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
74087         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
74088         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
74089         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
74090         return tag_ptr(ret_conv, true);
74091 }
74092
74093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
74094         LDKUnsignedInvoiceRequest obj_conv;
74095         obj_conv.inner = untag_ptr(obj);
74096         obj_conv.is_owned = ptr_is_owned(obj);
74097         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74098         obj_conv.is_owned = false;
74099         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
74100         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74101         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74102         CVec_u8Z_free(ret_var);
74103         return ret_arr;
74104 }
74105
74106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
74107         LDKInvoiceRequest obj_conv;
74108         obj_conv.inner = untag_ptr(obj);
74109         obj_conv.is_owned = ptr_is_owned(obj);
74110         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74111         obj_conv.is_owned = false;
74112         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
74113         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74114         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74115         CVec_u8Z_free(ret_var);
74116         return ret_arr;
74117 }
74118
74119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74120         LDKInvoiceRequestFields this_obj_conv;
74121         this_obj_conv.inner = untag_ptr(this_obj);
74122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74124         InvoiceRequestFields_free(this_obj_conv);
74125 }
74126
74127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1payer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
74128         LDKInvoiceRequestFields this_ptr_conv;
74129         this_ptr_conv.inner = untag_ptr(this_ptr);
74130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74132         this_ptr_conv.is_owned = false;
74133         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74134         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form);
74135         return ret_arr;
74136 }
74137
74138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1payer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74139         LDKInvoiceRequestFields this_ptr_conv;
74140         this_ptr_conv.inner = untag_ptr(this_ptr);
74141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74143         this_ptr_conv.is_owned = false;
74144         LDKPublicKey val_ref;
74145         CHECK((*env)->GetArrayLength(env, val) == 33);
74146         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
74147         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
74148 }
74149
74150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1quantity(JNIEnv *env, jclass clz, int64_t this_ptr) {
74151         LDKInvoiceRequestFields this_ptr_conv;
74152         this_ptr_conv.inner = untag_ptr(this_ptr);
74153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74155         this_ptr_conv.is_owned = false;
74156         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74157         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
74158         int64_t ret_ref = tag_ptr(ret_copy, true);
74159         return ret_ref;
74160 }
74161
74162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1quantity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74163         LDKInvoiceRequestFields this_ptr_conv;
74164         this_ptr_conv.inner = untag_ptr(this_ptr);
74165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74167         this_ptr_conv.is_owned = false;
74168         void* val_ptr = untag_ptr(val);
74169         CHECK_ACCESS(val_ptr);
74170         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
74171         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
74172         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
74173 }
74174
74175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1payer_1note_1truncated(JNIEnv *env, jclass clz, int64_t this_ptr) {
74176         LDKInvoiceRequestFields this_ptr_conv;
74177         this_ptr_conv.inner = untag_ptr(this_ptr);
74178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74180         this_ptr_conv.is_owned = false;
74181         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
74182         int64_t ret_ref = 0;
74183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74185         return ret_ref;
74186 }
74187
74188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1payer_1note_1truncated(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74189         LDKInvoiceRequestFields this_ptr_conv;
74190         this_ptr_conv.inner = untag_ptr(this_ptr);
74191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74193         this_ptr_conv.is_owned = false;
74194         LDKUntrustedString val_conv;
74195         val_conv.inner = untag_ptr(val);
74196         val_conv.is_owned = ptr_is_owned(val);
74197         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74198         val_conv = UntrustedString_clone(&val_conv);
74199         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
74200 }
74201
74202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1new(JNIEnv *env, jclass clz, int8_tArray payer_id_arg, int64_t quantity_arg, int64_t payer_note_truncated_arg) {
74203         LDKPublicKey payer_id_arg_ref;
74204         CHECK((*env)->GetArrayLength(env, payer_id_arg) == 33);
74205         (*env)->GetByteArrayRegion(env, payer_id_arg, 0, 33, payer_id_arg_ref.compressed_form);
74206         void* quantity_arg_ptr = untag_ptr(quantity_arg);
74207         CHECK_ACCESS(quantity_arg_ptr);
74208         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
74209         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
74210         LDKUntrustedString payer_note_truncated_arg_conv;
74211         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
74212         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
74213         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
74214         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
74215         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
74216         int64_t ret_ref = 0;
74217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74219         return ret_ref;
74220 }
74221
74222 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
74223         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
74224         int64_t ret_ref = 0;
74225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74227         return ret_ref;
74228 }
74229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74230         LDKInvoiceRequestFields arg_conv;
74231         arg_conv.inner = untag_ptr(arg);
74232         arg_conv.is_owned = ptr_is_owned(arg);
74233         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74234         arg_conv.is_owned = false;
74235         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
74236         return ret_conv;
74237 }
74238
74239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74240         LDKInvoiceRequestFields orig_conv;
74241         orig_conv.inner = untag_ptr(orig);
74242         orig_conv.is_owned = ptr_is_owned(orig);
74243         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74244         orig_conv.is_owned = false;
74245         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
74246         int64_t ret_ref = 0;
74247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74249         return ret_ref;
74250 }
74251
74252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74253         LDKInvoiceRequestFields a_conv;
74254         a_conv.inner = untag_ptr(a);
74255         a_conv.is_owned = ptr_is_owned(a);
74256         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74257         a_conv.is_owned = false;
74258         LDKInvoiceRequestFields b_conv;
74259         b_conv.inner = untag_ptr(b);
74260         b_conv.is_owned = ptr_is_owned(b);
74261         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74262         b_conv.is_owned = false;
74263         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
74264         return ret_conv;
74265 }
74266
74267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
74268         LDKInvoiceRequestFields obj_conv;
74269         obj_conv.inner = untag_ptr(obj);
74270         obj_conv.is_owned = ptr_is_owned(obj);
74271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74272         obj_conv.is_owned = false;
74273         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
74274         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74275         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74276         CVec_u8Z_free(ret_var);
74277         return ret_arr;
74278 }
74279
74280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74281         LDKu8slice ser_ref;
74282         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74283         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74284         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
74285         *ret_conv = InvoiceRequestFields_read(ser_ref);
74286         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74287         return tag_ptr(ret_conv, true);
74288 }
74289
74290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74291         LDKTaggedHash this_obj_conv;
74292         this_obj_conv.inner = untag_ptr(this_obj);
74293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74295         TaggedHash_free(this_obj_conv);
74296 }
74297
74298 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
74299         LDKTaggedHash ret_var = TaggedHash_clone(arg);
74300         int64_t ret_ref = 0;
74301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74303         return ret_ref;
74304 }
74305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74306         LDKTaggedHash arg_conv;
74307         arg_conv.inner = untag_ptr(arg);
74308         arg_conv.is_owned = ptr_is_owned(arg);
74309         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74310         arg_conv.is_owned = false;
74311         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
74312         return ret_conv;
74313 }
74314
74315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74316         LDKTaggedHash orig_conv;
74317         orig_conv.inner = untag_ptr(orig);
74318         orig_conv.is_owned = ptr_is_owned(orig);
74319         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74320         orig_conv.is_owned = false;
74321         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
74322         int64_t ret_ref = 0;
74323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74325         return ret_ref;
74326 }
74327
74328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1as_1digest(JNIEnv *env, jclass clz, int64_t this_arg) {
74329         LDKTaggedHash this_arg_conv;
74330         this_arg_conv.inner = untag_ptr(this_arg);
74331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74333         this_arg_conv.is_owned = false;
74334         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74335         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TaggedHash_as_digest(&this_arg_conv));
74336         return ret_arr;
74337 }
74338
74339 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_TaggedHash_1tag(JNIEnv *env, jclass clz, int64_t this_arg) {
74340         LDKTaggedHash this_arg_conv;
74341         this_arg_conv.inner = untag_ptr(this_arg);
74342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74344         this_arg_conv.is_owned = false;
74345         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
74346         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74347         Str_free(ret_str);
74348         return ret_conv;
74349 }
74350
74351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1merkle_1root(JNIEnv *env, jclass clz, int64_t this_arg) {
74352         LDKTaggedHash this_arg_conv;
74353         this_arg_conv.inner = untag_ptr(this_arg);
74354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74356         this_arg_conv.is_owned = false;
74357         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74358         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TaggedHash_merkle_root(&this_arg_conv).data);
74359         return ret_arr;
74360 }
74361
74362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74363         if (!ptr_is_owned(this_ptr)) return;
74364         void* this_ptr_ptr = untag_ptr(this_ptr);
74365         CHECK_ACCESS(this_ptr_ptr);
74366         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
74367         FREE(untag_ptr(this_ptr));
74368         SignError_free(this_ptr_conv);
74369 }
74370
74371 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
74372         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
74373         *ret_copy = SignError_clone(arg);
74374         int64_t ret_ref = tag_ptr(ret_copy, true);
74375         return ret_ref;
74376 }
74377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74378         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
74379         int64_t ret_conv = SignError_clone_ptr(arg_conv);
74380         return ret_conv;
74381 }
74382
74383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74384         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
74385         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
74386         *ret_copy = SignError_clone(orig_conv);
74387         int64_t ret_ref = tag_ptr(ret_copy, true);
74388         return ret_ref;
74389 }
74390
74391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1signing(JNIEnv *env, jclass clz) {
74392         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
74393         *ret_copy = SignError_signing();
74394         int64_t ret_ref = tag_ptr(ret_copy, true);
74395         return ret_ref;
74396 }
74397
74398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1verification(JNIEnv *env, jclass clz, jclass a) {
74399         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
74400         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
74401         *ret_copy = SignError_verification(a_conv);
74402         int64_t ret_ref = tag_ptr(ret_copy, true);
74403         return ret_ref;
74404 }
74405
74406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74407         LDKBolt12ParseError this_obj_conv;
74408         this_obj_conv.inner = untag_ptr(this_obj);
74409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74411         Bolt12ParseError_free(this_obj_conv);
74412 }
74413
74414 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
74415         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
74416         int64_t ret_ref = 0;
74417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74419         return ret_ref;
74420 }
74421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74422         LDKBolt12ParseError arg_conv;
74423         arg_conv.inner = untag_ptr(arg);
74424         arg_conv.is_owned = ptr_is_owned(arg);
74425         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74426         arg_conv.is_owned = false;
74427         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
74428         return ret_conv;
74429 }
74430
74431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74432         LDKBolt12ParseError orig_conv;
74433         orig_conv.inner = untag_ptr(orig);
74434         orig_conv.is_owned = ptr_is_owned(orig);
74435         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74436         orig_conv.is_owned = false;
74437         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
74438         int64_t ret_ref = 0;
74439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74441         return ret_ref;
74442 }
74443
74444 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74445         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
74446         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
74447         return ret_conv;
74448 }
74449
74450 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
74451         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
74452         return ret_conv;
74453 }
74454
74455 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
74456         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
74457         return ret_conv;
74458 }
74459
74460 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
74461         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
74462         return ret_conv;
74463 }
74464
74465 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
74466         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
74467         return ret_conv;
74468 }
74469
74470 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
74471         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
74472         return ret_conv;
74473 }
74474
74475 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
74476         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
74477         return ret_conv;
74478 }
74479
74480 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
74481         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
74482         return ret_conv;
74483 }
74484
74485 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
74486         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
74487         return ret_conv;
74488 }
74489
74490 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
74491         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
74492         return ret_conv;
74493 }
74494
74495 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
74496         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
74497         return ret_conv;
74498 }
74499
74500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
74501         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
74502         return ret_conv;
74503 }
74504
74505 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
74506         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
74507         return ret_conv;
74508 }
74509
74510 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
74511         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
74512         return ret_conv;
74513 }
74514
74515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
74516         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
74517         return ret_conv;
74518 }
74519
74520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
74521         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
74522         return ret_conv;
74523 }
74524
74525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
74526         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
74527         return ret_conv;
74528 }
74529
74530 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
74531         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
74532         return ret_conv;
74533 }
74534
74535 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
74536         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
74537         return ret_conv;
74538 }
74539
74540 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
74541         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
74542         return ret_conv;
74543 }
74544
74545 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
74546         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
74547         return ret_conv;
74548 }
74549
74550 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
74551         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
74552         return ret_conv;
74553 }
74554
74555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
74556         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
74557         return ret_conv;
74558 }
74559
74560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
74561         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
74562         return ret_conv;
74563 }
74564
74565 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1paths(JNIEnv *env, jclass clz) {
74566         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_paths());
74567         return ret_conv;
74568 }
74569
74570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
74571         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
74572         return ret_conv;
74573 }
74574
74575 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
74576         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
74577         return ret_conv;
74578 }
74579
74580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
74581         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
74582         return ret_conv;
74583 }
74584
74585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
74586         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
74587         return ret_conv;
74588 }
74589
74590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74591         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
74592         this_obj_conv.inner = untag_ptr(this_obj);
74593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74595         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
74596 }
74597
74598 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
74599         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
74600         int64_t ret_ref = 0;
74601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74603         return ret_ref;
74604 }
74605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74606         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
74607         arg_conv.inner = untag_ptr(arg);
74608         arg_conv.is_owned = ptr_is_owned(arg);
74609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74610         arg_conv.is_owned = false;
74611         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
74612         return ret_conv;
74613 }
74614
74615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74616         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
74617         orig_conv.inner = untag_ptr(orig);
74618         orig_conv.is_owned = ptr_is_owned(orig);
74619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74620         orig_conv.is_owned = false;
74621         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
74622         int64_t ret_ref = 0;
74623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74625         return ret_ref;
74626 }
74627
74628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1new(JNIEnv *env, jclass clz, int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
74629         LDKCVec_u8Z metadata_ref;
74630         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
74631         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
74632         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
74633         LDKPublicKey payer_id_ref;
74634         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
74635         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
74636         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
74637         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
74638         return tag_ptr(ret_conv, true);
74639 }
74640
74641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1deriving_1payer_1id(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t expanded_key, int64_t entropy_source, int64_t amount_msats, int8_tArray payment_id) {
74642         LDKPublicKey node_id_ref;
74643         CHECK((*env)->GetArrayLength(env, node_id) == 33);
74644         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
74645         LDKExpandedKey expanded_key_conv;
74646         expanded_key_conv.inner = untag_ptr(expanded_key);
74647         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
74648         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
74649         expanded_key_conv.is_owned = false;
74650         void* entropy_source_ptr = untag_ptr(entropy_source);
74651         CHECK_ACCESS(entropy_source_ptr);
74652         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
74653         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
74654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74655                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
74656         }
74657         LDKThirtyTwoBytes payment_id_ref;
74658         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
74659         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
74660         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
74661         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
74662         return tag_ptr(ret_conv, true);
74663 }
74664
74665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
74666         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74667         this_arg_conv.inner = untag_ptr(this_arg);
74668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74670         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74671         LDKStr description_conv = java_to_owned_str(env, description);
74672         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
74673 }
74674
74675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
74676         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74677         this_arg_conv.inner = untag_ptr(this_arg);
74678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74680         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74681         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
74682 }
74683
74684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
74685         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74686         this_arg_conv.inner = untag_ptr(this_arg);
74687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74689         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74690         LDKStr issuer_conv = java_to_owned_str(env, issuer);
74691         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
74692 }
74693
74694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
74695         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74696         this_arg_conv.inner = untag_ptr(this_arg);
74697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74699         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74700         LDKBlindedPath path_conv;
74701         path_conv.inner = untag_ptr(path);
74702         path_conv.is_owned = ptr_is_owned(path);
74703         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
74704         path_conv = BlindedPath_clone(&path_conv);
74705         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
74706 }
74707
74708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
74709         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74710         this_arg_conv.inner = untag_ptr(this_arg);
74711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74713         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74714         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
74715         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
74716 }
74717
74718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
74719         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74720         this_arg_conv.inner = untag_ptr(this_arg);
74721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74723         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74724         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
74725 }
74726
74727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
74728         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74729         this_arg_conv.inner = untag_ptr(this_arg);
74730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74732         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74733         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
74734         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
74735 }
74736
74737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
74738         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
74739         this_arg_conv.inner = untag_ptr(this_arg);
74740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74742         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
74743         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
74744         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
74745         return tag_ptr(ret_conv, true);
74746 }
74747
74748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74749         LDKRefund this_obj_conv;
74750         this_obj_conv.inner = untag_ptr(this_obj);
74751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74753         Refund_free(this_obj_conv);
74754 }
74755
74756 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
74757         LDKRefund ret_var = Refund_clone(arg);
74758         int64_t ret_ref = 0;
74759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74761         return ret_ref;
74762 }
74763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74764         LDKRefund arg_conv;
74765         arg_conv.inner = untag_ptr(arg);
74766         arg_conv.is_owned = ptr_is_owned(arg);
74767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74768         arg_conv.is_owned = false;
74769         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
74770         return ret_conv;
74771 }
74772
74773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74774         LDKRefund orig_conv;
74775         orig_conv.inner = untag_ptr(orig);
74776         orig_conv.is_owned = ptr_is_owned(orig);
74777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74778         orig_conv.is_owned = false;
74779         LDKRefund ret_var = Refund_clone(&orig_conv);
74780         int64_t ret_ref = 0;
74781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74783         return ret_ref;
74784 }
74785
74786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
74787         LDKRefund this_arg_conv;
74788         this_arg_conv.inner = untag_ptr(this_arg);
74789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74791         this_arg_conv.is_owned = false;
74792         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
74793         int64_t ret_ref = 0;
74794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74796         return ret_ref;
74797 }
74798
74799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
74800         LDKRefund this_arg_conv;
74801         this_arg_conv.inner = untag_ptr(this_arg);
74802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74804         this_arg_conv.is_owned = false;
74805         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74806         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
74807         int64_t ret_ref = tag_ptr(ret_copy, true);
74808         return ret_ref;
74809 }
74810
74811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
74812         LDKRefund this_arg_conv;
74813         this_arg_conv.inner = untag_ptr(this_arg);
74814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74816         this_arg_conv.is_owned = false;
74817         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
74818         return ret_conv;
74819 }
74820
74821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
74822         LDKRefund this_arg_conv;
74823         this_arg_conv.inner = untag_ptr(this_arg);
74824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74826         this_arg_conv.is_owned = false;
74827         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
74828         return ret_conv;
74829 }
74830
74831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
74832         LDKRefund this_arg_conv;
74833         this_arg_conv.inner = untag_ptr(this_arg);
74834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74836         this_arg_conv.is_owned = false;
74837         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
74838         int64_t ret_ref = 0;
74839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74841         return ret_ref;
74842 }
74843
74844 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
74845         LDKRefund this_arg_conv;
74846         this_arg_conv.inner = untag_ptr(this_arg);
74847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74849         this_arg_conv.is_owned = false;
74850         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
74851         int64_tArray ret_arr = NULL;
74852         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
74853         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
74854         for (size_t n = 0; n < ret_var.datalen; n++) {
74855                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
74856                 int64_t ret_conv_13_ref = 0;
74857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
74858                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
74859                 ret_arr_ptr[n] = ret_conv_13_ref;
74860         }
74861         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
74862         FREE(ret_var.data);
74863         return ret_arr;
74864 }
74865
74866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
74867         LDKRefund this_arg_conv;
74868         this_arg_conv.inner = untag_ptr(this_arg);
74869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74871         this_arg_conv.is_owned = false;
74872         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
74873         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74874         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74875         return ret_arr;
74876 }
74877
74878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
74879         LDKRefund this_arg_conv;
74880         this_arg_conv.inner = untag_ptr(this_arg);
74881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74883         this_arg_conv.is_owned = false;
74884         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74885         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
74886         return ret_arr;
74887 }
74888
74889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
74890         LDKRefund this_arg_conv;
74891         this_arg_conv.inner = untag_ptr(this_arg);
74892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74894         this_arg_conv.is_owned = false;
74895         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
74896         return ret_conv;
74897 }
74898
74899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74900         LDKRefund this_arg_conv;
74901         this_arg_conv.inner = untag_ptr(this_arg);
74902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74904         this_arg_conv.is_owned = false;
74905         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
74906         int64_t ret_ref = 0;
74907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74909         return ret_ref;
74910 }
74911
74912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
74913         LDKRefund this_arg_conv;
74914         this_arg_conv.inner = untag_ptr(this_arg);
74915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74917         this_arg_conv.is_owned = false;
74918         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74919         *ret_copy = Refund_quantity(&this_arg_conv);
74920         int64_t ret_ref = tag_ptr(ret_copy, true);
74921         return ret_ref;
74922 }
74923
74924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
74925         LDKRefund this_arg_conv;
74926         this_arg_conv.inner = untag_ptr(this_arg);
74927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74929         this_arg_conv.is_owned = false;
74930         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74931         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
74932         return ret_arr;
74933 }
74934
74935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
74936         LDKRefund this_arg_conv;
74937         this_arg_conv.inner = untag_ptr(this_arg);
74938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74940         this_arg_conv.is_owned = false;
74941         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
74942         int64_t ret_ref = 0;
74943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74945         return ret_ref;
74946 }
74947
74948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1hash(JNIEnv *env, jclass clz, int64_t o) {
74949         LDKRefund o_conv;
74950         o_conv.inner = untag_ptr(o);
74951         o_conv.is_owned = ptr_is_owned(o);
74952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74953         o_conv.is_owned = false;
74954         int64_t ret_conv = Refund_hash(&o_conv);
74955         return ret_conv;
74956 }
74957
74958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
74959         LDKRefund obj_conv;
74960         obj_conv.inner = untag_ptr(obj);
74961         obj_conv.is_owned = ptr_is_owned(obj);
74962         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74963         obj_conv.is_owned = false;
74964         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
74965         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74966         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74967         CVec_u8Z_free(ret_var);
74968         return ret_arr;
74969 }
74970
74971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
74972         LDKStr s_conv = java_to_owned_str(env, s);
74973         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
74974         *ret_conv = Refund_from_str(s_conv);
74975         return tag_ptr(ret_conv, true);
74976 }
74977
74978 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Refund_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
74979         LDKRefund o_conv;
74980         o_conv.inner = untag_ptr(o);
74981         o_conv.is_owned = ptr_is_owned(o);
74982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74983         o_conv.is_owned = false;
74984         LDKStr ret_str = Refund_to_str(&o_conv);
74985         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
74986         Str_free(ret_str);
74987         return ret_conv;
74988 }
74989
74990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74991         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
74992         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
74993         return ret_conv;
74994 }
74995
74996 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
74997         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
74998         return ret_conv;
74999 }
75000
75001 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
75002         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
75003         return ret_conv;
75004 }
75005
75006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75007         if (!ptr_is_owned(this_ptr)) return;
75008         void* this_ptr_ptr = untag_ptr(this_ptr);
75009         CHECK_ACCESS(this_ptr_ptr);
75010         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
75011         FREE(untag_ptr(this_ptr));
75012         UtxoResult_free(this_ptr_conv);
75013 }
75014
75015 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
75016         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
75017         *ret_copy = UtxoResult_clone(arg);
75018         int64_t ret_ref = tag_ptr(ret_copy, true);
75019         return ret_ref;
75020 }
75021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75022         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
75023         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
75024         return ret_conv;
75025 }
75026
75027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75028         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
75029         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
75030         *ret_copy = UtxoResult_clone(orig_conv);
75031         int64_t ret_ref = tag_ptr(ret_copy, true);
75032         return ret_ref;
75033 }
75034
75035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
75036         void* a_ptr = untag_ptr(a);
75037         CHECK_ACCESS(a_ptr);
75038         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
75039         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
75040         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
75041         *ret_copy = UtxoResult_sync(a_conv);
75042         int64_t ret_ref = tag_ptr(ret_copy, true);
75043         return ret_ref;
75044 }
75045
75046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
75047         LDKUtxoFuture a_conv;
75048         a_conv.inner = untag_ptr(a);
75049         a_conv.is_owned = ptr_is_owned(a);
75050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75051         a_conv = UtxoFuture_clone(&a_conv);
75052         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
75053         *ret_copy = UtxoResult_async(a_conv);
75054         int64_t ret_ref = tag_ptr(ret_copy, true);
75055         return ret_ref;
75056 }
75057
75058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75059         if (!ptr_is_owned(this_ptr)) return;
75060         void* this_ptr_ptr = untag_ptr(this_ptr);
75061         CHECK_ACCESS(this_ptr_ptr);
75062         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
75063         FREE(untag_ptr(this_ptr));
75064         UtxoLookup_free(this_ptr_conv);
75065 }
75066
75067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75068         LDKUtxoFuture this_obj_conv;
75069         this_obj_conv.inner = untag_ptr(this_obj);
75070         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75072         UtxoFuture_free(this_obj_conv);
75073 }
75074
75075 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
75076         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
75077         int64_t ret_ref = 0;
75078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75080         return ret_ref;
75081 }
75082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75083         LDKUtxoFuture arg_conv;
75084         arg_conv.inner = untag_ptr(arg);
75085         arg_conv.is_owned = ptr_is_owned(arg);
75086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75087         arg_conv.is_owned = false;
75088         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
75089         return ret_conv;
75090 }
75091
75092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75093         LDKUtxoFuture orig_conv;
75094         orig_conv.inner = untag_ptr(orig);
75095         orig_conv.is_owned = ptr_is_owned(orig);
75096         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75097         orig_conv.is_owned = false;
75098         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
75099         int64_t ret_ref = 0;
75100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75102         return ret_ref;
75103 }
75104
75105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
75106         LDKUtxoFuture ret_var = UtxoFuture_new();
75107         int64_t ret_ref = 0;
75108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75110         return ret_ref;
75111 }
75112
75113 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) {
75114         LDKUtxoFuture this_arg_conv;
75115         this_arg_conv.inner = untag_ptr(this_arg);
75116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75118         this_arg_conv.is_owned = false;
75119         LDKNetworkGraph graph_conv;
75120         graph_conv.inner = untag_ptr(graph);
75121         graph_conv.is_owned = ptr_is_owned(graph);
75122         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
75123         graph_conv.is_owned = false;
75124         void* result_ptr = untag_ptr(result);
75125         CHECK_ACCESS(result_ptr);
75126         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
75127         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
75128 }
75129
75130 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) {
75131         LDKUtxoFuture this_arg_conv;
75132         this_arg_conv.inner = untag_ptr(this_arg);
75133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75135         this_arg_conv.is_owned = false;
75136         LDKNetworkGraph graph_conv;
75137         graph_conv.inner = untag_ptr(graph);
75138         graph_conv.is_owned = ptr_is_owned(graph);
75139         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
75140         graph_conv.is_owned = false;
75141         LDKP2PGossipSync gossip_conv;
75142         gossip_conv.inner = untag_ptr(gossip);
75143         gossip_conv.is_owned = ptr_is_owned(gossip);
75144         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
75145         gossip_conv.is_owned = false;
75146         void* result_ptr = untag_ptr(result);
75147         CHECK_ACCESS(result_ptr);
75148         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
75149         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
75150 }
75151
75152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75153         LDKNodeId this_obj_conv;
75154         this_obj_conv.inner = untag_ptr(this_obj);
75155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75157         NodeId_free(this_obj_conv);
75158 }
75159
75160 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
75161         LDKNodeId ret_var = NodeId_clone(arg);
75162         int64_t ret_ref = 0;
75163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75165         return ret_ref;
75166 }
75167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75168         LDKNodeId arg_conv;
75169         arg_conv.inner = untag_ptr(arg);
75170         arg_conv.is_owned = ptr_is_owned(arg);
75171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75172         arg_conv.is_owned = false;
75173         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
75174         return ret_conv;
75175 }
75176
75177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75178         LDKNodeId orig_conv;
75179         orig_conv.inner = untag_ptr(orig);
75180         orig_conv.is_owned = ptr_is_owned(orig);
75181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75182         orig_conv.is_owned = false;
75183         LDKNodeId ret_var = NodeId_clone(&orig_conv);
75184         int64_t ret_ref = 0;
75185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75187         return ret_ref;
75188 }
75189
75190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
75191         LDKPublicKey pubkey_ref;
75192         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
75193         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
75194         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
75195         int64_t ret_ref = 0;
75196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75198         return ret_ref;
75199 }
75200
75201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1slice(JNIEnv *env, jclass clz, int8_tArray bytes) {
75202         LDKu8slice bytes_ref;
75203         bytes_ref.datalen = (*env)->GetArrayLength(env, bytes);
75204         bytes_ref.data = (*env)->GetByteArrayElements (env, bytes, NULL);
75205         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
75206         *ret_conv = NodeId_from_slice(bytes_ref);
75207         (*env)->ReleaseByteArrayElements(env, bytes, (int8_t*)bytes_ref.data, 0);
75208         return tag_ptr(ret_conv, true);
75209 }
75210
75211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
75212         LDKNodeId this_arg_conv;
75213         this_arg_conv.inner = untag_ptr(this_arg);
75214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75216         this_arg_conv.is_owned = false;
75217         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
75218         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75219         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75220         return ret_arr;
75221 }
75222
75223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1array(JNIEnv *env, jclass clz, int64_t this_arg) {
75224         LDKNodeId this_arg_conv;
75225         this_arg_conv.inner = untag_ptr(this_arg);
75226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75228         this_arg_conv.is_owned = false;
75229         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75230         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, *NodeId_as_array(&this_arg_conv));
75231         return ret_arr;
75232 }
75233
75234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
75235         LDKNodeId this_arg_conv;
75236         this_arg_conv.inner = untag_ptr(this_arg);
75237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75239         this_arg_conv.is_owned = false;
75240         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
75241         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
75242         return tag_ptr(ret_conv, true);
75243 }
75244
75245 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_NodeId_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75246         LDKNodeId o_conv;
75247         o_conv.inner = untag_ptr(o);
75248         o_conv.is_owned = ptr_is_owned(o);
75249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75250         o_conv.is_owned = false;
75251         LDKStr ret_str = NodeId_to_str(&o_conv);
75252         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75253         Str_free(ret_str);
75254         return ret_conv;
75255 }
75256
75257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
75258         LDKNodeId o_conv;
75259         o_conv.inner = untag_ptr(o);
75260         o_conv.is_owned = ptr_is_owned(o);
75261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75262         o_conv.is_owned = false;
75263         int64_t ret_conv = NodeId_hash(&o_conv);
75264         return ret_conv;
75265 }
75266
75267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
75268         LDKNodeId obj_conv;
75269         obj_conv.inner = untag_ptr(obj);
75270         obj_conv.is_owned = ptr_is_owned(obj);
75271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75272         obj_conv.is_owned = false;
75273         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
75274         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75275         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75276         CVec_u8Z_free(ret_var);
75277         return ret_arr;
75278 }
75279
75280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75281         LDKu8slice ser_ref;
75282         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75283         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75284         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
75285         *ret_conv = NodeId_read(ser_ref);
75286         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75287         return tag_ptr(ret_conv, true);
75288 }
75289
75290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75291         LDKNetworkGraph this_obj_conv;
75292         this_obj_conv.inner = untag_ptr(this_obj);
75293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75295         NetworkGraph_free(this_obj_conv);
75296 }
75297
75298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75299         LDKReadOnlyNetworkGraph this_obj_conv;
75300         this_obj_conv.inner = untag_ptr(this_obj);
75301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75303         ReadOnlyNetworkGraph_free(this_obj_conv);
75304 }
75305
75306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75307         if (!ptr_is_owned(this_ptr)) return;
75308         void* this_ptr_ptr = untag_ptr(this_ptr);
75309         CHECK_ACCESS(this_ptr_ptr);
75310         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
75311         FREE(untag_ptr(this_ptr));
75312         NetworkUpdate_free(this_ptr_conv);
75313 }
75314
75315 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
75316         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
75317         *ret_copy = NetworkUpdate_clone(arg);
75318         int64_t ret_ref = tag_ptr(ret_copy, true);
75319         return ret_ref;
75320 }
75321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75322         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
75323         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
75324         return ret_conv;
75325 }
75326
75327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75328         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
75329         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
75330         *ret_copy = NetworkUpdate_clone(orig_conv);
75331         int64_t ret_ref = tag_ptr(ret_copy, true);
75332         return ret_ref;
75333 }
75334
75335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
75336         LDKChannelUpdate msg_conv;
75337         msg_conv.inner = untag_ptr(msg);
75338         msg_conv.is_owned = ptr_is_owned(msg);
75339         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75340         msg_conv = ChannelUpdate_clone(&msg_conv);
75341         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
75342         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
75343         int64_t ret_ref = tag_ptr(ret_copy, true);
75344         return ret_ref;
75345 }
75346
75347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
75348         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
75349         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
75350         int64_t ret_ref = tag_ptr(ret_copy, true);
75351         return ret_ref;
75352 }
75353
75354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
75355         LDKPublicKey node_id_ref;
75356         CHECK((*env)->GetArrayLength(env, node_id) == 33);
75357         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
75358         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
75359         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
75360         int64_t ret_ref = tag_ptr(ret_copy, true);
75361         return ret_ref;
75362 }
75363
75364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75365         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
75366         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
75367         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
75368         return ret_conv;
75369 }
75370
75371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
75372         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
75373         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
75374         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75375         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75376         CVec_u8Z_free(ret_var);
75377         return ret_arr;
75378 }
75379
75380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75381         LDKu8slice ser_ref;
75382         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75383         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75384         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
75385         *ret_conv = NetworkUpdate_read(ser_ref);
75386         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75387         return tag_ptr(ret_conv, true);
75388 }
75389
75390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75391         LDKP2PGossipSync this_obj_conv;
75392         this_obj_conv.inner = untag_ptr(this_obj);
75393         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75395         P2PGossipSync_free(this_obj_conv);
75396 }
75397
75398 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) {
75399         LDKNetworkGraph network_graph_conv;
75400         network_graph_conv.inner = untag_ptr(network_graph);
75401         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75402         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75403         network_graph_conv.is_owned = false;
75404         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
75405         CHECK_ACCESS(utxo_lookup_ptr);
75406         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
75407         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
75408         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
75409                 // Manually implement clone for Java trait instances
75410                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
75411                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75412                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
75413                 }
75414         }
75415         void* logger_ptr = untag_ptr(logger);
75416         CHECK_ACCESS(logger_ptr);
75417         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75418         if (logger_conv.free == LDKLogger_JCalls_free) {
75419                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75420                 LDKLogger_JCalls_cloned(&logger_conv);
75421         }
75422         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
75423         int64_t ret_ref = 0;
75424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75426         return ret_ref;
75427 }
75428
75429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
75430         LDKP2PGossipSync this_arg_conv;
75431         this_arg_conv.inner = untag_ptr(this_arg);
75432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75434         this_arg_conv.is_owned = false;
75435         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
75436         CHECK_ACCESS(utxo_lookup_ptr);
75437         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
75438         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
75439         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
75440                 // Manually implement clone for Java trait instances
75441                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
75442                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75443                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
75444                 }
75445         }
75446         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
75447 }
75448
75449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
75450         LDKNetworkGraph this_arg_conv;
75451         this_arg_conv.inner = untag_ptr(this_arg);
75452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75454         this_arg_conv.is_owned = false;
75455         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
75456         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
75457 }
75458
75459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
75460         LDKNetworkGraph this_arg_conv;
75461         this_arg_conv.inner = untag_ptr(this_arg);
75462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75464         this_arg_conv.is_owned = false;
75465         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75466         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
75467         return ret_arr;
75468 }
75469
75470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
75471         LDKNodeAnnouncement msg_conv;
75472         msg_conv.inner = untag_ptr(msg);
75473         msg_conv.is_owned = ptr_is_owned(msg);
75474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75475         msg_conv.is_owned = false;
75476         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75477         *ret_conv = verify_node_announcement(&msg_conv);
75478         return tag_ptr(ret_conv, true);
75479 }
75480
75481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
75482         LDKChannelAnnouncement msg_conv;
75483         msg_conv.inner = untag_ptr(msg);
75484         msg_conv.is_owned = ptr_is_owned(msg);
75485         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75486         msg_conv.is_owned = false;
75487         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75488         *ret_conv = verify_channel_announcement(&msg_conv);
75489         return tag_ptr(ret_conv, true);
75490 }
75491
75492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
75493         LDKP2PGossipSync this_arg_conv;
75494         this_arg_conv.inner = untag_ptr(this_arg);
75495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75497         this_arg_conv.is_owned = false;
75498         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
75499         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
75500         return tag_ptr(ret_ret, true);
75501 }
75502
75503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
75504         LDKP2PGossipSync this_arg_conv;
75505         this_arg_conv.inner = untag_ptr(this_arg);
75506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75508         this_arg_conv.is_owned = false;
75509         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
75510         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
75511         return tag_ptr(ret_ret, true);
75512 }
75513
75514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75515         LDKChannelUpdateInfo this_obj_conv;
75516         this_obj_conv.inner = untag_ptr(this_obj);
75517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75519         ChannelUpdateInfo_free(this_obj_conv);
75520 }
75521
75522 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
75523         LDKChannelUpdateInfo this_ptr_conv;
75524         this_ptr_conv.inner = untag_ptr(this_ptr);
75525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75527         this_ptr_conv.is_owned = false;
75528         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
75529         return ret_conv;
75530 }
75531
75532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
75533         LDKChannelUpdateInfo this_ptr_conv;
75534         this_ptr_conv.inner = untag_ptr(this_ptr);
75535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75537         this_ptr_conv.is_owned = false;
75538         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
75539 }
75540
75541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
75542         LDKChannelUpdateInfo this_ptr_conv;
75543         this_ptr_conv.inner = untag_ptr(this_ptr);
75544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75546         this_ptr_conv.is_owned = false;
75547         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
75548         return ret_conv;
75549 }
75550
75551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
75552         LDKChannelUpdateInfo this_ptr_conv;
75553         this_ptr_conv.inner = untag_ptr(this_ptr);
75554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75556         this_ptr_conv.is_owned = false;
75557         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
75558 }
75559
75560 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
75561         LDKChannelUpdateInfo this_ptr_conv;
75562         this_ptr_conv.inner = untag_ptr(this_ptr);
75563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75565         this_ptr_conv.is_owned = false;
75566         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
75567         return ret_conv;
75568 }
75569
75570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
75571         LDKChannelUpdateInfo this_ptr_conv;
75572         this_ptr_conv.inner = untag_ptr(this_ptr);
75573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75575         this_ptr_conv.is_owned = false;
75576         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
75577 }
75578
75579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
75580         LDKChannelUpdateInfo this_ptr_conv;
75581         this_ptr_conv.inner = untag_ptr(this_ptr);
75582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75584         this_ptr_conv.is_owned = false;
75585         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
75586         return ret_conv;
75587 }
75588
75589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75590         LDKChannelUpdateInfo this_ptr_conv;
75591         this_ptr_conv.inner = untag_ptr(this_ptr);
75592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75594         this_ptr_conv.is_owned = false;
75595         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
75596 }
75597
75598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
75599         LDKChannelUpdateInfo this_ptr_conv;
75600         this_ptr_conv.inner = untag_ptr(this_ptr);
75601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75603         this_ptr_conv.is_owned = false;
75604         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
75605         return ret_conv;
75606 }
75607
75608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75609         LDKChannelUpdateInfo this_ptr_conv;
75610         this_ptr_conv.inner = untag_ptr(this_ptr);
75611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75613         this_ptr_conv.is_owned = false;
75614         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
75615 }
75616
75617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
75618         LDKChannelUpdateInfo this_ptr_conv;
75619         this_ptr_conv.inner = untag_ptr(this_ptr);
75620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75622         this_ptr_conv.is_owned = false;
75623         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
75624         int64_t ret_ref = 0;
75625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75627         return ret_ref;
75628 }
75629
75630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75631         LDKChannelUpdateInfo this_ptr_conv;
75632         this_ptr_conv.inner = untag_ptr(this_ptr);
75633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75635         this_ptr_conv.is_owned = false;
75636         LDKRoutingFees val_conv;
75637         val_conv.inner = untag_ptr(val);
75638         val_conv.is_owned = ptr_is_owned(val);
75639         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75640         val_conv = RoutingFees_clone(&val_conv);
75641         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
75642 }
75643
75644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
75645         LDKChannelUpdateInfo this_ptr_conv;
75646         this_ptr_conv.inner = untag_ptr(this_ptr);
75647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75649         this_ptr_conv.is_owned = false;
75650         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
75651         int64_t ret_ref = 0;
75652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75654         return ret_ref;
75655 }
75656
75657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75658         LDKChannelUpdateInfo this_ptr_conv;
75659         this_ptr_conv.inner = untag_ptr(this_ptr);
75660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75662         this_ptr_conv.is_owned = false;
75663         LDKChannelUpdate val_conv;
75664         val_conv.inner = untag_ptr(val);
75665         val_conv.is_owned = ptr_is_owned(val);
75666         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75667         val_conv = ChannelUpdate_clone(&val_conv);
75668         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
75669 }
75670
75671 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) {
75672         LDKRoutingFees fees_arg_conv;
75673         fees_arg_conv.inner = untag_ptr(fees_arg);
75674         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
75675         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
75676         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
75677         LDKChannelUpdate last_update_message_arg_conv;
75678         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
75679         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
75680         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
75681         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
75682         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);
75683         int64_t ret_ref = 0;
75684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75686         return ret_ref;
75687 }
75688
75689 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
75690         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
75691         int64_t ret_ref = 0;
75692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75694         return ret_ref;
75695 }
75696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75697         LDKChannelUpdateInfo arg_conv;
75698         arg_conv.inner = untag_ptr(arg);
75699         arg_conv.is_owned = ptr_is_owned(arg);
75700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75701         arg_conv.is_owned = false;
75702         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
75703         return ret_conv;
75704 }
75705
75706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75707         LDKChannelUpdateInfo orig_conv;
75708         orig_conv.inner = untag_ptr(orig);
75709         orig_conv.is_owned = ptr_is_owned(orig);
75710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75711         orig_conv.is_owned = false;
75712         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
75713         int64_t ret_ref = 0;
75714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75716         return ret_ref;
75717 }
75718
75719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75720         LDKChannelUpdateInfo a_conv;
75721         a_conv.inner = untag_ptr(a);
75722         a_conv.is_owned = ptr_is_owned(a);
75723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75724         a_conv.is_owned = false;
75725         LDKChannelUpdateInfo b_conv;
75726         b_conv.inner = untag_ptr(b);
75727         b_conv.is_owned = ptr_is_owned(b);
75728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75729         b_conv.is_owned = false;
75730         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
75731         return ret_conv;
75732 }
75733
75734 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75735         LDKChannelUpdateInfo o_conv;
75736         o_conv.inner = untag_ptr(o);
75737         o_conv.is_owned = ptr_is_owned(o);
75738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75739         o_conv.is_owned = false;
75740         LDKStr ret_str = ChannelUpdateInfo_to_str(&o_conv);
75741         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75742         Str_free(ret_str);
75743         return ret_conv;
75744 }
75745
75746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
75747         LDKChannelUpdateInfo obj_conv;
75748         obj_conv.inner = untag_ptr(obj);
75749         obj_conv.is_owned = ptr_is_owned(obj);
75750         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75751         obj_conv.is_owned = false;
75752         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
75753         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75754         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75755         CVec_u8Z_free(ret_var);
75756         return ret_arr;
75757 }
75758
75759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75760         LDKu8slice ser_ref;
75761         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75762         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75763         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
75764         *ret_conv = ChannelUpdateInfo_read(ser_ref);
75765         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75766         return tag_ptr(ret_conv, true);
75767 }
75768
75769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75770         LDKChannelInfo this_obj_conv;
75771         this_obj_conv.inner = untag_ptr(this_obj);
75772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75774         ChannelInfo_free(this_obj_conv);
75775 }
75776
75777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
75778         LDKChannelInfo this_ptr_conv;
75779         this_ptr_conv.inner = untag_ptr(this_ptr);
75780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75782         this_ptr_conv.is_owned = false;
75783         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
75784         int64_t ret_ref = 0;
75785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75787         return ret_ref;
75788 }
75789
75790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75791         LDKChannelInfo this_ptr_conv;
75792         this_ptr_conv.inner = untag_ptr(this_ptr);
75793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75795         this_ptr_conv.is_owned = false;
75796         LDKChannelFeatures val_conv;
75797         val_conv.inner = untag_ptr(val);
75798         val_conv.is_owned = ptr_is_owned(val);
75799         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75800         val_conv = ChannelFeatures_clone(&val_conv);
75801         ChannelInfo_set_features(&this_ptr_conv, val_conv);
75802 }
75803
75804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
75805         LDKChannelInfo this_ptr_conv;
75806         this_ptr_conv.inner = untag_ptr(this_ptr);
75807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75809         this_ptr_conv.is_owned = false;
75810         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
75811         int64_t ret_ref = 0;
75812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75814         return ret_ref;
75815 }
75816
75817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75818         LDKChannelInfo this_ptr_conv;
75819         this_ptr_conv.inner = untag_ptr(this_ptr);
75820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75822         this_ptr_conv.is_owned = false;
75823         LDKNodeId val_conv;
75824         val_conv.inner = untag_ptr(val);
75825         val_conv.is_owned = ptr_is_owned(val);
75826         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75827         val_conv = NodeId_clone(&val_conv);
75828         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
75829 }
75830
75831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
75832         LDKChannelInfo this_ptr_conv;
75833         this_ptr_conv.inner = untag_ptr(this_ptr);
75834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75836         this_ptr_conv.is_owned = false;
75837         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
75838         int64_t ret_ref = 0;
75839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75841         return ret_ref;
75842 }
75843
75844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75845         LDKChannelInfo this_ptr_conv;
75846         this_ptr_conv.inner = untag_ptr(this_ptr);
75847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75849         this_ptr_conv.is_owned = false;
75850         LDKChannelUpdateInfo val_conv;
75851         val_conv.inner = untag_ptr(val);
75852         val_conv.is_owned = ptr_is_owned(val);
75853         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75854         val_conv = ChannelUpdateInfo_clone(&val_conv);
75855         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
75856 }
75857
75858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
75859         LDKChannelInfo this_ptr_conv;
75860         this_ptr_conv.inner = untag_ptr(this_ptr);
75861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75863         this_ptr_conv.is_owned = false;
75864         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
75865         int64_t ret_ref = 0;
75866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75868         return ret_ref;
75869 }
75870
75871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75872         LDKChannelInfo this_ptr_conv;
75873         this_ptr_conv.inner = untag_ptr(this_ptr);
75874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75876         this_ptr_conv.is_owned = false;
75877         LDKNodeId val_conv;
75878         val_conv.inner = untag_ptr(val);
75879         val_conv.is_owned = ptr_is_owned(val);
75880         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75881         val_conv = NodeId_clone(&val_conv);
75882         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
75883 }
75884
75885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
75886         LDKChannelInfo this_ptr_conv;
75887         this_ptr_conv.inner = untag_ptr(this_ptr);
75888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75890         this_ptr_conv.is_owned = false;
75891         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
75892         int64_t ret_ref = 0;
75893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75895         return ret_ref;
75896 }
75897
75898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75899         LDKChannelInfo this_ptr_conv;
75900         this_ptr_conv.inner = untag_ptr(this_ptr);
75901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75903         this_ptr_conv.is_owned = false;
75904         LDKChannelUpdateInfo val_conv;
75905         val_conv.inner = untag_ptr(val);
75906         val_conv.is_owned = ptr_is_owned(val);
75907         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75908         val_conv = ChannelUpdateInfo_clone(&val_conv);
75909         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
75910 }
75911
75912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
75913         LDKChannelInfo this_ptr_conv;
75914         this_ptr_conv.inner = untag_ptr(this_ptr);
75915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75917         this_ptr_conv.is_owned = false;
75918         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75919         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
75920         int64_t ret_ref = tag_ptr(ret_copy, true);
75921         return ret_ref;
75922 }
75923
75924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75925         LDKChannelInfo this_ptr_conv;
75926         this_ptr_conv.inner = untag_ptr(this_ptr);
75927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75929         this_ptr_conv.is_owned = false;
75930         void* val_ptr = untag_ptr(val);
75931         CHECK_ACCESS(val_ptr);
75932         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
75933         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
75934         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
75935 }
75936
75937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
75938         LDKChannelInfo this_ptr_conv;
75939         this_ptr_conv.inner = untag_ptr(this_ptr);
75940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75942         this_ptr_conv.is_owned = false;
75943         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
75944         int64_t ret_ref = 0;
75945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75947         return ret_ref;
75948 }
75949
75950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75951         LDKChannelInfo this_ptr_conv;
75952         this_ptr_conv.inner = untag_ptr(this_ptr);
75953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75955         this_ptr_conv.is_owned = false;
75956         LDKChannelAnnouncement val_conv;
75957         val_conv.inner = untag_ptr(val);
75958         val_conv.is_owned = ptr_is_owned(val);
75959         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75960         val_conv = ChannelAnnouncement_clone(&val_conv);
75961         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
75962 }
75963
75964 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
75965         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
75966         int64_t ret_ref = 0;
75967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75969         return ret_ref;
75970 }
75971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75972         LDKChannelInfo arg_conv;
75973         arg_conv.inner = untag_ptr(arg);
75974         arg_conv.is_owned = ptr_is_owned(arg);
75975         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75976         arg_conv.is_owned = false;
75977         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
75978         return ret_conv;
75979 }
75980
75981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75982         LDKChannelInfo orig_conv;
75983         orig_conv.inner = untag_ptr(orig);
75984         orig_conv.is_owned = ptr_is_owned(orig);
75985         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75986         orig_conv.is_owned = false;
75987         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
75988         int64_t ret_ref = 0;
75989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75991         return ret_ref;
75992 }
75993
75994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75995         LDKChannelInfo a_conv;
75996         a_conv.inner = untag_ptr(a);
75997         a_conv.is_owned = ptr_is_owned(a);
75998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75999         a_conv.is_owned = false;
76000         LDKChannelInfo b_conv;
76001         b_conv.inner = untag_ptr(b);
76002         b_conv.is_owned = ptr_is_owned(b);
76003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76004         b_conv.is_owned = false;
76005         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
76006         return ret_conv;
76007 }
76008
76009 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) {
76010         LDKChannelInfo this_arg_conv;
76011         this_arg_conv.inner = untag_ptr(this_arg);
76012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76014         this_arg_conv.is_owned = false;
76015         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
76016         int64_t ret_ref = 0;
76017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76019         return ret_ref;
76020 }
76021
76022 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76023         LDKChannelInfo o_conv;
76024         o_conv.inner = untag_ptr(o);
76025         o_conv.is_owned = ptr_is_owned(o);
76026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76027         o_conv.is_owned = false;
76028         LDKStr ret_str = ChannelInfo_to_str(&o_conv);
76029         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76030         Str_free(ret_str);
76031         return ret_conv;
76032 }
76033
76034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
76035         LDKChannelInfo obj_conv;
76036         obj_conv.inner = untag_ptr(obj);
76037         obj_conv.is_owned = ptr_is_owned(obj);
76038         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76039         obj_conv.is_owned = false;
76040         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
76041         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76042         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76043         CVec_u8Z_free(ret_var);
76044         return ret_arr;
76045 }
76046
76047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76048         LDKu8slice ser_ref;
76049         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76050         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76051         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
76052         *ret_conv = ChannelInfo_read(ser_ref);
76053         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76054         return tag_ptr(ret_conv, true);
76055 }
76056
76057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76058         LDKDirectedChannelInfo this_obj_conv;
76059         this_obj_conv.inner = untag_ptr(this_obj);
76060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76062         DirectedChannelInfo_free(this_obj_conv);
76063 }
76064
76065 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
76066         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
76067         int64_t ret_ref = 0;
76068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76070         return ret_ref;
76071 }
76072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76073         LDKDirectedChannelInfo arg_conv;
76074         arg_conv.inner = untag_ptr(arg);
76075         arg_conv.is_owned = ptr_is_owned(arg);
76076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76077         arg_conv.is_owned = false;
76078         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
76079         return ret_conv;
76080 }
76081
76082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76083         LDKDirectedChannelInfo orig_conv;
76084         orig_conv.inner = untag_ptr(orig);
76085         orig_conv.is_owned = ptr_is_owned(orig);
76086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76087         orig_conv.is_owned = false;
76088         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
76089         int64_t ret_ref = 0;
76090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76092         return ret_ref;
76093 }
76094
76095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
76096         LDKDirectedChannelInfo this_arg_conv;
76097         this_arg_conv.inner = untag_ptr(this_arg);
76098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76100         this_arg_conv.is_owned = false;
76101         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
76102         int64_t ret_ref = 0;
76103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76105         return ret_ref;
76106 }
76107
76108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
76109         LDKDirectedChannelInfo this_arg_conv;
76110         this_arg_conv.inner = untag_ptr(this_arg);
76111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76113         this_arg_conv.is_owned = false;
76114         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76115         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
76116         int64_t ret_ref = tag_ptr(ret_copy, true);
76117         return ret_ref;
76118 }
76119
76120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
76121         LDKDirectedChannelInfo this_arg_conv;
76122         this_arg_conv.inner = untag_ptr(this_arg);
76123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76125         this_arg_conv.is_owned = false;
76126         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
76127         int64_t ret_ref = 0;
76128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76130         return ret_ref;
76131 }
76132
76133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
76134         LDKDirectedChannelInfo this_arg_conv;
76135         this_arg_conv.inner = untag_ptr(this_arg);
76136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76138         this_arg_conv.is_owned = false;
76139         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
76140         int64_t ret_ref = 0;
76141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76143         return ret_ref;
76144 }
76145
76146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
76147         if (!ptr_is_owned(this_ptr)) return;
76148         void* this_ptr_ptr = untag_ptr(this_ptr);
76149         CHECK_ACCESS(this_ptr_ptr);
76150         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
76151         FREE(untag_ptr(this_ptr));
76152         EffectiveCapacity_free(this_ptr_conv);
76153 }
76154
76155 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
76156         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76157         *ret_copy = EffectiveCapacity_clone(arg);
76158         int64_t ret_ref = tag_ptr(ret_copy, true);
76159         return ret_ref;
76160 }
76161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76162         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
76163         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
76164         return ret_conv;
76165 }
76166
76167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76168         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
76169         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76170         *ret_copy = EffectiveCapacity_clone(orig_conv);
76171         int64_t ret_ref = tag_ptr(ret_copy, true);
76172         return ret_ref;
76173 }
76174
76175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
76176         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76177         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
76178         int64_t ret_ref = tag_ptr(ret_copy, true);
76179         return ret_ref;
76180 }
76181
76182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
76183         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76184         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
76185         int64_t ret_ref = tag_ptr(ret_copy, true);
76186         return ret_ref;
76187 }
76188
76189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
76190         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76191         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
76192         int64_t ret_ref = tag_ptr(ret_copy, true);
76193         return ret_ref;
76194 }
76195
76196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
76197         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76198         *ret_copy = EffectiveCapacity_infinite();
76199         int64_t ret_ref = tag_ptr(ret_copy, true);
76200         return ret_ref;
76201 }
76202
76203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
76204         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76205         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
76206         int64_t ret_ref = tag_ptr(ret_copy, true);
76207         return ret_ref;
76208 }
76209
76210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
76211         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
76212         *ret_copy = EffectiveCapacity_unknown();
76213         int64_t ret_ref = tag_ptr(ret_copy, true);
76214         return ret_ref;
76215 }
76216
76217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
76218         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
76219         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
76220         return ret_conv;
76221 }
76222
76223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76224         LDKRoutingFees this_obj_conv;
76225         this_obj_conv.inner = untag_ptr(this_obj);
76226         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76228         RoutingFees_free(this_obj_conv);
76229 }
76230
76231 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76232         LDKRoutingFees this_ptr_conv;
76233         this_ptr_conv.inner = untag_ptr(this_ptr);
76234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76236         this_ptr_conv.is_owned = false;
76237         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
76238         return ret_conv;
76239 }
76240
76241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76242         LDKRoutingFees this_ptr_conv;
76243         this_ptr_conv.inner = untag_ptr(this_ptr);
76244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76246         this_ptr_conv.is_owned = false;
76247         RoutingFees_set_base_msat(&this_ptr_conv, val);
76248 }
76249
76250 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
76251         LDKRoutingFees this_ptr_conv;
76252         this_ptr_conv.inner = untag_ptr(this_ptr);
76253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76255         this_ptr_conv.is_owned = false;
76256         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
76257         return ret_conv;
76258 }
76259
76260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76261         LDKRoutingFees this_ptr_conv;
76262         this_ptr_conv.inner = untag_ptr(this_ptr);
76263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76265         this_ptr_conv.is_owned = false;
76266         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
76267 }
76268
76269 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) {
76270         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
76271         int64_t ret_ref = 0;
76272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76274         return ret_ref;
76275 }
76276
76277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76278         LDKRoutingFees a_conv;
76279         a_conv.inner = untag_ptr(a);
76280         a_conv.is_owned = ptr_is_owned(a);
76281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76282         a_conv.is_owned = false;
76283         LDKRoutingFees b_conv;
76284         b_conv.inner = untag_ptr(b);
76285         b_conv.is_owned = ptr_is_owned(b);
76286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76287         b_conv.is_owned = false;
76288         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
76289         return ret_conv;
76290 }
76291
76292 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
76293         LDKRoutingFees ret_var = RoutingFees_clone(arg);
76294         int64_t ret_ref = 0;
76295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76297         return ret_ref;
76298 }
76299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76300         LDKRoutingFees arg_conv;
76301         arg_conv.inner = untag_ptr(arg);
76302         arg_conv.is_owned = ptr_is_owned(arg);
76303         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76304         arg_conv.is_owned = false;
76305         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
76306         return ret_conv;
76307 }
76308
76309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76310         LDKRoutingFees orig_conv;
76311         orig_conv.inner = untag_ptr(orig);
76312         orig_conv.is_owned = ptr_is_owned(orig);
76313         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76314         orig_conv.is_owned = false;
76315         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
76316         int64_t ret_ref = 0;
76317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76319         return ret_ref;
76320 }
76321
76322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
76323         LDKRoutingFees o_conv;
76324         o_conv.inner = untag_ptr(o);
76325         o_conv.is_owned = ptr_is_owned(o);
76326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76327         o_conv.is_owned = false;
76328         int64_t ret_conv = RoutingFees_hash(&o_conv);
76329         return ret_conv;
76330 }
76331
76332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
76333         LDKRoutingFees obj_conv;
76334         obj_conv.inner = untag_ptr(obj);
76335         obj_conv.is_owned = ptr_is_owned(obj);
76336         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76337         obj_conv.is_owned = false;
76338         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
76339         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76340         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76341         CVec_u8Z_free(ret_var);
76342         return ret_arr;
76343 }
76344
76345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76346         LDKu8slice ser_ref;
76347         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76348         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76349         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
76350         *ret_conv = RoutingFees_read(ser_ref);
76351         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76352         return tag_ptr(ret_conv, true);
76353 }
76354
76355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76356         LDKNodeAnnouncementInfo this_obj_conv;
76357         this_obj_conv.inner = untag_ptr(this_obj);
76358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76360         NodeAnnouncementInfo_free(this_obj_conv);
76361 }
76362
76363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76364         LDKNodeAnnouncementInfo this_ptr_conv;
76365         this_ptr_conv.inner = untag_ptr(this_ptr);
76366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76368         this_ptr_conv.is_owned = false;
76369         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
76370         int64_t ret_ref = 0;
76371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76373         return ret_ref;
76374 }
76375
76376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76377         LDKNodeAnnouncementInfo this_ptr_conv;
76378         this_ptr_conv.inner = untag_ptr(this_ptr);
76379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76381         this_ptr_conv.is_owned = false;
76382         LDKNodeFeatures val_conv;
76383         val_conv.inner = untag_ptr(val);
76384         val_conv.is_owned = ptr_is_owned(val);
76385         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76386         val_conv = NodeFeatures_clone(&val_conv);
76387         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
76388 }
76389
76390 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
76391         LDKNodeAnnouncementInfo this_ptr_conv;
76392         this_ptr_conv.inner = untag_ptr(this_ptr);
76393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76395         this_ptr_conv.is_owned = false;
76396         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
76397         return ret_conv;
76398 }
76399
76400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76401         LDKNodeAnnouncementInfo this_ptr_conv;
76402         this_ptr_conv.inner = untag_ptr(this_ptr);
76403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76405         this_ptr_conv.is_owned = false;
76406         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
76407 }
76408
76409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
76410         LDKNodeAnnouncementInfo this_ptr_conv;
76411         this_ptr_conv.inner = untag_ptr(this_ptr);
76412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76414         this_ptr_conv.is_owned = false;
76415         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
76416         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
76417         return ret_arr;
76418 }
76419
76420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76421         LDKNodeAnnouncementInfo this_ptr_conv;
76422         this_ptr_conv.inner = untag_ptr(this_ptr);
76423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76425         this_ptr_conv.is_owned = false;
76426         LDKThreeBytes val_ref;
76427         CHECK((*env)->GetArrayLength(env, val) == 3);
76428         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
76429         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
76430 }
76431
76432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
76433         LDKNodeAnnouncementInfo this_ptr_conv;
76434         this_ptr_conv.inner = untag_ptr(this_ptr);
76435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76437         this_ptr_conv.is_owned = false;
76438         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
76439         int64_t ret_ref = 0;
76440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76442         return ret_ref;
76443 }
76444
76445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76446         LDKNodeAnnouncementInfo this_ptr_conv;
76447         this_ptr_conv.inner = untag_ptr(this_ptr);
76448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76450         this_ptr_conv.is_owned = false;
76451         LDKNodeAlias val_conv;
76452         val_conv.inner = untag_ptr(val);
76453         val_conv.is_owned = ptr_is_owned(val);
76454         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76455         val_conv = NodeAlias_clone(&val_conv);
76456         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
76457 }
76458
76459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
76460         LDKNodeAnnouncementInfo this_ptr_conv;
76461         this_ptr_conv.inner = untag_ptr(this_ptr);
76462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76464         this_ptr_conv.is_owned = false;
76465         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
76466         int64_t ret_ref = 0;
76467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76469         return ret_ref;
76470 }
76471
76472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76473         LDKNodeAnnouncementInfo this_ptr_conv;
76474         this_ptr_conv.inner = untag_ptr(this_ptr);
76475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76477         this_ptr_conv.is_owned = false;
76478         LDKNodeAnnouncement val_conv;
76479         val_conv.inner = untag_ptr(val);
76480         val_conv.is_owned = ptr_is_owned(val);
76481         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76482         val_conv = NodeAnnouncement_clone(&val_conv);
76483         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
76484 }
76485
76486 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) {
76487         LDKNodeFeatures features_arg_conv;
76488         features_arg_conv.inner = untag_ptr(features_arg);
76489         features_arg_conv.is_owned = ptr_is_owned(features_arg);
76490         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
76491         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
76492         LDKThreeBytes rgb_arg_ref;
76493         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
76494         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
76495         LDKNodeAlias alias_arg_conv;
76496         alias_arg_conv.inner = untag_ptr(alias_arg);
76497         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
76498         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
76499         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
76500         LDKNodeAnnouncement announcement_message_arg_conv;
76501         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
76502         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
76503         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
76504         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
76505         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
76506         int64_t ret_ref = 0;
76507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76509         return ret_ref;
76510 }
76511
76512 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
76513         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
76514         int64_t ret_ref = 0;
76515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76517         return ret_ref;
76518 }
76519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76520         LDKNodeAnnouncementInfo arg_conv;
76521         arg_conv.inner = untag_ptr(arg);
76522         arg_conv.is_owned = ptr_is_owned(arg);
76523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76524         arg_conv.is_owned = false;
76525         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
76526         return ret_conv;
76527 }
76528
76529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76530         LDKNodeAnnouncementInfo orig_conv;
76531         orig_conv.inner = untag_ptr(orig);
76532         orig_conv.is_owned = ptr_is_owned(orig);
76533         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76534         orig_conv.is_owned = false;
76535         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
76536         int64_t ret_ref = 0;
76537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76539         return ret_ref;
76540 }
76541
76542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76543         LDKNodeAnnouncementInfo a_conv;
76544         a_conv.inner = untag_ptr(a);
76545         a_conv.is_owned = ptr_is_owned(a);
76546         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76547         a_conv.is_owned = false;
76548         LDKNodeAnnouncementInfo b_conv;
76549         b_conv.inner = untag_ptr(b);
76550         b_conv.is_owned = ptr_is_owned(b);
76551         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76552         b_conv.is_owned = false;
76553         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
76554         return ret_conv;
76555 }
76556
76557 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
76558         LDKNodeAnnouncementInfo this_arg_conv;
76559         this_arg_conv.inner = untag_ptr(this_arg);
76560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76562         this_arg_conv.is_owned = false;
76563         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
76564         int64_tArray ret_arr = NULL;
76565         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76566         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76567         for (size_t p = 0; p < ret_var.datalen; p++) {
76568                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
76569                 *ret_conv_15_copy = ret_var.data[p];
76570                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
76571                 ret_arr_ptr[p] = ret_conv_15_ref;
76572         }
76573         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76574         FREE(ret_var.data);
76575         return ret_arr;
76576 }
76577
76578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
76579         LDKNodeAnnouncementInfo obj_conv;
76580         obj_conv.inner = untag_ptr(obj);
76581         obj_conv.is_owned = ptr_is_owned(obj);
76582         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76583         obj_conv.is_owned = false;
76584         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
76585         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76586         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76587         CVec_u8Z_free(ret_var);
76588         return ret_arr;
76589 }
76590
76591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76592         LDKu8slice ser_ref;
76593         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76594         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76595         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
76596         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
76597         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76598         return tag_ptr(ret_conv, true);
76599 }
76600
76601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76602         LDKNodeAlias this_obj_conv;
76603         this_obj_conv.inner = untag_ptr(this_obj);
76604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76606         NodeAlias_free(this_obj_conv);
76607 }
76608
76609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
76610         LDKNodeAlias this_ptr_conv;
76611         this_ptr_conv.inner = untag_ptr(this_ptr);
76612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76614         this_ptr_conv.is_owned = false;
76615         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
76616         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
76617         return ret_arr;
76618 }
76619
76620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76621         LDKNodeAlias this_ptr_conv;
76622         this_ptr_conv.inner = untag_ptr(this_ptr);
76623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76625         this_ptr_conv.is_owned = false;
76626         LDKThirtyTwoBytes val_ref;
76627         CHECK((*env)->GetArrayLength(env, val) == 32);
76628         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
76629         NodeAlias_set_a(&this_ptr_conv, val_ref);
76630 }
76631
76632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
76633         LDKThirtyTwoBytes a_arg_ref;
76634         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
76635         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
76636         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
76637         int64_t ret_ref = 0;
76638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76640         return ret_ref;
76641 }
76642
76643 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
76644         LDKNodeAlias ret_var = NodeAlias_clone(arg);
76645         int64_t ret_ref = 0;
76646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76648         return ret_ref;
76649 }
76650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76651         LDKNodeAlias arg_conv;
76652         arg_conv.inner = untag_ptr(arg);
76653         arg_conv.is_owned = ptr_is_owned(arg);
76654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76655         arg_conv.is_owned = false;
76656         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
76657         return ret_conv;
76658 }
76659
76660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76661         LDKNodeAlias orig_conv;
76662         orig_conv.inner = untag_ptr(orig);
76663         orig_conv.is_owned = ptr_is_owned(orig);
76664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76665         orig_conv.is_owned = false;
76666         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
76667         int64_t ret_ref = 0;
76668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76670         return ret_ref;
76671 }
76672
76673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1hash(JNIEnv *env, jclass clz, int64_t o) {
76674         LDKNodeAlias o_conv;
76675         o_conv.inner = untag_ptr(o);
76676         o_conv.is_owned = ptr_is_owned(o);
76677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76678         o_conv.is_owned = false;
76679         int64_t ret_conv = NodeAlias_hash(&o_conv);
76680         return ret_conv;
76681 }
76682
76683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76684         LDKNodeAlias a_conv;
76685         a_conv.inner = untag_ptr(a);
76686         a_conv.is_owned = ptr_is_owned(a);
76687         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76688         a_conv.is_owned = false;
76689         LDKNodeAlias b_conv;
76690         b_conv.inner = untag_ptr(b);
76691         b_conv.is_owned = ptr_is_owned(b);
76692         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76693         b_conv.is_owned = false;
76694         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
76695         return ret_conv;
76696 }
76697
76698 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_NodeAlias_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76699         LDKNodeAlias o_conv;
76700         o_conv.inner = untag_ptr(o);
76701         o_conv.is_owned = ptr_is_owned(o);
76702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76703         o_conv.is_owned = false;
76704         LDKStr ret_str = NodeAlias_to_str(&o_conv);
76705         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76706         Str_free(ret_str);
76707         return ret_conv;
76708 }
76709
76710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
76711         LDKNodeAlias obj_conv;
76712         obj_conv.inner = untag_ptr(obj);
76713         obj_conv.is_owned = ptr_is_owned(obj);
76714         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76715         obj_conv.is_owned = false;
76716         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
76717         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76718         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76719         CVec_u8Z_free(ret_var);
76720         return ret_arr;
76721 }
76722
76723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76724         LDKu8slice ser_ref;
76725         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76726         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76727         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
76728         *ret_conv = NodeAlias_read(ser_ref);
76729         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76730         return tag_ptr(ret_conv, true);
76731 }
76732
76733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76734         LDKNodeInfo this_obj_conv;
76735         this_obj_conv.inner = untag_ptr(this_obj);
76736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76738         NodeInfo_free(this_obj_conv);
76739 }
76740
76741 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
76742         LDKNodeInfo this_ptr_conv;
76743         this_ptr_conv.inner = untag_ptr(this_ptr);
76744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76746         this_ptr_conv.is_owned = false;
76747         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
76748         int64_tArray ret_arr = NULL;
76749         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76750         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76751         for (size_t g = 0; g < ret_var.datalen; g++) {
76752                 int64_t ret_conv_6_conv = ret_var.data[g];
76753                 ret_arr_ptr[g] = ret_conv_6_conv;
76754         }
76755         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76756         FREE(ret_var.data);
76757         return ret_arr;
76758 }
76759
76760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76761         LDKNodeInfo this_ptr_conv;
76762         this_ptr_conv.inner = untag_ptr(this_ptr);
76763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76765         this_ptr_conv.is_owned = false;
76766         LDKCVec_u64Z val_constr;
76767         val_constr.datalen = (*env)->GetArrayLength(env, val);
76768         if (val_constr.datalen > 0)
76769                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
76770         else
76771                 val_constr.data = NULL;
76772         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76773         for (size_t g = 0; g < val_constr.datalen; g++) {
76774                 int64_t val_conv_6 = val_vals[g];
76775                 val_constr.data[g] = val_conv_6;
76776         }
76777         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76778         NodeInfo_set_channels(&this_ptr_conv, val_constr);
76779 }
76780
76781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
76782         LDKNodeInfo this_ptr_conv;
76783         this_ptr_conv.inner = untag_ptr(this_ptr);
76784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76786         this_ptr_conv.is_owned = false;
76787         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
76788         int64_t ret_ref = 0;
76789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76791         return ret_ref;
76792 }
76793
76794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76795         LDKNodeInfo this_ptr_conv;
76796         this_ptr_conv.inner = untag_ptr(this_ptr);
76797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76799         this_ptr_conv.is_owned = false;
76800         LDKNodeAnnouncementInfo val_conv;
76801         val_conv.inner = untag_ptr(val);
76802         val_conv.is_owned = ptr_is_owned(val);
76803         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76804         val_conv = NodeAnnouncementInfo_clone(&val_conv);
76805         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
76806 }
76807
76808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
76809         LDKCVec_u64Z channels_arg_constr;
76810         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
76811         if (channels_arg_constr.datalen > 0)
76812                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
76813         else
76814                 channels_arg_constr.data = NULL;
76815         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
76816         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
76817                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
76818                 channels_arg_constr.data[g] = channels_arg_conv_6;
76819         }
76820         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
76821         LDKNodeAnnouncementInfo announcement_info_arg_conv;
76822         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
76823         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
76824         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
76825         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
76826         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
76827         int64_t ret_ref = 0;
76828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76830         return ret_ref;
76831 }
76832
76833 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
76834         LDKNodeInfo ret_var = NodeInfo_clone(arg);
76835         int64_t ret_ref = 0;
76836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76838         return ret_ref;
76839 }
76840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76841         LDKNodeInfo arg_conv;
76842         arg_conv.inner = untag_ptr(arg);
76843         arg_conv.is_owned = ptr_is_owned(arg);
76844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76845         arg_conv.is_owned = false;
76846         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
76847         return ret_conv;
76848 }
76849
76850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76851         LDKNodeInfo orig_conv;
76852         orig_conv.inner = untag_ptr(orig);
76853         orig_conv.is_owned = ptr_is_owned(orig);
76854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76855         orig_conv.is_owned = false;
76856         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
76857         int64_t ret_ref = 0;
76858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76860         return ret_ref;
76861 }
76862
76863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76864         LDKNodeInfo a_conv;
76865         a_conv.inner = untag_ptr(a);
76866         a_conv.is_owned = ptr_is_owned(a);
76867         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76868         a_conv.is_owned = false;
76869         LDKNodeInfo b_conv;
76870         b_conv.inner = untag_ptr(b);
76871         b_conv.is_owned = ptr_is_owned(b);
76872         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76873         b_conv.is_owned = false;
76874         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
76875         return ret_conv;
76876 }
76877
76878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1is_1tor_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
76879         LDKNodeInfo this_arg_conv;
76880         this_arg_conv.inner = untag_ptr(this_arg);
76881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76883         this_arg_conv.is_owned = false;
76884         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
76885         return ret_conv;
76886 }
76887
76888 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_NodeInfo_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76889         LDKNodeInfo o_conv;
76890         o_conv.inner = untag_ptr(o);
76891         o_conv.is_owned = ptr_is_owned(o);
76892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76893         o_conv.is_owned = false;
76894         LDKStr ret_str = NodeInfo_to_str(&o_conv);
76895         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76896         Str_free(ret_str);
76897         return ret_conv;
76898 }
76899
76900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
76901         LDKNodeInfo obj_conv;
76902         obj_conv.inner = untag_ptr(obj);
76903         obj_conv.is_owned = ptr_is_owned(obj);
76904         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76905         obj_conv.is_owned = false;
76906         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
76907         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76908         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76909         CVec_u8Z_free(ret_var);
76910         return ret_arr;
76911 }
76912
76913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76914         LDKu8slice ser_ref;
76915         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76916         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76917         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
76918         *ret_conv = NodeInfo_read(ser_ref);
76919         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76920         return tag_ptr(ret_conv, true);
76921 }
76922
76923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
76924         LDKNetworkGraph obj_conv;
76925         obj_conv.inner = untag_ptr(obj);
76926         obj_conv.is_owned = ptr_is_owned(obj);
76927         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76928         obj_conv.is_owned = false;
76929         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
76930         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76931         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76932         CVec_u8Z_free(ret_var);
76933         return ret_arr;
76934 }
76935
76936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
76937         LDKu8slice ser_ref;
76938         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76939         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76940         void* arg_ptr = untag_ptr(arg);
76941         CHECK_ACCESS(arg_ptr);
76942         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
76943         if (arg_conv.free == LDKLogger_JCalls_free) {
76944                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76945                 LDKLogger_JCalls_cloned(&arg_conv);
76946         }
76947         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
76948         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
76949         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76950         return tag_ptr(ret_conv, true);
76951 }
76952
76953 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76954         LDKNetworkGraph o_conv;
76955         o_conv.inner = untag_ptr(o);
76956         o_conv.is_owned = ptr_is_owned(o);
76957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76958         o_conv.is_owned = false;
76959         LDKStr ret_str = NetworkGraph_to_str(&o_conv);
76960         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76961         Str_free(ret_str);
76962         return ret_conv;
76963 }
76964
76965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
76966         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
76967         void* logger_ptr = untag_ptr(logger);
76968         CHECK_ACCESS(logger_ptr);
76969         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76970         if (logger_conv.free == LDKLogger_JCalls_free) {
76971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76972                 LDKLogger_JCalls_cloned(&logger_conv);
76973         }
76974         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
76975         int64_t ret_ref = 0;
76976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76978         return ret_ref;
76979 }
76980
76981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
76982         LDKNetworkGraph this_arg_conv;
76983         this_arg_conv.inner = untag_ptr(this_arg);
76984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76986         this_arg_conv.is_owned = false;
76987         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
76988         int64_t ret_ref = 0;
76989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76991         return ret_ref;
76992 }
76993
76994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
76995         LDKNetworkGraph this_arg_conv;
76996         this_arg_conv.inner = untag_ptr(this_arg);
76997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76999         this_arg_conv.is_owned = false;
77000         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
77001         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
77002         int64_t ret_ref = tag_ptr(ret_copy, true);
77003         return ret_ref;
77004 }
77005
77006 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) {
77007         LDKNetworkGraph this_arg_conv;
77008         this_arg_conv.inner = untag_ptr(this_arg);
77009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77011         this_arg_conv.is_owned = false;
77012         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
77013 }
77014
77015 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) {
77016         LDKNetworkGraph this_arg_conv;
77017         this_arg_conv.inner = untag_ptr(this_arg);
77018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77020         this_arg_conv.is_owned = false;
77021         LDKNodeAnnouncement msg_conv;
77022         msg_conv.inner = untag_ptr(msg);
77023         msg_conv.is_owned = ptr_is_owned(msg);
77024         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77025         msg_conv.is_owned = false;
77026         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77027         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
77028         return tag_ptr(ret_conv, true);
77029 }
77030
77031 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) {
77032         LDKNetworkGraph this_arg_conv;
77033         this_arg_conv.inner = untag_ptr(this_arg);
77034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77036         this_arg_conv.is_owned = false;
77037         LDKUnsignedNodeAnnouncement msg_conv;
77038         msg_conv.inner = untag_ptr(msg);
77039         msg_conv.is_owned = ptr_is_owned(msg);
77040         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77041         msg_conv.is_owned = false;
77042         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77043         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
77044         return tag_ptr(ret_conv, true);
77045 }
77046
77047 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) {
77048         LDKNetworkGraph this_arg_conv;
77049         this_arg_conv.inner = untag_ptr(this_arg);
77050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77052         this_arg_conv.is_owned = false;
77053         LDKChannelAnnouncement msg_conv;
77054         msg_conv.inner = untag_ptr(msg);
77055         msg_conv.is_owned = ptr_is_owned(msg);
77056         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77057         msg_conv.is_owned = false;
77058         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
77059         CHECK_ACCESS(utxo_lookup_ptr);
77060         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
77061         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
77062         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
77063                 // Manually implement clone for Java trait instances
77064                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
77065                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77066                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
77067                 }
77068         }
77069         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77070         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
77071         return tag_ptr(ret_conv, true);
77072 }
77073
77074 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) {
77075         LDKNetworkGraph this_arg_conv;
77076         this_arg_conv.inner = untag_ptr(this_arg);
77077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77079         this_arg_conv.is_owned = false;
77080         LDKChannelAnnouncement msg_conv;
77081         msg_conv.inner = untag_ptr(msg);
77082         msg_conv.is_owned = ptr_is_owned(msg);
77083         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77084         msg_conv.is_owned = false;
77085         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77086         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
77087         return tag_ptr(ret_conv, true);
77088 }
77089
77090 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) {
77091         LDKNetworkGraph this_arg_conv;
77092         this_arg_conv.inner = untag_ptr(this_arg);
77093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77095         this_arg_conv.is_owned = false;
77096         LDKUnsignedChannelAnnouncement msg_conv;
77097         msg_conv.inner = untag_ptr(msg);
77098         msg_conv.is_owned = ptr_is_owned(msg);
77099         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77100         msg_conv.is_owned = false;
77101         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
77102         CHECK_ACCESS(utxo_lookup_ptr);
77103         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
77104         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
77105         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
77106                 // Manually implement clone for Java trait instances
77107                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
77108                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77109                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
77110                 }
77111         }
77112         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77113         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
77114         return tag_ptr(ret_conv, true);
77115 }
77116
77117 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) {
77118         LDKNetworkGraph this_arg_conv;
77119         this_arg_conv.inner = untag_ptr(this_arg);
77120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77122         this_arg_conv.is_owned = false;
77123         LDKChannelFeatures features_conv;
77124         features_conv.inner = untag_ptr(features);
77125         features_conv.is_owned = ptr_is_owned(features);
77126         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
77127         features_conv = ChannelFeatures_clone(&features_conv);
77128         LDKPublicKey node_id_1_ref;
77129         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
77130         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
77131         LDKPublicKey node_id_2_ref;
77132         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
77133         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
77134         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77135         *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);
77136         return tag_ptr(ret_conv, true);
77137 }
77138
77139 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) {
77140         LDKNetworkGraph this_arg_conv;
77141         this_arg_conv.inner = untag_ptr(this_arg);
77142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77144         this_arg_conv.is_owned = false;
77145         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
77146 }
77147
77148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
77149         LDKNetworkGraph this_arg_conv;
77150         this_arg_conv.inner = untag_ptr(this_arg);
77151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77153         this_arg_conv.is_owned = false;
77154         LDKPublicKey node_id_ref;
77155         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77156         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77157         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
77158 }
77159
77160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
77161         LDKNetworkGraph this_arg_conv;
77162         this_arg_conv.inner = untag_ptr(this_arg);
77163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77165         this_arg_conv.is_owned = false;
77166         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
77167 }
77168
77169 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) {
77170         LDKNetworkGraph this_arg_conv;
77171         this_arg_conv.inner = untag_ptr(this_arg);
77172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77174         this_arg_conv.is_owned = false;
77175         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
77176 }
77177
77178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
77179         LDKNetworkGraph this_arg_conv;
77180         this_arg_conv.inner = untag_ptr(this_arg);
77181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77183         this_arg_conv.is_owned = false;
77184         LDKChannelUpdate msg_conv;
77185         msg_conv.inner = untag_ptr(msg);
77186         msg_conv.is_owned = ptr_is_owned(msg);
77187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77188         msg_conv.is_owned = false;
77189         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77190         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
77191         return tag_ptr(ret_conv, true);
77192 }
77193
77194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
77195         LDKNetworkGraph this_arg_conv;
77196         this_arg_conv.inner = untag_ptr(this_arg);
77197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77199         this_arg_conv.is_owned = false;
77200         LDKUnsignedChannelUpdate msg_conv;
77201         msg_conv.inner = untag_ptr(msg);
77202         msg_conv.is_owned = ptr_is_owned(msg);
77203         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77204         msg_conv.is_owned = false;
77205         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77206         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
77207         return tag_ptr(ret_conv, true);
77208 }
77209
77210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
77211         LDKNetworkGraph this_arg_conv;
77212         this_arg_conv.inner = untag_ptr(this_arg);
77213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77215         this_arg_conv.is_owned = false;
77216         LDKChannelUpdate msg_conv;
77217         msg_conv.inner = untag_ptr(msg);
77218         msg_conv.is_owned = ptr_is_owned(msg);
77219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77220         msg_conv.is_owned = false;
77221         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
77222         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
77223         return tag_ptr(ret_conv, true);
77224 }
77225
77226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
77227         LDKReadOnlyNetworkGraph this_arg_conv;
77228         this_arg_conv.inner = untag_ptr(this_arg);
77229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77231         this_arg_conv.is_owned = false;
77232         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
77233         int64_t ret_ref = 0;
77234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77236         return ret_ref;
77237 }
77238
77239 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
77240         LDKReadOnlyNetworkGraph this_arg_conv;
77241         this_arg_conv.inner = untag_ptr(this_arg);
77242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77244         this_arg_conv.is_owned = false;
77245         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
77246         int64_tArray ret_arr = NULL;
77247         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77248         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77249         for (size_t g = 0; g < ret_var.datalen; g++) {
77250                 int64_t ret_conv_6_conv = ret_var.data[g];
77251                 ret_arr_ptr[g] = ret_conv_6_conv;
77252         }
77253         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77254         FREE(ret_var.data);
77255         return ret_arr;
77256 }
77257
77258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
77259         LDKReadOnlyNetworkGraph this_arg_conv;
77260         this_arg_conv.inner = untag_ptr(this_arg);
77261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77263         this_arg_conv.is_owned = false;
77264         LDKNodeId node_id_conv;
77265         node_id_conv.inner = untag_ptr(node_id);
77266         node_id_conv.is_owned = ptr_is_owned(node_id);
77267         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
77268         node_id_conv.is_owned = false;
77269         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
77270         int64_t ret_ref = 0;
77271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77273         return ret_ref;
77274 }
77275
77276 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
77277         LDKReadOnlyNetworkGraph this_arg_conv;
77278         this_arg_conv.inner = untag_ptr(this_arg);
77279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77281         this_arg_conv.is_owned = false;
77282         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
77283         int64_tArray ret_arr = NULL;
77284         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77285         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77286         for (size_t i = 0; i < ret_var.datalen; i++) {
77287                 LDKNodeId ret_conv_8_var = ret_var.data[i];
77288                 int64_t ret_conv_8_ref = 0;
77289                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
77290                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
77291                 ret_arr_ptr[i] = ret_conv_8_ref;
77292         }
77293         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77294         FREE(ret_var.data);
77295         return ret_arr;
77296 }
77297
77298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
77299         LDKReadOnlyNetworkGraph this_arg_conv;
77300         this_arg_conv.inner = untag_ptr(this_arg);
77301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77303         this_arg_conv.is_owned = false;
77304         LDKPublicKey pubkey_ref;
77305         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
77306         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
77307         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
77308         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
77309         int64_t ret_ref = tag_ptr(ret_copy, true);
77310         return ret_ref;
77311 }
77312
77313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77314         LDKDefaultRouter this_obj_conv;
77315         this_obj_conv.inner = untag_ptr(this_obj);
77316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77318         DefaultRouter_free(this_obj_conv);
77319 }
77320
77321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
77322         LDKNetworkGraph network_graph_conv;
77323         network_graph_conv.inner = untag_ptr(network_graph);
77324         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77325         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77326         network_graph_conv.is_owned = false;
77327         void* logger_ptr = untag_ptr(logger);
77328         CHECK_ACCESS(logger_ptr);
77329         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77330         if (logger_conv.free == LDKLogger_JCalls_free) {
77331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77332                 LDKLogger_JCalls_cloned(&logger_conv);
77333         }
77334         void* entropy_source_ptr = untag_ptr(entropy_source);
77335         CHECK_ACCESS(entropy_source_ptr);
77336         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77337         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77339                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77340         }
77341         void* scorer_ptr = untag_ptr(scorer);
77342         CHECK_ACCESS(scorer_ptr);
77343         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
77344         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
77345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77346                 LDKLockableScore_JCalls_cloned(&scorer_conv);
77347         }
77348         LDKProbabilisticScoringFeeParameters score_params_conv;
77349         score_params_conv.inner = untag_ptr(score_params);
77350         score_params_conv.is_owned = ptr_is_owned(score_params);
77351         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
77352         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
77353         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
77354         int64_t ret_ref = 0;
77355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77357         return ret_ref;
77358 }
77359
77360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
77361         LDKDefaultRouter this_arg_conv;
77362         this_arg_conv.inner = untag_ptr(this_arg);
77363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77365         this_arg_conv.is_owned = false;
77366         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
77367         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
77368         return tag_ptr(ret_ret, true);
77369 }
77370
77371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
77372         LDKDefaultRouter this_arg_conv;
77373         this_arg_conv.inner = untag_ptr(this_arg);
77374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77376         this_arg_conv.is_owned = false;
77377         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
77378         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
77379         return tag_ptr(ret_ret, true);
77380 }
77381
77382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77383         if (!ptr_is_owned(this_ptr)) return;
77384         void* this_ptr_ptr = untag_ptr(this_ptr);
77385         CHECK_ACCESS(this_ptr_ptr);
77386         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
77387         FREE(untag_ptr(this_ptr));
77388         Router_free(this_ptr_conv);
77389 }
77390
77391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77392         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
77393         this_obj_conv.inner = untag_ptr(this_obj);
77394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77396         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
77397 }
77398
77399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
77400         void* scorer_ptr = untag_ptr(scorer);
77401         CHECK_ACCESS(scorer_ptr);
77402         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
77403         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
77404                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77405                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
77406         }
77407         LDKInFlightHtlcs inflight_htlcs_conv;
77408         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
77409         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
77410         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
77411         inflight_htlcs_conv.is_owned = false;
77412         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
77413         int64_t ret_ref = 0;
77414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77416         return ret_ref;
77417 }
77418
77419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
77420         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
77421         this_arg_conv.inner = untag_ptr(this_arg);
77422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77424         this_arg_conv.is_owned = false;
77425         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
77426         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
77427         return tag_ptr(ret_ret, true);
77428 }
77429
77430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77431         LDKInFlightHtlcs this_obj_conv;
77432         this_obj_conv.inner = untag_ptr(this_obj);
77433         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77435         InFlightHtlcs_free(this_obj_conv);
77436 }
77437
77438 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
77439         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
77440         int64_t ret_ref = 0;
77441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77443         return ret_ref;
77444 }
77445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77446         LDKInFlightHtlcs arg_conv;
77447         arg_conv.inner = untag_ptr(arg);
77448         arg_conv.is_owned = ptr_is_owned(arg);
77449         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77450         arg_conv.is_owned = false;
77451         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
77452         return ret_conv;
77453 }
77454
77455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77456         LDKInFlightHtlcs orig_conv;
77457         orig_conv.inner = untag_ptr(orig);
77458         orig_conv.is_owned = ptr_is_owned(orig);
77459         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77460         orig_conv.is_owned = false;
77461         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
77462         int64_t ret_ref = 0;
77463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77465         return ret_ref;
77466 }
77467
77468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
77469         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
77470         int64_t ret_ref = 0;
77471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77473         return ret_ref;
77474 }
77475
77476 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) {
77477         LDKInFlightHtlcs this_arg_conv;
77478         this_arg_conv.inner = untag_ptr(this_arg);
77479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77481         this_arg_conv.is_owned = false;
77482         LDKPath path_conv;
77483         path_conv.inner = untag_ptr(path);
77484         path_conv.is_owned = ptr_is_owned(path);
77485         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
77486         path_conv.is_owned = false;
77487         LDKPublicKey payer_node_id_ref;
77488         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
77489         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
77490         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
77491 }
77492
77493 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) {
77494         LDKInFlightHtlcs this_arg_conv;
77495         this_arg_conv.inner = untag_ptr(this_arg);
77496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77498         this_arg_conv.is_owned = false;
77499         LDKNodeId source_conv;
77500         source_conv.inner = untag_ptr(source);
77501         source_conv.is_owned = ptr_is_owned(source);
77502         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
77503         source_conv.is_owned = false;
77504         LDKNodeId target_conv;
77505         target_conv.inner = untag_ptr(target);
77506         target_conv.is_owned = ptr_is_owned(target);
77507         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
77508         target_conv.is_owned = false;
77509         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
77510 }
77511
77512 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) {
77513         LDKInFlightHtlcs this_arg_conv;
77514         this_arg_conv.inner = untag_ptr(this_arg);
77515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77517         this_arg_conv.is_owned = false;
77518         LDKNodeId source_conv;
77519         source_conv.inner = untag_ptr(source);
77520         source_conv.is_owned = ptr_is_owned(source);
77521         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
77522         source_conv.is_owned = false;
77523         LDKNodeId target_conv;
77524         target_conv.inner = untag_ptr(target);
77525         target_conv.is_owned = ptr_is_owned(target);
77526         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
77527         target_conv.is_owned = false;
77528         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77529         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
77530         int64_t ret_ref = tag_ptr(ret_copy, true);
77531         return ret_ref;
77532 }
77533
77534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
77535         LDKInFlightHtlcs obj_conv;
77536         obj_conv.inner = untag_ptr(obj);
77537         obj_conv.is_owned = ptr_is_owned(obj);
77538         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77539         obj_conv.is_owned = false;
77540         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
77541         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77542         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77543         CVec_u8Z_free(ret_var);
77544         return ret_arr;
77545 }
77546
77547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77548         LDKu8slice ser_ref;
77549         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77550         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77551         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
77552         *ret_conv = InFlightHtlcs_read(ser_ref);
77553         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77554         return tag_ptr(ret_conv, true);
77555 }
77556
77557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77558         LDKRouteHop this_obj_conv;
77559         this_obj_conv.inner = untag_ptr(this_obj);
77560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77562         RouteHop_free(this_obj_conv);
77563 }
77564
77565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
77566         LDKRouteHop this_ptr_conv;
77567         this_ptr_conv.inner = untag_ptr(this_ptr);
77568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77570         this_ptr_conv.is_owned = false;
77571         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
77572         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
77573         return ret_arr;
77574 }
77575
77576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77577         LDKRouteHop this_ptr_conv;
77578         this_ptr_conv.inner = untag_ptr(this_ptr);
77579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77581         this_ptr_conv.is_owned = false;
77582         LDKPublicKey val_ref;
77583         CHECK((*env)->GetArrayLength(env, val) == 33);
77584         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
77585         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
77586 }
77587
77588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
77589         LDKRouteHop this_ptr_conv;
77590         this_ptr_conv.inner = untag_ptr(this_ptr);
77591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77593         this_ptr_conv.is_owned = false;
77594         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
77595         int64_t ret_ref = 0;
77596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77598         return ret_ref;
77599 }
77600
77601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77602         LDKRouteHop this_ptr_conv;
77603         this_ptr_conv.inner = untag_ptr(this_ptr);
77604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77606         this_ptr_conv.is_owned = false;
77607         LDKNodeFeatures val_conv;
77608         val_conv.inner = untag_ptr(val);
77609         val_conv.is_owned = ptr_is_owned(val);
77610         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77611         val_conv = NodeFeatures_clone(&val_conv);
77612         RouteHop_set_node_features(&this_ptr_conv, val_conv);
77613 }
77614
77615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77616         LDKRouteHop this_ptr_conv;
77617         this_ptr_conv.inner = untag_ptr(this_ptr);
77618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77620         this_ptr_conv.is_owned = false;
77621         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
77622         return ret_conv;
77623 }
77624
77625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77626         LDKRouteHop this_ptr_conv;
77627         this_ptr_conv.inner = untag_ptr(this_ptr);
77628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77630         this_ptr_conv.is_owned = false;
77631         RouteHop_set_short_channel_id(&this_ptr_conv, val);
77632 }
77633
77634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
77635         LDKRouteHop this_ptr_conv;
77636         this_ptr_conv.inner = untag_ptr(this_ptr);
77637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77639         this_ptr_conv.is_owned = false;
77640         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
77641         int64_t ret_ref = 0;
77642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77644         return ret_ref;
77645 }
77646
77647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77648         LDKRouteHop this_ptr_conv;
77649         this_ptr_conv.inner = untag_ptr(this_ptr);
77650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77652         this_ptr_conv.is_owned = false;
77653         LDKChannelFeatures val_conv;
77654         val_conv.inner = untag_ptr(val);
77655         val_conv.is_owned = ptr_is_owned(val);
77656         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77657         val_conv = ChannelFeatures_clone(&val_conv);
77658         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
77659 }
77660
77661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77662         LDKRouteHop this_ptr_conv;
77663         this_ptr_conv.inner = untag_ptr(this_ptr);
77664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77666         this_ptr_conv.is_owned = false;
77667         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
77668         return ret_conv;
77669 }
77670
77671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77672         LDKRouteHop this_ptr_conv;
77673         this_ptr_conv.inner = untag_ptr(this_ptr);
77674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77676         this_ptr_conv.is_owned = false;
77677         RouteHop_set_fee_msat(&this_ptr_conv, val);
77678 }
77679
77680 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
77681         LDKRouteHop this_ptr_conv;
77682         this_ptr_conv.inner = untag_ptr(this_ptr);
77683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77685         this_ptr_conv.is_owned = false;
77686         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
77687         return ret_conv;
77688 }
77689
77690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
77691         LDKRouteHop this_ptr_conv;
77692         this_ptr_conv.inner = untag_ptr(this_ptr);
77693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77695         this_ptr_conv.is_owned = false;
77696         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
77697 }
77698
77699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
77700         LDKRouteHop this_ptr_conv;
77701         this_ptr_conv.inner = untag_ptr(this_ptr);
77702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77704         this_ptr_conv.is_owned = false;
77705         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
77706         return ret_conv;
77707 }
77708
77709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
77710         LDKRouteHop this_ptr_conv;
77711         this_ptr_conv.inner = untag_ptr(this_ptr);
77712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77714         this_ptr_conv.is_owned = false;
77715         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
77716 }
77717
77718 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) {
77719         LDKPublicKey pubkey_arg_ref;
77720         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
77721         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
77722         LDKNodeFeatures node_features_arg_conv;
77723         node_features_arg_conv.inner = untag_ptr(node_features_arg);
77724         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
77725         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
77726         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
77727         LDKChannelFeatures channel_features_arg_conv;
77728         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
77729         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
77730         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
77731         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
77732         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);
77733         int64_t ret_ref = 0;
77734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77736         return ret_ref;
77737 }
77738
77739 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
77740         LDKRouteHop ret_var = RouteHop_clone(arg);
77741         int64_t ret_ref = 0;
77742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77744         return ret_ref;
77745 }
77746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77747         LDKRouteHop arg_conv;
77748         arg_conv.inner = untag_ptr(arg);
77749         arg_conv.is_owned = ptr_is_owned(arg);
77750         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77751         arg_conv.is_owned = false;
77752         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
77753         return ret_conv;
77754 }
77755
77756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77757         LDKRouteHop orig_conv;
77758         orig_conv.inner = untag_ptr(orig);
77759         orig_conv.is_owned = ptr_is_owned(orig);
77760         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77761         orig_conv.is_owned = false;
77762         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
77763         int64_t ret_ref = 0;
77764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77766         return ret_ref;
77767 }
77768
77769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
77770         LDKRouteHop o_conv;
77771         o_conv.inner = untag_ptr(o);
77772         o_conv.is_owned = ptr_is_owned(o);
77773         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77774         o_conv.is_owned = false;
77775         int64_t ret_conv = RouteHop_hash(&o_conv);
77776         return ret_conv;
77777 }
77778
77779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77780         LDKRouteHop a_conv;
77781         a_conv.inner = untag_ptr(a);
77782         a_conv.is_owned = ptr_is_owned(a);
77783         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77784         a_conv.is_owned = false;
77785         LDKRouteHop b_conv;
77786         b_conv.inner = untag_ptr(b);
77787         b_conv.is_owned = ptr_is_owned(b);
77788         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77789         b_conv.is_owned = false;
77790         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
77791         return ret_conv;
77792 }
77793
77794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
77795         LDKRouteHop obj_conv;
77796         obj_conv.inner = untag_ptr(obj);
77797         obj_conv.is_owned = ptr_is_owned(obj);
77798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77799         obj_conv.is_owned = false;
77800         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
77801         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77802         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77803         CVec_u8Z_free(ret_var);
77804         return ret_arr;
77805 }
77806
77807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77808         LDKu8slice ser_ref;
77809         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77810         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77811         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
77812         *ret_conv = RouteHop_read(ser_ref);
77813         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77814         return tag_ptr(ret_conv, true);
77815 }
77816
77817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77818         LDKBlindedTail this_obj_conv;
77819         this_obj_conv.inner = untag_ptr(this_obj);
77820         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77822         BlindedTail_free(this_obj_conv);
77823 }
77824
77825 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
77826         LDKBlindedTail this_ptr_conv;
77827         this_ptr_conv.inner = untag_ptr(this_ptr);
77828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77830         this_ptr_conv.is_owned = false;
77831         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
77832         int64_tArray ret_arr = NULL;
77833         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77834         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77835         for (size_t m = 0; m < ret_var.datalen; m++) {
77836                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
77837                 int64_t ret_conv_12_ref = 0;
77838                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
77839                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
77840                 ret_arr_ptr[m] = ret_conv_12_ref;
77841         }
77842         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77843         FREE(ret_var.data);
77844         return ret_arr;
77845 }
77846
77847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
77848         LDKBlindedTail this_ptr_conv;
77849         this_ptr_conv.inner = untag_ptr(this_ptr);
77850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77852         this_ptr_conv.is_owned = false;
77853         LDKCVec_BlindedHopZ val_constr;
77854         val_constr.datalen = (*env)->GetArrayLength(env, val);
77855         if (val_constr.datalen > 0)
77856                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
77857         else
77858                 val_constr.data = NULL;
77859         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77860         for (size_t m = 0; m < val_constr.datalen; m++) {
77861                 int64_t val_conv_12 = val_vals[m];
77862                 LDKBlindedHop val_conv_12_conv;
77863                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
77864                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
77865                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
77866                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
77867                 val_constr.data[m] = val_conv_12_conv;
77868         }
77869         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77870         BlindedTail_set_hops(&this_ptr_conv, val_constr);
77871 }
77872
77873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
77874         LDKBlindedTail this_ptr_conv;
77875         this_ptr_conv.inner = untag_ptr(this_ptr);
77876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77878         this_ptr_conv.is_owned = false;
77879         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
77880         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
77881         return ret_arr;
77882 }
77883
77884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77885         LDKBlindedTail this_ptr_conv;
77886         this_ptr_conv.inner = untag_ptr(this_ptr);
77887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77889         this_ptr_conv.is_owned = false;
77890         LDKPublicKey val_ref;
77891         CHECK((*env)->GetArrayLength(env, val) == 33);
77892         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
77893         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
77894 }
77895
77896 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
77897         LDKBlindedTail this_ptr_conv;
77898         this_ptr_conv.inner = untag_ptr(this_ptr);
77899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77901         this_ptr_conv.is_owned = false;
77902         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
77903         return ret_conv;
77904 }
77905
77906 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) {
77907         LDKBlindedTail this_ptr_conv;
77908         this_ptr_conv.inner = untag_ptr(this_ptr);
77909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77911         this_ptr_conv.is_owned = false;
77912         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
77913 }
77914
77915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77916         LDKBlindedTail this_ptr_conv;
77917         this_ptr_conv.inner = untag_ptr(this_ptr);
77918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77920         this_ptr_conv.is_owned = false;
77921         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
77922         return ret_conv;
77923 }
77924
77925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77926         LDKBlindedTail this_ptr_conv;
77927         this_ptr_conv.inner = untag_ptr(this_ptr);
77928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77930         this_ptr_conv.is_owned = false;
77931         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
77932 }
77933
77934 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) {
77935         LDKCVec_BlindedHopZ hops_arg_constr;
77936         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
77937         if (hops_arg_constr.datalen > 0)
77938                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
77939         else
77940                 hops_arg_constr.data = NULL;
77941         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
77942         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
77943                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
77944                 LDKBlindedHop hops_arg_conv_12_conv;
77945                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
77946                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
77947                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
77948                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
77949                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
77950         }
77951         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
77952         LDKPublicKey blinding_point_arg_ref;
77953         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
77954         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
77955         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
77956         int64_t ret_ref = 0;
77957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77959         return ret_ref;
77960 }
77961
77962 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
77963         LDKBlindedTail ret_var = BlindedTail_clone(arg);
77964         int64_t ret_ref = 0;
77965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77967         return ret_ref;
77968 }
77969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77970         LDKBlindedTail arg_conv;
77971         arg_conv.inner = untag_ptr(arg);
77972         arg_conv.is_owned = ptr_is_owned(arg);
77973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77974         arg_conv.is_owned = false;
77975         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
77976         return ret_conv;
77977 }
77978
77979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77980         LDKBlindedTail orig_conv;
77981         orig_conv.inner = untag_ptr(orig);
77982         orig_conv.is_owned = ptr_is_owned(orig);
77983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77984         orig_conv.is_owned = false;
77985         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
77986         int64_t ret_ref = 0;
77987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77989         return ret_ref;
77990 }
77991
77992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
77993         LDKBlindedTail o_conv;
77994         o_conv.inner = untag_ptr(o);
77995         o_conv.is_owned = ptr_is_owned(o);
77996         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77997         o_conv.is_owned = false;
77998         int64_t ret_conv = BlindedTail_hash(&o_conv);
77999         return ret_conv;
78000 }
78001
78002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78003         LDKBlindedTail a_conv;
78004         a_conv.inner = untag_ptr(a);
78005         a_conv.is_owned = ptr_is_owned(a);
78006         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78007         a_conv.is_owned = false;
78008         LDKBlindedTail b_conv;
78009         b_conv.inner = untag_ptr(b);
78010         b_conv.is_owned = ptr_is_owned(b);
78011         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78012         b_conv.is_owned = false;
78013         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
78014         return ret_conv;
78015 }
78016
78017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
78018         LDKBlindedTail obj_conv;
78019         obj_conv.inner = untag_ptr(obj);
78020         obj_conv.is_owned = ptr_is_owned(obj);
78021         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78022         obj_conv.is_owned = false;
78023         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
78024         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78025         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78026         CVec_u8Z_free(ret_var);
78027         return ret_arr;
78028 }
78029
78030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
78031         LDKu8slice ser_ref;
78032         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78033         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78034         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
78035         *ret_conv = BlindedTail_read(ser_ref);
78036         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78037         return tag_ptr(ret_conv, true);
78038 }
78039
78040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78041         LDKPath this_obj_conv;
78042         this_obj_conv.inner = untag_ptr(this_obj);
78043         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78045         Path_free(this_obj_conv);
78046 }
78047
78048 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
78049         LDKPath this_ptr_conv;
78050         this_ptr_conv.inner = untag_ptr(this_ptr);
78051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78053         this_ptr_conv.is_owned = false;
78054         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
78055         int64_tArray ret_arr = NULL;
78056         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
78057         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
78058         for (size_t k = 0; k < ret_var.datalen; k++) {
78059                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
78060                 int64_t ret_conv_10_ref = 0;
78061                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
78062                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
78063                 ret_arr_ptr[k] = ret_conv_10_ref;
78064         }
78065         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
78066         FREE(ret_var.data);
78067         return ret_arr;
78068 }
78069
78070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
78071         LDKPath this_ptr_conv;
78072         this_ptr_conv.inner = untag_ptr(this_ptr);
78073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78075         this_ptr_conv.is_owned = false;
78076         LDKCVec_RouteHopZ val_constr;
78077         val_constr.datalen = (*env)->GetArrayLength(env, val);
78078         if (val_constr.datalen > 0)
78079                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
78080         else
78081                 val_constr.data = NULL;
78082         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
78083         for (size_t k = 0; k < val_constr.datalen; k++) {
78084                 int64_t val_conv_10 = val_vals[k];
78085                 LDKRouteHop val_conv_10_conv;
78086                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
78087                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
78088                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
78089                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
78090                 val_constr.data[k] = val_conv_10_conv;
78091         }
78092         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
78093         Path_set_hops(&this_ptr_conv, val_constr);
78094 }
78095
78096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
78097         LDKPath this_ptr_conv;
78098         this_ptr_conv.inner = untag_ptr(this_ptr);
78099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78101         this_ptr_conv.is_owned = false;
78102         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
78103         int64_t ret_ref = 0;
78104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78106         return ret_ref;
78107 }
78108
78109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78110         LDKPath this_ptr_conv;
78111         this_ptr_conv.inner = untag_ptr(this_ptr);
78112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78114         this_ptr_conv.is_owned = false;
78115         LDKBlindedTail val_conv;
78116         val_conv.inner = untag_ptr(val);
78117         val_conv.is_owned = ptr_is_owned(val);
78118         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78119         val_conv = BlindedTail_clone(&val_conv);
78120         Path_set_blinded_tail(&this_ptr_conv, val_conv);
78121 }
78122
78123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
78124         LDKCVec_RouteHopZ hops_arg_constr;
78125         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
78126         if (hops_arg_constr.datalen > 0)
78127                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
78128         else
78129                 hops_arg_constr.data = NULL;
78130         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
78131         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
78132                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
78133                 LDKRouteHop hops_arg_conv_10_conv;
78134                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
78135                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
78136                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
78137                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
78138                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
78139         }
78140         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
78141         LDKBlindedTail blinded_tail_arg_conv;
78142         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
78143         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
78144         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
78145         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
78146         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
78147         int64_t ret_ref = 0;
78148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78150         return ret_ref;
78151 }
78152
78153 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
78154         LDKPath ret_var = Path_clone(arg);
78155         int64_t ret_ref = 0;
78156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78158         return ret_ref;
78159 }
78160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78161         LDKPath arg_conv;
78162         arg_conv.inner = untag_ptr(arg);
78163         arg_conv.is_owned = ptr_is_owned(arg);
78164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78165         arg_conv.is_owned = false;
78166         int64_t ret_conv = Path_clone_ptr(&arg_conv);
78167         return ret_conv;
78168 }
78169
78170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78171         LDKPath orig_conv;
78172         orig_conv.inner = untag_ptr(orig);
78173         orig_conv.is_owned = ptr_is_owned(orig);
78174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78175         orig_conv.is_owned = false;
78176         LDKPath ret_var = Path_clone(&orig_conv);
78177         int64_t ret_ref = 0;
78178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78180         return ret_ref;
78181 }
78182
78183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
78184         LDKPath o_conv;
78185         o_conv.inner = untag_ptr(o);
78186         o_conv.is_owned = ptr_is_owned(o);
78187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78188         o_conv.is_owned = false;
78189         int64_t ret_conv = Path_hash(&o_conv);
78190         return ret_conv;
78191 }
78192
78193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78194         LDKPath a_conv;
78195         a_conv.inner = untag_ptr(a);
78196         a_conv.is_owned = ptr_is_owned(a);
78197         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78198         a_conv.is_owned = false;
78199         LDKPath b_conv;
78200         b_conv.inner = untag_ptr(b);
78201         b_conv.is_owned = ptr_is_owned(b);
78202         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78203         b_conv.is_owned = false;
78204         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
78205         return ret_conv;
78206 }
78207
78208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
78209         LDKPath this_arg_conv;
78210         this_arg_conv.inner = untag_ptr(this_arg);
78211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78213         this_arg_conv.is_owned = false;
78214         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
78215         return ret_conv;
78216 }
78217
78218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
78219         LDKPath this_arg_conv;
78220         this_arg_conv.inner = untag_ptr(this_arg);
78221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78223         this_arg_conv.is_owned = false;
78224         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
78225         return ret_conv;
78226 }
78227
78228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
78229         LDKPath this_arg_conv;
78230         this_arg_conv.inner = untag_ptr(this_arg);
78231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78233         this_arg_conv.is_owned = false;
78234         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
78235         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
78236         int64_t ret_ref = tag_ptr(ret_copy, true);
78237         return ret_ref;
78238 }
78239
78240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78241         LDKRoute this_obj_conv;
78242         this_obj_conv.inner = untag_ptr(this_obj);
78243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78245         Route_free(this_obj_conv);
78246 }
78247
78248 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
78249         LDKRoute this_ptr_conv;
78250         this_ptr_conv.inner = untag_ptr(this_ptr);
78251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78253         this_ptr_conv.is_owned = false;
78254         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
78255         int64_tArray ret_arr = NULL;
78256         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
78257         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
78258         for (size_t g = 0; g < ret_var.datalen; g++) {
78259                 LDKPath ret_conv_6_var = ret_var.data[g];
78260                 int64_t ret_conv_6_ref = 0;
78261                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
78262                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
78263                 ret_arr_ptr[g] = ret_conv_6_ref;
78264         }
78265         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
78266         FREE(ret_var.data);
78267         return ret_arr;
78268 }
78269
78270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
78271         LDKRoute this_ptr_conv;
78272         this_ptr_conv.inner = untag_ptr(this_ptr);
78273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78275         this_ptr_conv.is_owned = false;
78276         LDKCVec_PathZ val_constr;
78277         val_constr.datalen = (*env)->GetArrayLength(env, val);
78278         if (val_constr.datalen > 0)
78279                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
78280         else
78281                 val_constr.data = NULL;
78282         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
78283         for (size_t g = 0; g < val_constr.datalen; g++) {
78284                 int64_t val_conv_6 = val_vals[g];
78285                 LDKPath val_conv_6_conv;
78286                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
78287                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
78288                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
78289                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
78290                 val_constr.data[g] = val_conv_6_conv;
78291         }
78292         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
78293         Route_set_paths(&this_ptr_conv, val_constr);
78294 }
78295
78296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
78297         LDKRoute this_ptr_conv;
78298         this_ptr_conv.inner = untag_ptr(this_ptr);
78299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78301         this_ptr_conv.is_owned = false;
78302         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
78303         int64_t ret_ref = 0;
78304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78306         return ret_ref;
78307 }
78308
78309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78310         LDKRoute this_ptr_conv;
78311         this_ptr_conv.inner = untag_ptr(this_ptr);
78312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78314         this_ptr_conv.is_owned = false;
78315         LDKRouteParameters val_conv;
78316         val_conv.inner = untag_ptr(val);
78317         val_conv.is_owned = ptr_is_owned(val);
78318         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78319         val_conv = RouteParameters_clone(&val_conv);
78320         Route_set_route_params(&this_ptr_conv, val_conv);
78321 }
78322
78323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
78324         LDKCVec_PathZ paths_arg_constr;
78325         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
78326         if (paths_arg_constr.datalen > 0)
78327                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
78328         else
78329                 paths_arg_constr.data = NULL;
78330         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
78331         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
78332                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
78333                 LDKPath paths_arg_conv_6_conv;
78334                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
78335                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
78336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
78337                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
78338                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
78339         }
78340         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
78341         LDKRouteParameters route_params_arg_conv;
78342         route_params_arg_conv.inner = untag_ptr(route_params_arg);
78343         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
78344         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
78345         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
78346         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
78347         int64_t ret_ref = 0;
78348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78350         return ret_ref;
78351 }
78352
78353 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
78354         LDKRoute ret_var = Route_clone(arg);
78355         int64_t ret_ref = 0;
78356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78358         return ret_ref;
78359 }
78360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78361         LDKRoute arg_conv;
78362         arg_conv.inner = untag_ptr(arg);
78363         arg_conv.is_owned = ptr_is_owned(arg);
78364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78365         arg_conv.is_owned = false;
78366         int64_t ret_conv = Route_clone_ptr(&arg_conv);
78367         return ret_conv;
78368 }
78369
78370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78371         LDKRoute orig_conv;
78372         orig_conv.inner = untag_ptr(orig);
78373         orig_conv.is_owned = ptr_is_owned(orig);
78374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78375         orig_conv.is_owned = false;
78376         LDKRoute ret_var = Route_clone(&orig_conv);
78377         int64_t ret_ref = 0;
78378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78380         return ret_ref;
78381 }
78382
78383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
78384         LDKRoute o_conv;
78385         o_conv.inner = untag_ptr(o);
78386         o_conv.is_owned = ptr_is_owned(o);
78387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78388         o_conv.is_owned = false;
78389         int64_t ret_conv = Route_hash(&o_conv);
78390         return ret_conv;
78391 }
78392
78393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78394         LDKRoute a_conv;
78395         a_conv.inner = untag_ptr(a);
78396         a_conv.is_owned = ptr_is_owned(a);
78397         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78398         a_conv.is_owned = false;
78399         LDKRoute b_conv;
78400         b_conv.inner = untag_ptr(b);
78401         b_conv.is_owned = ptr_is_owned(b);
78402         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78403         b_conv.is_owned = false;
78404         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
78405         return ret_conv;
78406 }
78407
78408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
78409         LDKRoute this_arg_conv;
78410         this_arg_conv.inner = untag_ptr(this_arg);
78411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78413         this_arg_conv.is_owned = false;
78414         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
78415         return ret_conv;
78416 }
78417
78418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
78419         LDKRoute this_arg_conv;
78420         this_arg_conv.inner = untag_ptr(this_arg);
78421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78423         this_arg_conv.is_owned = false;
78424         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
78425         return ret_conv;
78426 }
78427
78428 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Route_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
78429         LDKRoute o_conv;
78430         o_conv.inner = untag_ptr(o);
78431         o_conv.is_owned = ptr_is_owned(o);
78432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78433         o_conv.is_owned = false;
78434         LDKStr ret_str = Route_to_str(&o_conv);
78435         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
78436         Str_free(ret_str);
78437         return ret_conv;
78438 }
78439
78440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
78441         LDKRoute obj_conv;
78442         obj_conv.inner = untag_ptr(obj);
78443         obj_conv.is_owned = ptr_is_owned(obj);
78444         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78445         obj_conv.is_owned = false;
78446         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
78447         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78448         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78449         CVec_u8Z_free(ret_var);
78450         return ret_arr;
78451 }
78452
78453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
78454         LDKu8slice ser_ref;
78455         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78456         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78457         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
78458         *ret_conv = Route_read(ser_ref);
78459         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78460         return tag_ptr(ret_conv, true);
78461 }
78462
78463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78464         LDKRouteParameters this_obj_conv;
78465         this_obj_conv.inner = untag_ptr(this_obj);
78466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78468         RouteParameters_free(this_obj_conv);
78469 }
78470
78471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
78472         LDKRouteParameters this_ptr_conv;
78473         this_ptr_conv.inner = untag_ptr(this_ptr);
78474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78476         this_ptr_conv.is_owned = false;
78477         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
78478         int64_t ret_ref = 0;
78479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78481         return ret_ref;
78482 }
78483
78484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78485         LDKRouteParameters this_ptr_conv;
78486         this_ptr_conv.inner = untag_ptr(this_ptr);
78487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78489         this_ptr_conv.is_owned = false;
78490         LDKPaymentParameters val_conv;
78491         val_conv.inner = untag_ptr(val);
78492         val_conv.is_owned = ptr_is_owned(val);
78493         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78494         val_conv = PaymentParameters_clone(&val_conv);
78495         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
78496 }
78497
78498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78499         LDKRouteParameters this_ptr_conv;
78500         this_ptr_conv.inner = untag_ptr(this_ptr);
78501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78503         this_ptr_conv.is_owned = false;
78504         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
78505         return ret_conv;
78506 }
78507
78508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78509         LDKRouteParameters this_ptr_conv;
78510         this_ptr_conv.inner = untag_ptr(this_ptr);
78511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78513         this_ptr_conv.is_owned = false;
78514         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
78515 }
78516
78517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78518         LDKRouteParameters this_ptr_conv;
78519         this_ptr_conv.inner = untag_ptr(this_ptr);
78520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78522         this_ptr_conv.is_owned = false;
78523         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
78524         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
78525         int64_t ret_ref = tag_ptr(ret_copy, true);
78526         return ret_ref;
78527 }
78528
78529 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) {
78530         LDKRouteParameters this_ptr_conv;
78531         this_ptr_conv.inner = untag_ptr(this_ptr);
78532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78534         this_ptr_conv.is_owned = false;
78535         void* val_ptr = untag_ptr(val);
78536         CHECK_ACCESS(val_ptr);
78537         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
78538         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
78539         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
78540 }
78541
78542 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) {
78543         LDKPaymentParameters payment_params_arg_conv;
78544         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
78545         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
78546         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
78547         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
78548         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
78549         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
78550         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
78551         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
78552         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
78553         int64_t ret_ref = 0;
78554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78556         return ret_ref;
78557 }
78558
78559 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
78560         LDKRouteParameters ret_var = RouteParameters_clone(arg);
78561         int64_t ret_ref = 0;
78562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78564         return ret_ref;
78565 }
78566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78567         LDKRouteParameters arg_conv;
78568         arg_conv.inner = untag_ptr(arg);
78569         arg_conv.is_owned = ptr_is_owned(arg);
78570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78571         arg_conv.is_owned = false;
78572         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
78573         return ret_conv;
78574 }
78575
78576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78577         LDKRouteParameters orig_conv;
78578         orig_conv.inner = untag_ptr(orig);
78579         orig_conv.is_owned = ptr_is_owned(orig);
78580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78581         orig_conv.is_owned = false;
78582         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
78583         int64_t ret_ref = 0;
78584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78586         return ret_ref;
78587 }
78588
78589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
78590         LDKRouteParameters o_conv;
78591         o_conv.inner = untag_ptr(o);
78592         o_conv.is_owned = ptr_is_owned(o);
78593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78594         o_conv.is_owned = false;
78595         int64_t ret_conv = RouteParameters_hash(&o_conv);
78596         return ret_conv;
78597 }
78598
78599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78600         LDKRouteParameters a_conv;
78601         a_conv.inner = untag_ptr(a);
78602         a_conv.is_owned = ptr_is_owned(a);
78603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78604         a_conv.is_owned = false;
78605         LDKRouteParameters b_conv;
78606         b_conv.inner = untag_ptr(b);
78607         b_conv.is_owned = ptr_is_owned(b);
78608         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78609         b_conv.is_owned = false;
78610         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
78611         return ret_conv;
78612 }
78613
78614 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) {
78615         LDKPaymentParameters payment_params_conv;
78616         payment_params_conv.inner = untag_ptr(payment_params);
78617         payment_params_conv.is_owned = ptr_is_owned(payment_params);
78618         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
78619         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
78620         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
78621         int64_t ret_ref = 0;
78622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78624         return ret_ref;
78625 }
78626
78627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
78628         LDKRouteParameters obj_conv;
78629         obj_conv.inner = untag_ptr(obj);
78630         obj_conv.is_owned = ptr_is_owned(obj);
78631         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78632         obj_conv.is_owned = false;
78633         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
78634         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78635         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78636         CVec_u8Z_free(ret_var);
78637         return ret_arr;
78638 }
78639
78640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
78641         LDKu8slice ser_ref;
78642         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78643         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78644         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
78645         *ret_conv = RouteParameters_read(ser_ref);
78646         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78647         return tag_ptr(ret_conv, true);
78648 }
78649
78650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78651         LDKPaymentParameters this_obj_conv;
78652         this_obj_conv.inner = untag_ptr(this_obj);
78653         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78655         PaymentParameters_free(this_obj_conv);
78656 }
78657
78658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
78659         LDKPaymentParameters this_ptr_conv;
78660         this_ptr_conv.inner = untag_ptr(this_ptr);
78661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78663         this_ptr_conv.is_owned = false;
78664         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
78665         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
78666         int64_t ret_ref = tag_ptr(ret_copy, true);
78667         return ret_ref;
78668 }
78669
78670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78671         LDKPaymentParameters this_ptr_conv;
78672         this_ptr_conv.inner = untag_ptr(this_ptr);
78673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78675         this_ptr_conv.is_owned = false;
78676         void* val_ptr = untag_ptr(val);
78677         CHECK_ACCESS(val_ptr);
78678         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
78679         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
78680         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
78681 }
78682
78683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
78684         LDKPaymentParameters this_ptr_conv;
78685         this_ptr_conv.inner = untag_ptr(this_ptr);
78686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78688         this_ptr_conv.is_owned = false;
78689         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
78690         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
78691         int64_t ret_ref = tag_ptr(ret_copy, true);
78692         return ret_ref;
78693 }
78694
78695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78696         LDKPaymentParameters this_ptr_conv;
78697         this_ptr_conv.inner = untag_ptr(this_ptr);
78698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78700         this_ptr_conv.is_owned = false;
78701         void* val_ptr = untag_ptr(val);
78702         CHECK_ACCESS(val_ptr);
78703         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
78704         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
78705         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
78706 }
78707
78708 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
78709         LDKPaymentParameters this_ptr_conv;
78710         this_ptr_conv.inner = untag_ptr(this_ptr);
78711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78713         this_ptr_conv.is_owned = false;
78714         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
78715         return ret_conv;
78716 }
78717
78718 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) {
78719         LDKPaymentParameters this_ptr_conv;
78720         this_ptr_conv.inner = untag_ptr(this_ptr);
78721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78723         this_ptr_conv.is_owned = false;
78724         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
78725 }
78726
78727 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
78728         LDKPaymentParameters this_ptr_conv;
78729         this_ptr_conv.inner = untag_ptr(this_ptr);
78730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78732         this_ptr_conv.is_owned = false;
78733         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
78734         return ret_conv;
78735 }
78736
78737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
78738         LDKPaymentParameters this_ptr_conv;
78739         this_ptr_conv.inner = untag_ptr(this_ptr);
78740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78742         this_ptr_conv.is_owned = false;
78743         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
78744 }
78745
78746 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) {
78747         LDKPaymentParameters this_ptr_conv;
78748         this_ptr_conv.inner = untag_ptr(this_ptr);
78749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78751         this_ptr_conv.is_owned = false;
78752         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
78753         return ret_conv;
78754 }
78755
78756 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) {
78757         LDKPaymentParameters this_ptr_conv;
78758         this_ptr_conv.inner = untag_ptr(this_ptr);
78759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78761         this_ptr_conv.is_owned = false;
78762         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
78763 }
78764
78765 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
78766         LDKPaymentParameters this_ptr_conv;
78767         this_ptr_conv.inner = untag_ptr(this_ptr);
78768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78770         this_ptr_conv.is_owned = false;
78771         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
78772         int64_tArray ret_arr = NULL;
78773         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
78774         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
78775         for (size_t g = 0; g < ret_var.datalen; g++) {
78776                 int64_t ret_conv_6_conv = ret_var.data[g];
78777                 ret_arr_ptr[g] = ret_conv_6_conv;
78778         }
78779         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
78780         FREE(ret_var.data);
78781         return ret_arr;
78782 }
78783
78784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
78785         LDKPaymentParameters this_ptr_conv;
78786         this_ptr_conv.inner = untag_ptr(this_ptr);
78787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78789         this_ptr_conv.is_owned = false;
78790         LDKCVec_u64Z val_constr;
78791         val_constr.datalen = (*env)->GetArrayLength(env, val);
78792         if (val_constr.datalen > 0)
78793                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
78794         else
78795                 val_constr.data = NULL;
78796         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
78797         for (size_t g = 0; g < val_constr.datalen; g++) {
78798                 int64_t val_conv_6 = val_vals[g];
78799                 val_constr.data[g] = val_conv_6;
78800         }
78801         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
78802         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
78803 }
78804
78805 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr) {
78806         LDKPaymentParameters this_ptr_conv;
78807         this_ptr_conv.inner = untag_ptr(this_ptr);
78808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78810         this_ptr_conv.is_owned = false;
78811         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
78812         int64_tArray ret_arr = NULL;
78813         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
78814         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
78815         for (size_t g = 0; g < ret_var.datalen; g++) {
78816                 int64_t ret_conv_6_conv = ret_var.data[g];
78817                 ret_arr_ptr[g] = ret_conv_6_conv;
78818         }
78819         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
78820         FREE(ret_var.data);
78821         return ret_arr;
78822 }
78823
78824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
78825         LDKPaymentParameters this_ptr_conv;
78826         this_ptr_conv.inner = untag_ptr(this_ptr);
78827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78829         this_ptr_conv.is_owned = false;
78830         LDKCVec_u64Z val_constr;
78831         val_constr.datalen = (*env)->GetArrayLength(env, val);
78832         if (val_constr.datalen > 0)
78833                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
78834         else
78835                 val_constr.data = NULL;
78836         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
78837         for (size_t g = 0; g < val_constr.datalen; g++) {
78838                 int64_t val_conv_6 = val_vals[g];
78839                 val_constr.data[g] = val_conv_6;
78840         }
78841         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
78842         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
78843 }
78844
78845 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, int64_tArray previously_failed_blinded_path_idxs_arg) {
78846         void* payee_arg_ptr = untag_ptr(payee_arg);
78847         CHECK_ACCESS(payee_arg_ptr);
78848         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
78849         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
78850         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
78851         CHECK_ACCESS(expiry_time_arg_ptr);
78852         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
78853         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
78854         LDKCVec_u64Z previously_failed_channels_arg_constr;
78855         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
78856         if (previously_failed_channels_arg_constr.datalen > 0)
78857                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
78858         else
78859                 previously_failed_channels_arg_constr.data = NULL;
78860         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
78861         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
78862                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
78863                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
78864         }
78865         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
78866         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
78867         previously_failed_blinded_path_idxs_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_blinded_path_idxs_arg);
78868         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
78869                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
78870         else
78871                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
78872         int64_t* previously_failed_blinded_path_idxs_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_blinded_path_idxs_arg, NULL);
78873         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
78874                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
78875                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
78876         }
78877         (*env)->ReleaseLongArrayElements(env, previously_failed_blinded_path_idxs_arg, previously_failed_blinded_path_idxs_arg_vals, 0);
78878         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, previously_failed_blinded_path_idxs_arg_constr);
78879         int64_t ret_ref = 0;
78880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78882         return ret_ref;
78883 }
78884
78885 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
78886         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
78887         int64_t ret_ref = 0;
78888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78890         return ret_ref;
78891 }
78892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78893         LDKPaymentParameters arg_conv;
78894         arg_conv.inner = untag_ptr(arg);
78895         arg_conv.is_owned = ptr_is_owned(arg);
78896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78897         arg_conv.is_owned = false;
78898         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
78899         return ret_conv;
78900 }
78901
78902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78903         LDKPaymentParameters orig_conv;
78904         orig_conv.inner = untag_ptr(orig);
78905         orig_conv.is_owned = ptr_is_owned(orig);
78906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78907         orig_conv.is_owned = false;
78908         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
78909         int64_t ret_ref = 0;
78910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78912         return ret_ref;
78913 }
78914
78915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
78916         LDKPaymentParameters o_conv;
78917         o_conv.inner = untag_ptr(o);
78918         o_conv.is_owned = ptr_is_owned(o);
78919         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78920         o_conv.is_owned = false;
78921         int64_t ret_conv = PaymentParameters_hash(&o_conv);
78922         return ret_conv;
78923 }
78924
78925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78926         LDKPaymentParameters a_conv;
78927         a_conv.inner = untag_ptr(a);
78928         a_conv.is_owned = ptr_is_owned(a);
78929         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78930         a_conv.is_owned = false;
78931         LDKPaymentParameters b_conv;
78932         b_conv.inner = untag_ptr(b);
78933         b_conv.is_owned = ptr_is_owned(b);
78934         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78935         b_conv.is_owned = false;
78936         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
78937         return ret_conv;
78938 }
78939
78940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
78941         LDKPaymentParameters obj_conv;
78942         obj_conv.inner = untag_ptr(obj);
78943         obj_conv.is_owned = ptr_is_owned(obj);
78944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78945         obj_conv.is_owned = false;
78946         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
78947         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78948         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78949         CVec_u8Z_free(ret_var);
78950         return ret_arr;
78951 }
78952
78953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
78954         LDKu8slice ser_ref;
78955         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78956         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78957         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
78958         *ret_conv = PaymentParameters_read(ser_ref, arg);
78959         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78960         return tag_ptr(ret_conv, true);
78961 }
78962
78963 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) {
78964         LDKPublicKey payee_pubkey_ref;
78965         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
78966         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
78967         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
78968         int64_t ret_ref = 0;
78969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78971         return ret_ref;
78972 }
78973
78974 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) {
78975         LDKPublicKey payee_pubkey_ref;
78976         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
78977         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
78978         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
78979         int64_t ret_ref = 0;
78980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78982         return ret_ref;
78983 }
78984
78985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
78986         LDKBolt12Invoice invoice_conv;
78987         invoice_conv.inner = untag_ptr(invoice);
78988         invoice_conv.is_owned = ptr_is_owned(invoice);
78989         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
78990         invoice_conv.is_owned = false;
78991         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
78992         int64_t ret_ref = 0;
78993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78995         return ret_ref;
78996 }
78997
78998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
78999         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
79000         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
79001         if (blinded_route_hints_constr.datalen > 0)
79002                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
79003         else
79004                 blinded_route_hints_constr.data = NULL;
79005         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
79006         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
79007                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
79008                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
79009                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
79010                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
79011                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
79012                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
79013         }
79014         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
79015         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
79016         int64_t ret_ref = 0;
79017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79019         return ret_ref;
79020 }
79021
79022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79023         if (!ptr_is_owned(this_ptr)) return;
79024         void* this_ptr_ptr = untag_ptr(this_ptr);
79025         CHECK_ACCESS(this_ptr_ptr);
79026         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
79027         FREE(untag_ptr(this_ptr));
79028         Payee_free(this_ptr_conv);
79029 }
79030
79031 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
79032         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
79033         *ret_copy = Payee_clone(arg);
79034         int64_t ret_ref = tag_ptr(ret_copy, true);
79035         return ret_ref;
79036 }
79037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79038         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
79039         int64_t ret_conv = Payee_clone_ptr(arg_conv);
79040         return ret_conv;
79041 }
79042
79043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79044         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
79045         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
79046         *ret_copy = Payee_clone(orig_conv);
79047         int64_t ret_ref = tag_ptr(ret_copy, true);
79048         return ret_ref;
79049 }
79050
79051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
79052         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
79053         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
79054         if (route_hints_constr.datalen > 0)
79055                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
79056         else
79057                 route_hints_constr.data = NULL;
79058         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
79059         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
79060                 int64_t route_hints_conv_37 = route_hints_vals[l];
79061                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
79062                 CHECK_ACCESS(route_hints_conv_37_ptr);
79063                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
79064                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
79065                 route_hints_constr.data[l] = route_hints_conv_37_conv;
79066         }
79067         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
79068         LDKBolt12InvoiceFeatures features_conv;
79069         features_conv.inner = untag_ptr(features);
79070         features_conv.is_owned = ptr_is_owned(features);
79071         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
79072         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
79073         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
79074         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
79075         int64_t ret_ref = tag_ptr(ret_copy, true);
79076         return ret_ref;
79077 }
79078
79079 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) {
79080         LDKPublicKey node_id_ref;
79081         CHECK((*env)->GetArrayLength(env, node_id) == 33);
79082         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
79083         LDKCVec_RouteHintZ route_hints_constr;
79084         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
79085         if (route_hints_constr.datalen > 0)
79086                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
79087         else
79088                 route_hints_constr.data = NULL;
79089         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
79090         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
79091                 int64_t route_hints_conv_11 = route_hints_vals[l];
79092                 LDKRouteHint route_hints_conv_11_conv;
79093                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
79094                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
79095                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
79096                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
79097                 route_hints_constr.data[l] = route_hints_conv_11_conv;
79098         }
79099         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
79100         LDKBolt11InvoiceFeatures features_conv;
79101         features_conv.inner = untag_ptr(features);
79102         features_conv.is_owned = ptr_is_owned(features);
79103         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
79104         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
79105         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
79106         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
79107         int64_t ret_ref = tag_ptr(ret_copy, true);
79108         return ret_ref;
79109 }
79110
79111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
79112         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
79113         int64_t ret_conv = Payee_hash(o_conv);
79114         return ret_conv;
79115 }
79116
79117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79118         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
79119         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
79120         jboolean ret_conv = Payee_eq(a_conv, b_conv);
79121         return ret_conv;
79122 }
79123
79124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79125         LDKRouteHint this_obj_conv;
79126         this_obj_conv.inner = untag_ptr(this_obj);
79127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79129         RouteHint_free(this_obj_conv);
79130 }
79131
79132 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
79133         LDKRouteHint this_ptr_conv;
79134         this_ptr_conv.inner = untag_ptr(this_ptr);
79135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79137         this_ptr_conv.is_owned = false;
79138         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
79139         int64_tArray ret_arr = NULL;
79140         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
79141         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
79142         for (size_t o = 0; o < ret_var.datalen; o++) {
79143                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
79144                 int64_t ret_conv_14_ref = 0;
79145                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
79146                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
79147                 ret_arr_ptr[o] = ret_conv_14_ref;
79148         }
79149         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
79150         FREE(ret_var.data);
79151         return ret_arr;
79152 }
79153
79154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
79155         LDKRouteHint this_ptr_conv;
79156         this_ptr_conv.inner = untag_ptr(this_ptr);
79157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79159         this_ptr_conv.is_owned = false;
79160         LDKCVec_RouteHintHopZ val_constr;
79161         val_constr.datalen = (*env)->GetArrayLength(env, val);
79162         if (val_constr.datalen > 0)
79163                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
79164         else
79165                 val_constr.data = NULL;
79166         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
79167         for (size_t o = 0; o < val_constr.datalen; o++) {
79168                 int64_t val_conv_14 = val_vals[o];
79169                 LDKRouteHintHop val_conv_14_conv;
79170                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
79171                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
79172                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
79173                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
79174                 val_constr.data[o] = val_conv_14_conv;
79175         }
79176         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
79177         RouteHint_set_a(&this_ptr_conv, val_constr);
79178 }
79179
79180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
79181         LDKCVec_RouteHintHopZ a_arg_constr;
79182         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
79183         if (a_arg_constr.datalen > 0)
79184                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
79185         else
79186                 a_arg_constr.data = NULL;
79187         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
79188         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
79189                 int64_t a_arg_conv_14 = a_arg_vals[o];
79190                 LDKRouteHintHop a_arg_conv_14_conv;
79191                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
79192                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
79193                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
79194                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
79195                 a_arg_constr.data[o] = a_arg_conv_14_conv;
79196         }
79197         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
79198         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
79199         int64_t ret_ref = 0;
79200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79202         return ret_ref;
79203 }
79204
79205 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
79206         LDKRouteHint ret_var = RouteHint_clone(arg);
79207         int64_t ret_ref = 0;
79208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79210         return ret_ref;
79211 }
79212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79213         LDKRouteHint arg_conv;
79214         arg_conv.inner = untag_ptr(arg);
79215         arg_conv.is_owned = ptr_is_owned(arg);
79216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79217         arg_conv.is_owned = false;
79218         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
79219         return ret_conv;
79220 }
79221
79222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79223         LDKRouteHint orig_conv;
79224         orig_conv.inner = untag_ptr(orig);
79225         orig_conv.is_owned = ptr_is_owned(orig);
79226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79227         orig_conv.is_owned = false;
79228         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
79229         int64_t ret_ref = 0;
79230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79232         return ret_ref;
79233 }
79234
79235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
79236         LDKRouteHint o_conv;
79237         o_conv.inner = untag_ptr(o);
79238         o_conv.is_owned = ptr_is_owned(o);
79239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79240         o_conv.is_owned = false;
79241         int64_t ret_conv = RouteHint_hash(&o_conv);
79242         return ret_conv;
79243 }
79244
79245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79246         LDKRouteHint a_conv;
79247         a_conv.inner = untag_ptr(a);
79248         a_conv.is_owned = ptr_is_owned(a);
79249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79250         a_conv.is_owned = false;
79251         LDKRouteHint b_conv;
79252         b_conv.inner = untag_ptr(b);
79253         b_conv.is_owned = ptr_is_owned(b);
79254         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79255         b_conv.is_owned = false;
79256         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
79257         return ret_conv;
79258 }
79259
79260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
79261         LDKRouteHint obj_conv;
79262         obj_conv.inner = untag_ptr(obj);
79263         obj_conv.is_owned = ptr_is_owned(obj);
79264         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79265         obj_conv.is_owned = false;
79266         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
79267         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79268         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79269         CVec_u8Z_free(ret_var);
79270         return ret_arr;
79271 }
79272
79273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79274         LDKu8slice ser_ref;
79275         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79276         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79277         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
79278         *ret_conv = RouteHint_read(ser_ref);
79279         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79280         return tag_ptr(ret_conv, true);
79281 }
79282
79283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79284         LDKRouteHintHop this_obj_conv;
79285         this_obj_conv.inner = untag_ptr(this_obj);
79286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79288         RouteHintHop_free(this_obj_conv);
79289 }
79290
79291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79292         LDKRouteHintHop this_ptr_conv;
79293         this_ptr_conv.inner = untag_ptr(this_ptr);
79294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79296         this_ptr_conv.is_owned = false;
79297         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
79298         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
79299         return ret_arr;
79300 }
79301
79302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79303         LDKRouteHintHop this_ptr_conv;
79304         this_ptr_conv.inner = untag_ptr(this_ptr);
79305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79307         this_ptr_conv.is_owned = false;
79308         LDKPublicKey val_ref;
79309         CHECK((*env)->GetArrayLength(env, val) == 33);
79310         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
79311         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
79312 }
79313
79314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79315         LDKRouteHintHop this_ptr_conv;
79316         this_ptr_conv.inner = untag_ptr(this_ptr);
79317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79319         this_ptr_conv.is_owned = false;
79320         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
79321         return ret_conv;
79322 }
79323
79324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79325         LDKRouteHintHop this_ptr_conv;
79326         this_ptr_conv.inner = untag_ptr(this_ptr);
79327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79329         this_ptr_conv.is_owned = false;
79330         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
79331 }
79332
79333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
79334         LDKRouteHintHop this_ptr_conv;
79335         this_ptr_conv.inner = untag_ptr(this_ptr);
79336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79338         this_ptr_conv.is_owned = false;
79339         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
79340         int64_t ret_ref = 0;
79341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79343         return ret_ref;
79344 }
79345
79346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79347         LDKRouteHintHop this_ptr_conv;
79348         this_ptr_conv.inner = untag_ptr(this_ptr);
79349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79351         this_ptr_conv.is_owned = false;
79352         LDKRoutingFees val_conv;
79353         val_conv.inner = untag_ptr(val);
79354         val_conv.is_owned = ptr_is_owned(val);
79355         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79356         val_conv = RoutingFees_clone(&val_conv);
79357         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
79358 }
79359
79360 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
79361         LDKRouteHintHop this_ptr_conv;
79362         this_ptr_conv.inner = untag_ptr(this_ptr);
79363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79365         this_ptr_conv.is_owned = false;
79366         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
79367         return ret_conv;
79368 }
79369
79370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
79371         LDKRouteHintHop this_ptr_conv;
79372         this_ptr_conv.inner = untag_ptr(this_ptr);
79373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79375         this_ptr_conv.is_owned = false;
79376         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
79377 }
79378
79379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
79380         LDKRouteHintHop this_ptr_conv;
79381         this_ptr_conv.inner = untag_ptr(this_ptr);
79382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79384         this_ptr_conv.is_owned = false;
79385         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
79386         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
79387         int64_t ret_ref = tag_ptr(ret_copy, true);
79388         return ret_ref;
79389 }
79390
79391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79392         LDKRouteHintHop this_ptr_conv;
79393         this_ptr_conv.inner = untag_ptr(this_ptr);
79394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79396         this_ptr_conv.is_owned = false;
79397         void* val_ptr = untag_ptr(val);
79398         CHECK_ACCESS(val_ptr);
79399         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
79400         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
79401         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
79402 }
79403
79404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
79405         LDKRouteHintHop this_ptr_conv;
79406         this_ptr_conv.inner = untag_ptr(this_ptr);
79407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79409         this_ptr_conv.is_owned = false;
79410         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
79411         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
79412         int64_t ret_ref = tag_ptr(ret_copy, true);
79413         return ret_ref;
79414 }
79415
79416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79417         LDKRouteHintHop this_ptr_conv;
79418         this_ptr_conv.inner = untag_ptr(this_ptr);
79419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79421         this_ptr_conv.is_owned = false;
79422         void* val_ptr = untag_ptr(val);
79423         CHECK_ACCESS(val_ptr);
79424         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
79425         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
79426         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
79427 }
79428
79429 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) {
79430         LDKPublicKey src_node_id_arg_ref;
79431         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
79432         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
79433         LDKRoutingFees fees_arg_conv;
79434         fees_arg_conv.inner = untag_ptr(fees_arg);
79435         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
79436         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
79437         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
79438         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
79439         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
79440         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
79441         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
79442         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
79443         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
79444         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
79445         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
79446         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);
79447         int64_t ret_ref = 0;
79448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79450         return ret_ref;
79451 }
79452
79453 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
79454         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
79455         int64_t ret_ref = 0;
79456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79458         return ret_ref;
79459 }
79460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79461         LDKRouteHintHop arg_conv;
79462         arg_conv.inner = untag_ptr(arg);
79463         arg_conv.is_owned = ptr_is_owned(arg);
79464         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79465         arg_conv.is_owned = false;
79466         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
79467         return ret_conv;
79468 }
79469
79470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79471         LDKRouteHintHop orig_conv;
79472         orig_conv.inner = untag_ptr(orig);
79473         orig_conv.is_owned = ptr_is_owned(orig);
79474         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79475         orig_conv.is_owned = false;
79476         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
79477         int64_t ret_ref = 0;
79478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79480         return ret_ref;
79481 }
79482
79483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
79484         LDKRouteHintHop o_conv;
79485         o_conv.inner = untag_ptr(o);
79486         o_conv.is_owned = ptr_is_owned(o);
79487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79488         o_conv.is_owned = false;
79489         int64_t ret_conv = RouteHintHop_hash(&o_conv);
79490         return ret_conv;
79491 }
79492
79493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79494         LDKRouteHintHop a_conv;
79495         a_conv.inner = untag_ptr(a);
79496         a_conv.is_owned = ptr_is_owned(a);
79497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79498         a_conv.is_owned = false;
79499         LDKRouteHintHop b_conv;
79500         b_conv.inner = untag_ptr(b);
79501         b_conv.is_owned = ptr_is_owned(b);
79502         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79503         b_conv.is_owned = false;
79504         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
79505         return ret_conv;
79506 }
79507
79508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
79509         LDKRouteHintHop obj_conv;
79510         obj_conv.inner = untag_ptr(obj);
79511         obj_conv.is_owned = ptr_is_owned(obj);
79512         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79513         obj_conv.is_owned = false;
79514         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
79515         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79516         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79517         CVec_u8Z_free(ret_var);
79518         return ret_arr;
79519 }
79520
79521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79522         LDKu8slice ser_ref;
79523         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79524         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79525         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
79526         *ret_conv = RouteHintHop_read(ser_ref);
79527         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79528         return tag_ptr(ret_conv, true);
79529 }
79530
79531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79532         LDKFirstHopCandidate this_obj_conv;
79533         this_obj_conv.inner = untag_ptr(this_obj);
79534         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79536         FirstHopCandidate_free(this_obj_conv);
79537 }
79538
79539 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
79540         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
79541         int64_t ret_ref = 0;
79542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79544         return ret_ref;
79545 }
79546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79547         LDKFirstHopCandidate arg_conv;
79548         arg_conv.inner = untag_ptr(arg);
79549         arg_conv.is_owned = ptr_is_owned(arg);
79550         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79551         arg_conv.is_owned = false;
79552         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
79553         return ret_conv;
79554 }
79555
79556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79557         LDKFirstHopCandidate orig_conv;
79558         orig_conv.inner = untag_ptr(orig);
79559         orig_conv.is_owned = ptr_is_owned(orig);
79560         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79561         orig_conv.is_owned = false;
79562         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
79563         int64_t ret_ref = 0;
79564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79566         return ret_ref;
79567 }
79568
79569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79570         LDKPublicHopCandidate this_obj_conv;
79571         this_obj_conv.inner = untag_ptr(this_obj);
79572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79574         PublicHopCandidate_free(this_obj_conv);
79575 }
79576
79577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79578         LDKPublicHopCandidate this_ptr_conv;
79579         this_ptr_conv.inner = untag_ptr(this_ptr);
79580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79582         this_ptr_conv.is_owned = false;
79583         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
79584         return ret_conv;
79585 }
79586
79587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79588         LDKPublicHopCandidate this_ptr_conv;
79589         this_ptr_conv.inner = untag_ptr(this_ptr);
79590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79592         this_ptr_conv.is_owned = false;
79593         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
79594 }
79595
79596 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
79597         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
79598         int64_t ret_ref = 0;
79599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79601         return ret_ref;
79602 }
79603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79604         LDKPublicHopCandidate arg_conv;
79605         arg_conv.inner = untag_ptr(arg);
79606         arg_conv.is_owned = ptr_is_owned(arg);
79607         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79608         arg_conv.is_owned = false;
79609         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
79610         return ret_conv;
79611 }
79612
79613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79614         LDKPublicHopCandidate orig_conv;
79615         orig_conv.inner = untag_ptr(orig);
79616         orig_conv.is_owned = ptr_is_owned(orig);
79617         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79618         orig_conv.is_owned = false;
79619         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
79620         int64_t ret_ref = 0;
79621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79623         return ret_ref;
79624 }
79625
79626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79627         LDKPrivateHopCandidate this_obj_conv;
79628         this_obj_conv.inner = untag_ptr(this_obj);
79629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79631         PrivateHopCandidate_free(this_obj_conv);
79632 }
79633
79634 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
79635         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
79636         int64_t ret_ref = 0;
79637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79639         return ret_ref;
79640 }
79641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79642         LDKPrivateHopCandidate arg_conv;
79643         arg_conv.inner = untag_ptr(arg);
79644         arg_conv.is_owned = ptr_is_owned(arg);
79645         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79646         arg_conv.is_owned = false;
79647         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
79648         return ret_conv;
79649 }
79650
79651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79652         LDKPrivateHopCandidate orig_conv;
79653         orig_conv.inner = untag_ptr(orig);
79654         orig_conv.is_owned = ptr_is_owned(orig);
79655         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79656         orig_conv.is_owned = false;
79657         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
79658         int64_t ret_ref = 0;
79659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79661         return ret_ref;
79662 }
79663
79664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79665         LDKBlindedPathCandidate this_obj_conv;
79666         this_obj_conv.inner = untag_ptr(this_obj);
79667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79669         BlindedPathCandidate_free(this_obj_conv);
79670 }
79671
79672 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
79673         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
79674         int64_t ret_ref = 0;
79675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79677         return ret_ref;
79678 }
79679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79680         LDKBlindedPathCandidate arg_conv;
79681         arg_conv.inner = untag_ptr(arg);
79682         arg_conv.is_owned = ptr_is_owned(arg);
79683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79684         arg_conv.is_owned = false;
79685         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
79686         return ret_conv;
79687 }
79688
79689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79690         LDKBlindedPathCandidate orig_conv;
79691         orig_conv.inner = untag_ptr(orig);
79692         orig_conv.is_owned = ptr_is_owned(orig);
79693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79694         orig_conv.is_owned = false;
79695         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
79696         int64_t ret_ref = 0;
79697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79699         return ret_ref;
79700 }
79701
79702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79703         LDKOneHopBlindedPathCandidate this_obj_conv;
79704         this_obj_conv.inner = untag_ptr(this_obj);
79705         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79707         OneHopBlindedPathCandidate_free(this_obj_conv);
79708 }
79709
79710 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
79711         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
79712         int64_t ret_ref = 0;
79713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79715         return ret_ref;
79716 }
79717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79718         LDKOneHopBlindedPathCandidate arg_conv;
79719         arg_conv.inner = untag_ptr(arg);
79720         arg_conv.is_owned = ptr_is_owned(arg);
79721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79722         arg_conv.is_owned = false;
79723         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
79724         return ret_conv;
79725 }
79726
79727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79728         LDKOneHopBlindedPathCandidate orig_conv;
79729         orig_conv.inner = untag_ptr(orig);
79730         orig_conv.is_owned = ptr_is_owned(orig);
79731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79732         orig_conv.is_owned = false;
79733         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
79734         int64_t ret_ref = 0;
79735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79737         return ret_ref;
79738 }
79739
79740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79741         if (!ptr_is_owned(this_ptr)) return;
79742         void* this_ptr_ptr = untag_ptr(this_ptr);
79743         CHECK_ACCESS(this_ptr_ptr);
79744         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
79745         FREE(untag_ptr(this_ptr));
79746         CandidateRouteHop_free(this_ptr_conv);
79747 }
79748
79749 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
79750         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79751         *ret_copy = CandidateRouteHop_clone(arg);
79752         int64_t ret_ref = tag_ptr(ret_copy, true);
79753         return ret_ref;
79754 }
79755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79756         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
79757         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
79758         return ret_conv;
79759 }
79760
79761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79762         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
79763         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79764         *ret_copy = CandidateRouteHop_clone(orig_conv);
79765         int64_t ret_ref = tag_ptr(ret_copy, true);
79766         return ret_ref;
79767 }
79768
79769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1first_1hop(JNIEnv *env, jclass clz, int64_t a) {
79770         LDKFirstHopCandidate a_conv;
79771         a_conv.inner = untag_ptr(a);
79772         a_conv.is_owned = ptr_is_owned(a);
79773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79774         a_conv = FirstHopCandidate_clone(&a_conv);
79775         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79776         *ret_copy = CandidateRouteHop_first_hop(a_conv);
79777         int64_t ret_ref = tag_ptr(ret_copy, true);
79778         return ret_ref;
79779 }
79780
79781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1public_1hop(JNIEnv *env, jclass clz, int64_t a) {
79782         LDKPublicHopCandidate a_conv;
79783         a_conv.inner = untag_ptr(a);
79784         a_conv.is_owned = ptr_is_owned(a);
79785         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79786         a_conv = PublicHopCandidate_clone(&a_conv);
79787         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79788         *ret_copy = CandidateRouteHop_public_hop(a_conv);
79789         int64_t ret_ref = tag_ptr(ret_copy, true);
79790         return ret_ref;
79791 }
79792
79793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1private_1hop(JNIEnv *env, jclass clz, int64_t a) {
79794         LDKPrivateHopCandidate a_conv;
79795         a_conv.inner = untag_ptr(a);
79796         a_conv.is_owned = ptr_is_owned(a);
79797         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79798         a_conv = PrivateHopCandidate_clone(&a_conv);
79799         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79800         *ret_copy = CandidateRouteHop_private_hop(a_conv);
79801         int64_t ret_ref = tag_ptr(ret_copy, true);
79802         return ret_ref;
79803 }
79804
79805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
79806         LDKBlindedPathCandidate a_conv;
79807         a_conv.inner = untag_ptr(a);
79808         a_conv.is_owned = ptr_is_owned(a);
79809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79810         a_conv = BlindedPathCandidate_clone(&a_conv);
79811         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79812         *ret_copy = CandidateRouteHop_blinded(a_conv);
79813         int64_t ret_ref = tag_ptr(ret_copy, true);
79814         return ret_ref;
79815 }
79816
79817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1one_1hop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
79818         LDKOneHopBlindedPathCandidate a_conv;
79819         a_conv.inner = untag_ptr(a);
79820         a_conv.is_owned = ptr_is_owned(a);
79821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79822         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
79823         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
79824         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
79825         int64_t ret_ref = tag_ptr(ret_copy, true);
79826         return ret_ref;
79827 }
79828
79829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1globally_1unique_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
79830         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
79831         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
79832         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
79833         int64_t ret_ref = tag_ptr(ret_copy, true);
79834         return ret_ref;
79835 }
79836
79837 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
79838         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
79839         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
79840         return ret_conv;
79841 }
79842
79843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
79844         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
79845         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
79846         return ret_conv;
79847 }
79848
79849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
79850         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
79851         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
79852         int64_t ret_ref = 0;
79853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79855         return ret_ref;
79856 }
79857
79858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
79859         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
79860         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
79861         int64_t ret_ref = 0;
79862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79864         return ret_ref;
79865 }
79866
79867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
79868         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
79869         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
79870         int64_t ret_ref = 0;
79871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79873         return ret_ref;
79874 }
79875
79876 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) {
79877         LDKPublicKey our_node_pubkey_ref;
79878         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
79879         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
79880         LDKRouteParameters route_params_conv;
79881         route_params_conv.inner = untag_ptr(route_params);
79882         route_params_conv.is_owned = ptr_is_owned(route_params);
79883         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
79884         route_params_conv.is_owned = false;
79885         LDKNetworkGraph network_graph_conv;
79886         network_graph_conv.inner = untag_ptr(network_graph);
79887         network_graph_conv.is_owned = ptr_is_owned(network_graph);
79888         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
79889         network_graph_conv.is_owned = false;
79890         LDKCVec_ChannelDetailsZ first_hops_constr;
79891         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
79892         if (first_hops != NULL) {
79893                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
79894                 if (first_hops_constr.datalen > 0)
79895                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
79896                 else
79897                         first_hops_constr.data = NULL;
79898                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
79899                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
79900                         int64_t first_hops_conv_16 = first_hops_vals[q];
79901                         LDKChannelDetails first_hops_conv_16_conv;
79902                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
79903                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
79904                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
79905                         first_hops_conv_16_conv.is_owned = false;
79906                         first_hops_constr.data[q] = first_hops_conv_16_conv;
79907                 }
79908                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
79909                 first_hops_ptr = &first_hops_constr;
79910         }
79911         void* logger_ptr = untag_ptr(logger);
79912         CHECK_ACCESS(logger_ptr);
79913         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79914         if (logger_conv.free == LDKLogger_JCalls_free) {
79915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79916                 LDKLogger_JCalls_cloned(&logger_conv);
79917         }
79918         void* scorer_ptr = untag_ptr(scorer);
79919         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
79920         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
79921         LDKProbabilisticScoringFeeParameters score_params_conv;
79922         score_params_conv.inner = untag_ptr(score_params);
79923         score_params_conv.is_owned = ptr_is_owned(score_params);
79924         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
79925         score_params_conv.is_owned = false;
79926         uint8_t random_seed_bytes_arr[32];
79927         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
79928         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
79929         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
79930         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
79931         *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);
79932         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
79933         return tag_ptr(ret_conv, true);
79934 }
79935
79936 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) {
79937         LDKPublicKey our_node_pubkey_ref;
79938         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
79939         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
79940         LDKCVec_PublicKeyZ hops_constr;
79941         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
79942         if (hops_constr.datalen > 0)
79943                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
79944         else
79945                 hops_constr.data = NULL;
79946         for (size_t i = 0; i < hops_constr.datalen; i++) {
79947                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
79948                 LDKPublicKey hops_conv_8_ref;
79949                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
79950                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
79951                 hops_constr.data[i] = hops_conv_8_ref;
79952         }
79953         LDKRouteParameters route_params_conv;
79954         route_params_conv.inner = untag_ptr(route_params);
79955         route_params_conv.is_owned = ptr_is_owned(route_params);
79956         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
79957         route_params_conv.is_owned = false;
79958         LDKNetworkGraph network_graph_conv;
79959         network_graph_conv.inner = untag_ptr(network_graph);
79960         network_graph_conv.is_owned = ptr_is_owned(network_graph);
79961         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
79962         network_graph_conv.is_owned = false;
79963         void* logger_ptr = untag_ptr(logger);
79964         CHECK_ACCESS(logger_ptr);
79965         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79966         if (logger_conv.free == LDKLogger_JCalls_free) {
79967                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79968                 LDKLogger_JCalls_cloned(&logger_conv);
79969         }
79970         uint8_t random_seed_bytes_arr[32];
79971         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
79972         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
79973         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
79974         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
79975         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
79976         return tag_ptr(ret_conv, true);
79977 }
79978
79979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79980         if (!ptr_is_owned(this_ptr)) return;
79981         void* this_ptr_ptr = untag_ptr(this_ptr);
79982         CHECK_ACCESS(this_ptr_ptr);
79983         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
79984         FREE(untag_ptr(this_ptr));
79985         ScoreLookUp_free(this_ptr_conv);
79986 }
79987
79988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79989         if (!ptr_is_owned(this_ptr)) return;
79990         void* this_ptr_ptr = untag_ptr(this_ptr);
79991         CHECK_ACCESS(this_ptr_ptr);
79992         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
79993         FREE(untag_ptr(this_ptr));
79994         ScoreUpdate_free(this_ptr_conv);
79995 }
79996
79997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79998         if (!ptr_is_owned(this_ptr)) return;
79999         void* this_ptr_ptr = untag_ptr(this_ptr);
80000         CHECK_ACCESS(this_ptr_ptr);
80001         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
80002         FREE(untag_ptr(this_ptr));
80003         Score_free(this_ptr_conv);
80004 }
80005
80006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80007         if (!ptr_is_owned(this_ptr)) return;
80008         void* this_ptr_ptr = untag_ptr(this_ptr);
80009         CHECK_ACCESS(this_ptr_ptr);
80010         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
80011         FREE(untag_ptr(this_ptr));
80012         LockableScore_free(this_ptr_conv);
80013 }
80014
80015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80016         if (!ptr_is_owned(this_ptr)) return;
80017         void* this_ptr_ptr = untag_ptr(this_ptr);
80018         CHECK_ACCESS(this_ptr_ptr);
80019         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
80020         FREE(untag_ptr(this_ptr));
80021         WriteableScore_free(this_ptr_conv);
80022 }
80023
80024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80025         LDKMultiThreadedLockableScore this_obj_conv;
80026         this_obj_conv.inner = untag_ptr(this_obj);
80027         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80029         MultiThreadedLockableScore_free(this_obj_conv);
80030 }
80031
80032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
80033         LDKMultiThreadedLockableScore this_arg_conv;
80034         this_arg_conv.inner = untag_ptr(this_arg);
80035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80037         this_arg_conv.is_owned = false;
80038         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
80039         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
80040         return tag_ptr(ret_ret, true);
80041 }
80042
80043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
80044         LDKMultiThreadedLockableScore obj_conv;
80045         obj_conv.inner = untag_ptr(obj);
80046         obj_conv.is_owned = ptr_is_owned(obj);
80047         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80048         obj_conv.is_owned = false;
80049         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
80050         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80051         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80052         CVec_u8Z_free(ret_var);
80053         return ret_arr;
80054 }
80055
80056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
80057         LDKMultiThreadedLockableScore this_arg_conv;
80058         this_arg_conv.inner = untag_ptr(this_arg);
80059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80061         this_arg_conv.is_owned = false;
80062         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
80063         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
80064         return tag_ptr(ret_ret, true);
80065 }
80066
80067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
80068         void* score_ptr = untag_ptr(score);
80069         CHECK_ACCESS(score_ptr);
80070         LDKScore score_conv = *(LDKScore*)(score_ptr);
80071         if (score_conv.free == LDKScore_JCalls_free) {
80072                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80073                 LDKScore_JCalls_cloned(&score_conv);
80074         }
80075         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
80076         int64_t ret_ref = 0;
80077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80079         return ret_ref;
80080 }
80081
80082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80083         LDKMultiThreadedScoreLockRead this_obj_conv;
80084         this_obj_conv.inner = untag_ptr(this_obj);
80085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80087         MultiThreadedScoreLockRead_free(this_obj_conv);
80088 }
80089
80090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80091         LDKMultiThreadedScoreLockWrite this_obj_conv;
80092         this_obj_conv.inner = untag_ptr(this_obj);
80093         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80095         MultiThreadedScoreLockWrite_free(this_obj_conv);
80096 }
80097
80098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
80099         LDKMultiThreadedScoreLockRead this_arg_conv;
80100         this_arg_conv.inner = untag_ptr(this_arg);
80101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80103         this_arg_conv.is_owned = false;
80104         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
80105         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
80106         return tag_ptr(ret_ret, true);
80107 }
80108
80109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
80110         LDKMultiThreadedScoreLockWrite obj_conv;
80111         obj_conv.inner = untag_ptr(obj);
80112         obj_conv.is_owned = ptr_is_owned(obj);
80113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80114         obj_conv.is_owned = false;
80115         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
80116         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80117         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80118         CVec_u8Z_free(ret_var);
80119         return ret_arr;
80120 }
80121
80122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
80123         LDKMultiThreadedScoreLockWrite this_arg_conv;
80124         this_arg_conv.inner = untag_ptr(this_arg);
80125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80127         this_arg_conv.is_owned = false;
80128         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
80129         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
80130         return tag_ptr(ret_ret, true);
80131 }
80132
80133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80134         LDKChannelUsage this_obj_conv;
80135         this_obj_conv.inner = untag_ptr(this_obj);
80136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80138         ChannelUsage_free(this_obj_conv);
80139 }
80140
80141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80142         LDKChannelUsage this_ptr_conv;
80143         this_ptr_conv.inner = untag_ptr(this_ptr);
80144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80146         this_ptr_conv.is_owned = false;
80147         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
80148         return ret_conv;
80149 }
80150
80151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80152         LDKChannelUsage this_ptr_conv;
80153         this_ptr_conv.inner = untag_ptr(this_ptr);
80154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80156         this_ptr_conv.is_owned = false;
80157         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
80158 }
80159
80160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80161         LDKChannelUsage this_ptr_conv;
80162         this_ptr_conv.inner = untag_ptr(this_ptr);
80163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80165         this_ptr_conv.is_owned = false;
80166         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
80167         return ret_conv;
80168 }
80169
80170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80171         LDKChannelUsage this_ptr_conv;
80172         this_ptr_conv.inner = untag_ptr(this_ptr);
80173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80175         this_ptr_conv.is_owned = false;
80176         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
80177 }
80178
80179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
80180         LDKChannelUsage this_ptr_conv;
80181         this_ptr_conv.inner = untag_ptr(this_ptr);
80182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80184         this_ptr_conv.is_owned = false;
80185         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
80186         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
80187         int64_t ret_ref = tag_ptr(ret_copy, true);
80188         return ret_ref;
80189 }
80190
80191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80192         LDKChannelUsage this_ptr_conv;
80193         this_ptr_conv.inner = untag_ptr(this_ptr);
80194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80196         this_ptr_conv.is_owned = false;
80197         void* val_ptr = untag_ptr(val);
80198         CHECK_ACCESS(val_ptr);
80199         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
80200         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
80201         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
80202 }
80203
80204 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) {
80205         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
80206         CHECK_ACCESS(effective_capacity_arg_ptr);
80207         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
80208         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
80209         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
80210         int64_t ret_ref = 0;
80211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80213         return ret_ref;
80214 }
80215
80216 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
80217         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
80218         int64_t ret_ref = 0;
80219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80221         return ret_ref;
80222 }
80223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80224         LDKChannelUsage arg_conv;
80225         arg_conv.inner = untag_ptr(arg);
80226         arg_conv.is_owned = ptr_is_owned(arg);
80227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80228         arg_conv.is_owned = false;
80229         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
80230         return ret_conv;
80231 }
80232
80233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80234         LDKChannelUsage orig_conv;
80235         orig_conv.inner = untag_ptr(orig);
80236         orig_conv.is_owned = ptr_is_owned(orig);
80237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80238         orig_conv.is_owned = false;
80239         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
80240         int64_t ret_ref = 0;
80241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80243         return ret_ref;
80244 }
80245
80246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80247         LDKFixedPenaltyScorer this_obj_conv;
80248         this_obj_conv.inner = untag_ptr(this_obj);
80249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80251         FixedPenaltyScorer_free(this_obj_conv);
80252 }
80253
80254 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
80255         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
80256         int64_t ret_ref = 0;
80257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80259         return ret_ref;
80260 }
80261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80262         LDKFixedPenaltyScorer arg_conv;
80263         arg_conv.inner = untag_ptr(arg);
80264         arg_conv.is_owned = ptr_is_owned(arg);
80265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80266         arg_conv.is_owned = false;
80267         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
80268         return ret_conv;
80269 }
80270
80271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80272         LDKFixedPenaltyScorer orig_conv;
80273         orig_conv.inner = untag_ptr(orig);
80274         orig_conv.is_owned = ptr_is_owned(orig);
80275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80276         orig_conv.is_owned = false;
80277         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
80278         int64_t ret_ref = 0;
80279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80281         return ret_ref;
80282 }
80283
80284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
80285         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
80286         int64_t ret_ref = 0;
80287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80289         return ret_ref;
80290 }
80291
80292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
80293         LDKFixedPenaltyScorer this_arg_conv;
80294         this_arg_conv.inner = untag_ptr(this_arg);
80295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80297         this_arg_conv.is_owned = false;
80298         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
80299         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
80300         return tag_ptr(ret_ret, true);
80301 }
80302
80303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
80304         LDKFixedPenaltyScorer this_arg_conv;
80305         this_arg_conv.inner = untag_ptr(this_arg);
80306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80308         this_arg_conv.is_owned = false;
80309         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
80310         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
80311         return tag_ptr(ret_ret, true);
80312 }
80313
80314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
80315         LDKFixedPenaltyScorer obj_conv;
80316         obj_conv.inner = untag_ptr(obj);
80317         obj_conv.is_owned = ptr_is_owned(obj);
80318         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80319         obj_conv.is_owned = false;
80320         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
80321         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80322         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80323         CVec_u8Z_free(ret_var);
80324         return ret_arr;
80325 }
80326
80327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
80328         LDKu8slice ser_ref;
80329         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
80330         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
80331         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
80332         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
80333         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
80334         return tag_ptr(ret_conv, true);
80335 }
80336
80337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80338         LDKProbabilisticScorer this_obj_conv;
80339         this_obj_conv.inner = untag_ptr(this_obj);
80340         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80342         ProbabilisticScorer_free(this_obj_conv);
80343 }
80344
80345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80346         LDKProbabilisticScoringFeeParameters this_obj_conv;
80347         this_obj_conv.inner = untag_ptr(this_obj);
80348         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80350         ProbabilisticScoringFeeParameters_free(this_obj_conv);
80351 }
80352
80353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80354         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80355         this_ptr_conv.inner = untag_ptr(this_ptr);
80356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80358         this_ptr_conv.is_owned = false;
80359         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
80360         return ret_conv;
80361 }
80362
80363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80364         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80365         this_ptr_conv.inner = untag_ptr(this_ptr);
80366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80368         this_ptr_conv.is_owned = false;
80369         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
80370 }
80371
80372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80373         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80374         this_ptr_conv.inner = untag_ptr(this_ptr);
80375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80377         this_ptr_conv.is_owned = false;
80378         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
80379         return ret_conv;
80380 }
80381
80382 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) {
80383         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80384         this_ptr_conv.inner = untag_ptr(this_ptr);
80385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80387         this_ptr_conv.is_owned = false;
80388         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
80389 }
80390
80391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80392         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80393         this_ptr_conv.inner = untag_ptr(this_ptr);
80394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80396         this_ptr_conv.is_owned = false;
80397         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
80398         return ret_conv;
80399 }
80400
80401 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) {
80402         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80403         this_ptr_conv.inner = untag_ptr(this_ptr);
80404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80406         this_ptr_conv.is_owned = false;
80407         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
80408 }
80409
80410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80411         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80412         this_ptr_conv.inner = untag_ptr(this_ptr);
80413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80415         this_ptr_conv.is_owned = false;
80416         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
80417         return ret_conv;
80418 }
80419
80420 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) {
80421         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80422         this_ptr_conv.inner = untag_ptr(this_ptr);
80423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80425         this_ptr_conv.is_owned = false;
80426         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
80427 }
80428
80429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80430         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80431         this_ptr_conv.inner = untag_ptr(this_ptr);
80432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80434         this_ptr_conv.is_owned = false;
80435         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
80436         return ret_conv;
80437 }
80438
80439 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) {
80440         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80441         this_ptr_conv.inner = untag_ptr(this_ptr);
80442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80444         this_ptr_conv.is_owned = false;
80445         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
80446 }
80447
80448 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) {
80449         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80450         this_ptr_conv.inner = untag_ptr(this_ptr);
80451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80453         this_ptr_conv.is_owned = false;
80454         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
80455         return ret_conv;
80456 }
80457
80458 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) {
80459         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80460         this_ptr_conv.inner = untag_ptr(this_ptr);
80461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80463         this_ptr_conv.is_owned = false;
80464         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
80465 }
80466
80467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80468         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80469         this_ptr_conv.inner = untag_ptr(this_ptr);
80470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80472         this_ptr_conv.is_owned = false;
80473         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
80474         return ret_conv;
80475 }
80476
80477 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) {
80478         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80479         this_ptr_conv.inner = untag_ptr(this_ptr);
80480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80482         this_ptr_conv.is_owned = false;
80483         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
80484 }
80485
80486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
80487         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80488         this_ptr_conv.inner = untag_ptr(this_ptr);
80489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80491         this_ptr_conv.is_owned = false;
80492         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
80493         return ret_conv;
80494 }
80495
80496 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) {
80497         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80498         this_ptr_conv.inner = untag_ptr(this_ptr);
80499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80501         this_ptr_conv.is_owned = false;
80502         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
80503 }
80504
80505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
80506         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80507         this_ptr_conv.inner = untag_ptr(this_ptr);
80508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80510         this_ptr_conv.is_owned = false;
80511         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
80512         return ret_conv;
80513 }
80514
80515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
80516         LDKProbabilisticScoringFeeParameters this_ptr_conv;
80517         this_ptr_conv.inner = untag_ptr(this_ptr);
80518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80520         this_ptr_conv.is_owned = false;
80521         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
80522 }
80523
80524 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
80525         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
80526         int64_t ret_ref = 0;
80527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80529         return ret_ref;
80530 }
80531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80532         LDKProbabilisticScoringFeeParameters arg_conv;
80533         arg_conv.inner = untag_ptr(arg);
80534         arg_conv.is_owned = ptr_is_owned(arg);
80535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80536         arg_conv.is_owned = false;
80537         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
80538         return ret_conv;
80539 }
80540
80541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80542         LDKProbabilisticScoringFeeParameters orig_conv;
80543         orig_conv.inner = untag_ptr(orig);
80544         orig_conv.is_owned = ptr_is_owned(orig);
80545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80546         orig_conv.is_owned = false;
80547         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
80548         int64_t ret_ref = 0;
80549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80551         return ret_ref;
80552 }
80553
80554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
80555         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
80556         int64_t ret_ref = 0;
80557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80559         return ret_ref;
80560 }
80561
80562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
80563         LDKProbabilisticScoringFeeParameters this_arg_conv;
80564         this_arg_conv.inner = untag_ptr(this_arg);
80565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80567         this_arg_conv.is_owned = false;
80568         LDKNodeId node_id_conv;
80569         node_id_conv.inner = untag_ptr(node_id);
80570         node_id_conv.is_owned = ptr_is_owned(node_id);
80571         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
80572         node_id_conv.is_owned = false;
80573         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
80574 }
80575
80576 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) {
80577         LDKProbabilisticScoringFeeParameters this_arg_conv;
80578         this_arg_conv.inner = untag_ptr(this_arg);
80579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80581         this_arg_conv.is_owned = false;
80582         LDKCVec_NodeIdZ node_ids_constr;
80583         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
80584         if (node_ids_constr.datalen > 0)
80585                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
80586         else
80587                 node_ids_constr.data = NULL;
80588         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
80589         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
80590                 int64_t node_ids_conv_8 = node_ids_vals[i];
80591                 LDKNodeId node_ids_conv_8_conv;
80592                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
80593                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
80594                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
80595                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
80596                 node_ids_constr.data[i] = node_ids_conv_8_conv;
80597         }
80598         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
80599         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
80600 }
80601
80602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
80603         LDKProbabilisticScoringFeeParameters this_arg_conv;
80604         this_arg_conv.inner = untag_ptr(this_arg);
80605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80607         this_arg_conv.is_owned = false;
80608         LDKNodeId node_id_conv;
80609         node_id_conv.inner = untag_ptr(node_id);
80610         node_id_conv.is_owned = ptr_is_owned(node_id);
80611         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
80612         node_id_conv.is_owned = false;
80613         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
80614 }
80615
80616 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) {
80617         LDKProbabilisticScoringFeeParameters this_arg_conv;
80618         this_arg_conv.inner = untag_ptr(this_arg);
80619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80621         this_arg_conv.is_owned = false;
80622         LDKNodeId node_id_conv;
80623         node_id_conv.inner = untag_ptr(node_id);
80624         node_id_conv.is_owned = ptr_is_owned(node_id);
80625         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
80626         node_id_conv.is_owned = false;
80627         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
80628 }
80629
80630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
80631         LDKProbabilisticScoringFeeParameters this_arg_conv;
80632         this_arg_conv.inner = untag_ptr(this_arg);
80633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80635         this_arg_conv.is_owned = false;
80636         LDKNodeId node_id_conv;
80637         node_id_conv.inner = untag_ptr(node_id);
80638         node_id_conv.is_owned = ptr_is_owned(node_id);
80639         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
80640         node_id_conv.is_owned = false;
80641         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
80642 }
80643
80644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
80645         LDKProbabilisticScoringFeeParameters this_arg_conv;
80646         this_arg_conv.inner = untag_ptr(this_arg);
80647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80649         this_arg_conv.is_owned = false;
80650         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
80651 }
80652
80653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80654         LDKProbabilisticScoringDecayParameters this_obj_conv;
80655         this_obj_conv.inner = untag_ptr(this_obj);
80656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80658         ProbabilisticScoringDecayParameters_free(this_obj_conv);
80659 }
80660
80661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
80662         LDKProbabilisticScoringDecayParameters this_ptr_conv;
80663         this_ptr_conv.inner = untag_ptr(this_ptr);
80664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80666         this_ptr_conv.is_owned = false;
80667         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
80668         return ret_conv;
80669 }
80670
80671 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) {
80672         LDKProbabilisticScoringDecayParameters this_ptr_conv;
80673         this_ptr_conv.inner = untag_ptr(this_ptr);
80674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80676         this_ptr_conv.is_owned = false;
80677         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
80678 }
80679
80680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
80681         LDKProbabilisticScoringDecayParameters this_ptr_conv;
80682         this_ptr_conv.inner = untag_ptr(this_ptr);
80683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80685         this_ptr_conv.is_owned = false;
80686         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
80687         return ret_conv;
80688 }
80689
80690 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) {
80691         LDKProbabilisticScoringDecayParameters this_ptr_conv;
80692         this_ptr_conv.inner = untag_ptr(this_ptr);
80693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80695         this_ptr_conv.is_owned = false;
80696         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
80697 }
80698
80699 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) {
80700         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
80701         int64_t ret_ref = 0;
80702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80704         return ret_ref;
80705 }
80706
80707 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
80708         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
80709         int64_t ret_ref = 0;
80710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80712         return ret_ref;
80713 }
80714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80715         LDKProbabilisticScoringDecayParameters arg_conv;
80716         arg_conv.inner = untag_ptr(arg);
80717         arg_conv.is_owned = ptr_is_owned(arg);
80718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80719         arg_conv.is_owned = false;
80720         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
80721         return ret_conv;
80722 }
80723
80724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80725         LDKProbabilisticScoringDecayParameters orig_conv;
80726         orig_conv.inner = untag_ptr(orig);
80727         orig_conv.is_owned = ptr_is_owned(orig);
80728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80729         orig_conv.is_owned = false;
80730         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
80731         int64_t ret_ref = 0;
80732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80734         return ret_ref;
80735 }
80736
80737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
80738         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
80739         int64_t ret_ref = 0;
80740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80742         return ret_ref;
80743 }
80744
80745 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) {
80746         LDKProbabilisticScoringDecayParameters decay_params_conv;
80747         decay_params_conv.inner = untag_ptr(decay_params);
80748         decay_params_conv.is_owned = ptr_is_owned(decay_params);
80749         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
80750         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
80751         LDKNetworkGraph network_graph_conv;
80752         network_graph_conv.inner = untag_ptr(network_graph);
80753         network_graph_conv.is_owned = ptr_is_owned(network_graph);
80754         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
80755         network_graph_conv.is_owned = false;
80756         void* logger_ptr = untag_ptr(logger);
80757         CHECK_ACCESS(logger_ptr);
80758         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
80759         if (logger_conv.free == LDKLogger_JCalls_free) {
80760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80761                 LDKLogger_JCalls_cloned(&logger_conv);
80762         }
80763         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
80764         int64_t ret_ref = 0;
80765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80767         return ret_ref;
80768 }
80769
80770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
80771         LDKProbabilisticScorer this_arg_conv;
80772         this_arg_conv.inner = untag_ptr(this_arg);
80773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80775         this_arg_conv.is_owned = false;
80776         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
80777 }
80778
80779 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) {
80780         LDKProbabilisticScorer this_arg_conv;
80781         this_arg_conv.inner = untag_ptr(this_arg);
80782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80784         this_arg_conv.is_owned = false;
80785         LDKNodeId target_conv;
80786         target_conv.inner = untag_ptr(target);
80787         target_conv.is_owned = ptr_is_owned(target);
80788         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
80789         target_conv.is_owned = false;
80790         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
80791         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
80792         int64_t ret_ref = tag_ptr(ret_copy, true);
80793         return ret_ref;
80794 }
80795
80796 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) {
80797         LDKProbabilisticScorer this_arg_conv;
80798         this_arg_conv.inner = untag_ptr(this_arg);
80799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80801         this_arg_conv.is_owned = false;
80802         LDKNodeId target_conv;
80803         target_conv.inner = untag_ptr(target);
80804         target_conv.is_owned = ptr_is_owned(target);
80805         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
80806         target_conv.is_owned = false;
80807         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
80808         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
80809         int64_t ret_ref = tag_ptr(ret_copy, true);
80810         return ret_ref;
80811 }
80812
80813 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) {
80814         LDKProbabilisticScorer this_arg_conv;
80815         this_arg_conv.inner = untag_ptr(this_arg);
80816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80818         this_arg_conv.is_owned = false;
80819         LDKNodeId target_conv;
80820         target_conv.inner = untag_ptr(target);
80821         target_conv.is_owned = ptr_is_owned(target);
80822         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
80823         target_conv.is_owned = false;
80824         LDKProbabilisticScoringFeeParameters params_conv;
80825         params_conv.inner = untag_ptr(params);
80826         params_conv.is_owned = ptr_is_owned(params);
80827         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
80828         params_conv.is_owned = false;
80829         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
80830         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
80831         int64_t ret_ref = tag_ptr(ret_copy, true);
80832         return ret_ref;
80833 }
80834
80835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
80836         LDKProbabilisticScorer this_arg_conv;
80837         this_arg_conv.inner = untag_ptr(this_arg);
80838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80840         this_arg_conv.is_owned = false;
80841         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
80842         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
80843         return tag_ptr(ret_ret, true);
80844 }
80845
80846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
80847         LDKProbabilisticScorer this_arg_conv;
80848         this_arg_conv.inner = untag_ptr(this_arg);
80849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80851         this_arg_conv.is_owned = false;
80852         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
80853         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
80854         return tag_ptr(ret_ret, true);
80855 }
80856
80857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
80858         LDKProbabilisticScorer this_arg_conv;
80859         this_arg_conv.inner = untag_ptr(this_arg);
80860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80862         this_arg_conv.is_owned = false;
80863         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
80864         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
80865         return tag_ptr(ret_ret, true);
80866 }
80867
80868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
80869         LDKProbabilisticScorer obj_conv;
80870         obj_conv.inner = untag_ptr(obj);
80871         obj_conv.is_owned = ptr_is_owned(obj);
80872         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80873         obj_conv.is_owned = false;
80874         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
80875         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80876         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80877         CVec_u8Z_free(ret_var);
80878         return ret_arr;
80879 }
80880
80881 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) {
80882         LDKu8slice ser_ref;
80883         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
80884         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
80885         LDKProbabilisticScoringDecayParameters arg_a_conv;
80886         arg_a_conv.inner = untag_ptr(arg_a);
80887         arg_a_conv.is_owned = ptr_is_owned(arg_a);
80888         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
80889         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
80890         LDKNetworkGraph arg_b_conv;
80891         arg_b_conv.inner = untag_ptr(arg_b);
80892         arg_b_conv.is_owned = ptr_is_owned(arg_b);
80893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
80894         arg_b_conv.is_owned = false;
80895         void* arg_c_ptr = untag_ptr(arg_c);
80896         CHECK_ACCESS(arg_c_ptr);
80897         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
80898         if (arg_c_conv.free == LDKLogger_JCalls_free) {
80899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
80900                 LDKLogger_JCalls_cloned(&arg_c_conv);
80901         }
80902         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
80903         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
80904         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
80905         return tag_ptr(ret_conv, true);
80906 }
80907
80908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80909         LDKDelayedPaymentOutputDescriptor this_obj_conv;
80910         this_obj_conv.inner = untag_ptr(this_obj);
80911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80913         DelayedPaymentOutputDescriptor_free(this_obj_conv);
80914 }
80915
80916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
80917         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80918         this_ptr_conv.inner = untag_ptr(this_ptr);
80919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80921         this_ptr_conv.is_owned = false;
80922         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
80923         int64_t ret_ref = 0;
80924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80926         return ret_ref;
80927 }
80928
80929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80930         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80931         this_ptr_conv.inner = untag_ptr(this_ptr);
80932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80934         this_ptr_conv.is_owned = false;
80935         LDKOutPoint val_conv;
80936         val_conv.inner = untag_ptr(val);
80937         val_conv.is_owned = ptr_is_owned(val);
80938         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80939         val_conv = OutPoint_clone(&val_conv);
80940         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
80941 }
80942
80943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
80944         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80945         this_ptr_conv.inner = untag_ptr(this_ptr);
80946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80948         this_ptr_conv.is_owned = false;
80949         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
80950         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
80951         return ret_arr;
80952 }
80953
80954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80955         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80956         this_ptr_conv.inner = untag_ptr(this_ptr);
80957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80959         this_ptr_conv.is_owned = false;
80960         LDKPublicKey val_ref;
80961         CHECK((*env)->GetArrayLength(env, val) == 33);
80962         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
80963         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
80964 }
80965
80966 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
80967         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80968         this_ptr_conv.inner = untag_ptr(this_ptr);
80969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80971         this_ptr_conv.is_owned = false;
80972         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
80973         return ret_conv;
80974 }
80975
80976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
80977         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80978         this_ptr_conv.inner = untag_ptr(this_ptr);
80979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80981         this_ptr_conv.is_owned = false;
80982         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
80983 }
80984
80985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
80986         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80987         this_ptr_conv.inner = untag_ptr(this_ptr);
80988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80990         this_ptr_conv.is_owned = false;
80991         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80992         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
80993         return tag_ptr(ret_ref, true);
80994 }
80995
80996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80997         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
80998         this_ptr_conv.inner = untag_ptr(this_ptr);
80999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81001         this_ptr_conv.is_owned = false;
81002         void* val_ptr = untag_ptr(val);
81003         CHECK_ACCESS(val_ptr);
81004         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
81005         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
81006         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
81007 }
81008
81009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
81010         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81011         this_ptr_conv.inner = untag_ptr(this_ptr);
81012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81014         this_ptr_conv.is_owned = false;
81015         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
81016         int64_t ret_ref = 0;
81017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81019         return ret_ref;
81020 }
81021
81022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81023         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81024         this_ptr_conv.inner = untag_ptr(this_ptr);
81025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81027         this_ptr_conv.is_owned = false;
81028         LDKRevocationKey val_conv;
81029         val_conv.inner = untag_ptr(val);
81030         val_conv.is_owned = ptr_is_owned(val);
81031         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81032         val_conv = RevocationKey_clone(&val_conv);
81033         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
81034 }
81035
81036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
81037         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81038         this_ptr_conv.inner = untag_ptr(this_ptr);
81039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81041         this_ptr_conv.is_owned = false;
81042         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81043         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
81044         return ret_arr;
81045 }
81046
81047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
81048         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81049         this_ptr_conv.inner = untag_ptr(this_ptr);
81050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81052         this_ptr_conv.is_owned = false;
81053         LDKThirtyTwoBytes val_ref;
81054         CHECK((*env)->GetArrayLength(env, val) == 32);
81055         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
81056         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
81057 }
81058
81059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
81060         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81061         this_ptr_conv.inner = untag_ptr(this_ptr);
81062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81064         this_ptr_conv.is_owned = false;
81065         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
81066         return ret_conv;
81067 }
81068
81069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81070         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81071         this_ptr_conv.inner = untag_ptr(this_ptr);
81072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81074         this_ptr_conv.is_owned = false;
81075         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
81076 }
81077
81078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
81079         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81080         this_ptr_conv.inner = untag_ptr(this_ptr);
81081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81083         this_ptr_conv.is_owned = false;
81084         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
81085         int64_t ret_ref = 0;
81086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81088         return ret_ref;
81089 }
81090
81091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81092         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
81093         this_ptr_conv.inner = untag_ptr(this_ptr);
81094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81096         this_ptr_conv.is_owned = false;
81097         LDKChannelTransactionParameters val_conv;
81098         val_conv.inner = untag_ptr(val);
81099         val_conv.is_owned = ptr_is_owned(val);
81100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81101         val_conv = ChannelTransactionParameters_clone(&val_conv);
81102         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
81103 }
81104
81105 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, int64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, int64_t channel_transaction_parameters_arg) {
81106         LDKOutPoint outpoint_arg_conv;
81107         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
81108         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
81109         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
81110         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
81111         LDKPublicKey per_commitment_point_arg_ref;
81112         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
81113         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
81114         void* output_arg_ptr = untag_ptr(output_arg);
81115         CHECK_ACCESS(output_arg_ptr);
81116         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
81117         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
81118         LDKRevocationKey revocation_pubkey_arg_conv;
81119         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
81120         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
81121         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
81122         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
81123         LDKThirtyTwoBytes channel_keys_id_arg_ref;
81124         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
81125         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
81126         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
81127         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
81128         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
81129         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
81130         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
81131         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
81132         int64_t ret_ref = 0;
81133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81135         return ret_ref;
81136 }
81137
81138 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
81139         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
81140         int64_t ret_ref = 0;
81141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81143         return ret_ref;
81144 }
81145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81146         LDKDelayedPaymentOutputDescriptor arg_conv;
81147         arg_conv.inner = untag_ptr(arg);
81148         arg_conv.is_owned = ptr_is_owned(arg);
81149         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81150         arg_conv.is_owned = false;
81151         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
81152         return ret_conv;
81153 }
81154
81155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81156         LDKDelayedPaymentOutputDescriptor orig_conv;
81157         orig_conv.inner = untag_ptr(orig);
81158         orig_conv.is_owned = ptr_is_owned(orig);
81159         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81160         orig_conv.is_owned = false;
81161         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
81162         int64_t ret_ref = 0;
81163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81165         return ret_ref;
81166 }
81167
81168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
81169         LDKDelayedPaymentOutputDescriptor o_conv;
81170         o_conv.inner = untag_ptr(o);
81171         o_conv.is_owned = ptr_is_owned(o);
81172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81173         o_conv.is_owned = false;
81174         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
81175         return ret_conv;
81176 }
81177
81178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81179         LDKDelayedPaymentOutputDescriptor a_conv;
81180         a_conv.inner = untag_ptr(a);
81181         a_conv.is_owned = ptr_is_owned(a);
81182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81183         a_conv.is_owned = false;
81184         LDKDelayedPaymentOutputDescriptor b_conv;
81185         b_conv.inner = untag_ptr(b);
81186         b_conv.is_owned = ptr_is_owned(b);
81187         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81188         b_conv.is_owned = false;
81189         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
81190         return ret_conv;
81191 }
81192
81193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
81194         LDKDelayedPaymentOutputDescriptor obj_conv;
81195         obj_conv.inner = untag_ptr(obj);
81196         obj_conv.is_owned = ptr_is_owned(obj);
81197         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
81198         obj_conv.is_owned = false;
81199         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
81200         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
81201         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
81202         CVec_u8Z_free(ret_var);
81203         return ret_arr;
81204 }
81205
81206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
81207         LDKu8slice ser_ref;
81208         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
81209         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
81210         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
81211         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
81212         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
81213         return tag_ptr(ret_conv, true);
81214 }
81215
81216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81217         LDKStaticPaymentOutputDescriptor this_obj_conv;
81218         this_obj_conv.inner = untag_ptr(this_obj);
81219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81221         StaticPaymentOutputDescriptor_free(this_obj_conv);
81222 }
81223
81224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
81225         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81226         this_ptr_conv.inner = untag_ptr(this_ptr);
81227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81229         this_ptr_conv.is_owned = false;
81230         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
81231         int64_t ret_ref = 0;
81232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81234         return ret_ref;
81235 }
81236
81237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81238         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81239         this_ptr_conv.inner = untag_ptr(this_ptr);
81240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81242         this_ptr_conv.is_owned = false;
81243         LDKOutPoint val_conv;
81244         val_conv.inner = untag_ptr(val);
81245         val_conv.is_owned = ptr_is_owned(val);
81246         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81247         val_conv = OutPoint_clone(&val_conv);
81248         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
81249 }
81250
81251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
81252         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81253         this_ptr_conv.inner = untag_ptr(this_ptr);
81254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81256         this_ptr_conv.is_owned = false;
81257         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
81258         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
81259         return tag_ptr(ret_ref, true);
81260 }
81261
81262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81263         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81264         this_ptr_conv.inner = untag_ptr(this_ptr);
81265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81267         this_ptr_conv.is_owned = false;
81268         void* val_ptr = untag_ptr(val);
81269         CHECK_ACCESS(val_ptr);
81270         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
81271         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
81272         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
81273 }
81274
81275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
81276         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81277         this_ptr_conv.inner = untag_ptr(this_ptr);
81278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81280         this_ptr_conv.is_owned = false;
81281         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81282         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
81283         return ret_arr;
81284 }
81285
81286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
81287         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81288         this_ptr_conv.inner = untag_ptr(this_ptr);
81289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81291         this_ptr_conv.is_owned = false;
81292         LDKThirtyTwoBytes val_ref;
81293         CHECK((*env)->GetArrayLength(env, val) == 32);
81294         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
81295         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
81296 }
81297
81298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
81299         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81300         this_ptr_conv.inner = untag_ptr(this_ptr);
81301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81303         this_ptr_conv.is_owned = false;
81304         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
81305         return ret_conv;
81306 }
81307
81308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81309         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81310         this_ptr_conv.inner = untag_ptr(this_ptr);
81311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81313         this_ptr_conv.is_owned = false;
81314         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
81315 }
81316
81317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
81318         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81319         this_ptr_conv.inner = untag_ptr(this_ptr);
81320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81322         this_ptr_conv.is_owned = false;
81323         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
81324         int64_t ret_ref = 0;
81325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81327         return ret_ref;
81328 }
81329
81330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81331         LDKStaticPaymentOutputDescriptor this_ptr_conv;
81332         this_ptr_conv.inner = untag_ptr(this_ptr);
81333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81335         this_ptr_conv.is_owned = false;
81336         LDKChannelTransactionParameters val_conv;
81337         val_conv.inner = untag_ptr(val);
81338         val_conv.is_owned = ptr_is_owned(val);
81339         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81340         val_conv = ChannelTransactionParameters_clone(&val_conv);
81341         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
81342 }
81343
81344 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) {
81345         LDKOutPoint outpoint_arg_conv;
81346         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
81347         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
81348         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
81349         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
81350         void* output_arg_ptr = untag_ptr(output_arg);
81351         CHECK_ACCESS(output_arg_ptr);
81352         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
81353         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
81354         LDKThirtyTwoBytes channel_keys_id_arg_ref;
81355         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
81356         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
81357         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
81358         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
81359         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
81360         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
81361         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
81362         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);
81363         int64_t ret_ref = 0;
81364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81366         return ret_ref;
81367 }
81368
81369 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
81370         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
81371         int64_t ret_ref = 0;
81372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81374         return ret_ref;
81375 }
81376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81377         LDKStaticPaymentOutputDescriptor arg_conv;
81378         arg_conv.inner = untag_ptr(arg);
81379         arg_conv.is_owned = ptr_is_owned(arg);
81380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81381         arg_conv.is_owned = false;
81382         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
81383         return ret_conv;
81384 }
81385
81386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81387         LDKStaticPaymentOutputDescriptor orig_conv;
81388         orig_conv.inner = untag_ptr(orig);
81389         orig_conv.is_owned = ptr_is_owned(orig);
81390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81391         orig_conv.is_owned = false;
81392         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
81393         int64_t ret_ref = 0;
81394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81396         return ret_ref;
81397 }
81398
81399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
81400         LDKStaticPaymentOutputDescriptor o_conv;
81401         o_conv.inner = untag_ptr(o);
81402         o_conv.is_owned = ptr_is_owned(o);
81403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81404         o_conv.is_owned = false;
81405         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
81406         return ret_conv;
81407 }
81408
81409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81410         LDKStaticPaymentOutputDescriptor a_conv;
81411         a_conv.inner = untag_ptr(a);
81412         a_conv.is_owned = ptr_is_owned(a);
81413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81414         a_conv.is_owned = false;
81415         LDKStaticPaymentOutputDescriptor b_conv;
81416         b_conv.inner = untag_ptr(b);
81417         b_conv.is_owned = ptr_is_owned(b);
81418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81419         b_conv.is_owned = false;
81420         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
81421         return ret_conv;
81422 }
81423
81424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
81425         LDKStaticPaymentOutputDescriptor this_arg_conv;
81426         this_arg_conv.inner = untag_ptr(this_arg);
81427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81429         this_arg_conv.is_owned = false;
81430         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
81431         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
81432         int64_t ret_ref = tag_ptr(ret_copy, true);
81433         return ret_ref;
81434 }
81435
81436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
81437         LDKStaticPaymentOutputDescriptor this_arg_conv;
81438         this_arg_conv.inner = untag_ptr(this_arg);
81439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81441         this_arg_conv.is_owned = false;
81442         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
81443         return ret_conv;
81444 }
81445
81446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
81447         LDKStaticPaymentOutputDescriptor obj_conv;
81448         obj_conv.inner = untag_ptr(obj);
81449         obj_conv.is_owned = ptr_is_owned(obj);
81450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
81451         obj_conv.is_owned = false;
81452         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
81453         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
81454         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
81455         CVec_u8Z_free(ret_var);
81456         return ret_arr;
81457 }
81458
81459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
81460         LDKu8slice ser_ref;
81461         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
81462         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
81463         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
81464         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
81465         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
81466         return tag_ptr(ret_conv, true);
81467 }
81468
81469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81470         if (!ptr_is_owned(this_ptr)) return;
81471         void* this_ptr_ptr = untag_ptr(this_ptr);
81472         CHECK_ACCESS(this_ptr_ptr);
81473         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
81474         FREE(untag_ptr(this_ptr));
81475         SpendableOutputDescriptor_free(this_ptr_conv);
81476 }
81477
81478 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
81479         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
81480         *ret_copy = SpendableOutputDescriptor_clone(arg);
81481         int64_t ret_ref = tag_ptr(ret_copy, true);
81482         return ret_ref;
81483 }
81484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81485         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
81486         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
81487         return ret_conv;
81488 }
81489
81490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81491         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
81492         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
81493         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
81494         int64_t ret_ref = tag_ptr(ret_copy, true);
81495         return ret_ref;
81496 }
81497
81498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
81499         LDKOutPoint outpoint_conv;
81500         outpoint_conv.inner = untag_ptr(outpoint);
81501         outpoint_conv.is_owned = ptr_is_owned(outpoint);
81502         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
81503         outpoint_conv = OutPoint_clone(&outpoint_conv);
81504         void* output_ptr = untag_ptr(output);
81505         CHECK_ACCESS(output_ptr);
81506         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
81507         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
81508         LDKThirtyTwoBytes channel_keys_id_ref;
81509         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
81510         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
81511         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
81512         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
81513         int64_t ret_ref = tag_ptr(ret_copy, true);
81514         return ret_ref;
81515 }
81516
81517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
81518         LDKDelayedPaymentOutputDescriptor a_conv;
81519         a_conv.inner = untag_ptr(a);
81520         a_conv.is_owned = ptr_is_owned(a);
81521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81522         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
81523         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
81524         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
81525         int64_t ret_ref = tag_ptr(ret_copy, true);
81526         return ret_ref;
81527 }
81528
81529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
81530         LDKStaticPaymentOutputDescriptor a_conv;
81531         a_conv.inner = untag_ptr(a);
81532         a_conv.is_owned = ptr_is_owned(a);
81533         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81534         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
81535         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
81536         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
81537         int64_t ret_ref = tag_ptr(ret_copy, true);
81538         return ret_ref;
81539 }
81540
81541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
81542         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
81543         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
81544         return ret_conv;
81545 }
81546
81547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81548         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
81549         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
81550         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
81551         return ret_conv;
81552 }
81553
81554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
81555         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
81556         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
81557         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
81558         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
81559         CVec_u8Z_free(ret_var);
81560         return ret_arr;
81561 }
81562
81563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
81564         LDKu8slice ser_ref;
81565         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
81566         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
81567         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
81568         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
81569         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
81570         return tag_ptr(ret_conv, true);
81571 }
81572
81573 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) {
81574         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
81575         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
81576         if (descriptors_constr.datalen > 0)
81577                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
81578         else
81579                 descriptors_constr.data = NULL;
81580         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
81581         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
81582                 int64_t descriptors_conv_27 = descriptors_vals[b];
81583                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
81584                 CHECK_ACCESS(descriptors_conv_27_ptr);
81585                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
81586                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
81587                 descriptors_constr.data[b] = descriptors_conv_27_conv;
81588         }
81589         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
81590         LDKCVec_TxOutZ outputs_constr;
81591         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
81592         if (outputs_constr.datalen > 0)
81593                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
81594         else
81595                 outputs_constr.data = NULL;
81596         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
81597         for (size_t h = 0; h < outputs_constr.datalen; h++) {
81598                 int64_t outputs_conv_7 = outputs_vals[h];
81599                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
81600                 CHECK_ACCESS(outputs_conv_7_ptr);
81601                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
81602                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
81603                 outputs_constr.data[h] = outputs_conv_7_conv;
81604         }
81605         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
81606         LDKCVec_u8Z change_destination_script_ref;
81607         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
81608         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
81609         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
81610         void* locktime_ptr = untag_ptr(locktime);
81611         CHECK_ACCESS(locktime_ptr);
81612         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
81613         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
81614         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
81615         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
81616         return tag_ptr(ret_conv, true);
81617 }
81618
81619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81620         LDKChannelDerivationParameters this_obj_conv;
81621         this_obj_conv.inner = untag_ptr(this_obj);
81622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81624         ChannelDerivationParameters_free(this_obj_conv);
81625 }
81626
81627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
81628         LDKChannelDerivationParameters this_ptr_conv;
81629         this_ptr_conv.inner = untag_ptr(this_ptr);
81630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81632         this_ptr_conv.is_owned = false;
81633         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
81634         return ret_conv;
81635 }
81636
81637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81638         LDKChannelDerivationParameters this_ptr_conv;
81639         this_ptr_conv.inner = untag_ptr(this_ptr);
81640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81642         this_ptr_conv.is_owned = false;
81643         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
81644 }
81645
81646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
81647         LDKChannelDerivationParameters this_ptr_conv;
81648         this_ptr_conv.inner = untag_ptr(this_ptr);
81649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81651         this_ptr_conv.is_owned = false;
81652         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81653         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
81654         return ret_arr;
81655 }
81656
81657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
81658         LDKChannelDerivationParameters this_ptr_conv;
81659         this_ptr_conv.inner = untag_ptr(this_ptr);
81660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81662         this_ptr_conv.is_owned = false;
81663         LDKThirtyTwoBytes val_ref;
81664         CHECK((*env)->GetArrayLength(env, val) == 32);
81665         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
81666         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
81667 }
81668
81669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
81670         LDKChannelDerivationParameters this_ptr_conv;
81671         this_ptr_conv.inner = untag_ptr(this_ptr);
81672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81674         this_ptr_conv.is_owned = false;
81675         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
81676         int64_t ret_ref = 0;
81677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81679         return ret_ref;
81680 }
81681
81682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81683         LDKChannelDerivationParameters this_ptr_conv;
81684         this_ptr_conv.inner = untag_ptr(this_ptr);
81685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81687         this_ptr_conv.is_owned = false;
81688         LDKChannelTransactionParameters val_conv;
81689         val_conv.inner = untag_ptr(val);
81690         val_conv.is_owned = ptr_is_owned(val);
81691         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81692         val_conv = ChannelTransactionParameters_clone(&val_conv);
81693         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
81694 }
81695
81696 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) {
81697         LDKThirtyTwoBytes keys_id_arg_ref;
81698         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
81699         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
81700         LDKChannelTransactionParameters transaction_parameters_arg_conv;
81701         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
81702         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
81703         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
81704         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
81705         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
81706         int64_t ret_ref = 0;
81707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81709         return ret_ref;
81710 }
81711
81712 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
81713         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
81714         int64_t ret_ref = 0;
81715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81717         return ret_ref;
81718 }
81719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81720         LDKChannelDerivationParameters arg_conv;
81721         arg_conv.inner = untag_ptr(arg);
81722         arg_conv.is_owned = ptr_is_owned(arg);
81723         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81724         arg_conv.is_owned = false;
81725         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
81726         return ret_conv;
81727 }
81728
81729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81730         LDKChannelDerivationParameters orig_conv;
81731         orig_conv.inner = untag_ptr(orig);
81732         orig_conv.is_owned = ptr_is_owned(orig);
81733         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81734         orig_conv.is_owned = false;
81735         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
81736         int64_t ret_ref = 0;
81737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81739         return ret_ref;
81740 }
81741
81742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81743         LDKChannelDerivationParameters a_conv;
81744         a_conv.inner = untag_ptr(a);
81745         a_conv.is_owned = ptr_is_owned(a);
81746         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81747         a_conv.is_owned = false;
81748         LDKChannelDerivationParameters b_conv;
81749         b_conv.inner = untag_ptr(b);
81750         b_conv.is_owned = ptr_is_owned(b);
81751         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81752         b_conv.is_owned = false;
81753         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
81754         return ret_conv;
81755 }
81756
81757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
81758         LDKChannelDerivationParameters obj_conv;
81759         obj_conv.inner = untag_ptr(obj);
81760         obj_conv.is_owned = ptr_is_owned(obj);
81761         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
81762         obj_conv.is_owned = false;
81763         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
81764         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
81765         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
81766         CVec_u8Z_free(ret_var);
81767         return ret_arr;
81768 }
81769
81770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
81771         LDKu8slice ser_ref;
81772         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
81773         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
81774         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
81775         *ret_conv = ChannelDerivationParameters_read(ser_ref);
81776         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
81777         return tag_ptr(ret_conv, true);
81778 }
81779
81780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81781         LDKHTLCDescriptor this_obj_conv;
81782         this_obj_conv.inner = untag_ptr(this_obj);
81783         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81785         HTLCDescriptor_free(this_obj_conv);
81786 }
81787
81788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
81789         LDKHTLCDescriptor this_ptr_conv;
81790         this_ptr_conv.inner = untag_ptr(this_ptr);
81791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81793         this_ptr_conv.is_owned = false;
81794         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
81795         int64_t ret_ref = 0;
81796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81798         return ret_ref;
81799 }
81800
81801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81802         LDKHTLCDescriptor this_ptr_conv;
81803         this_ptr_conv.inner = untag_ptr(this_ptr);
81804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81806         this_ptr_conv.is_owned = false;
81807         LDKChannelDerivationParameters val_conv;
81808         val_conv.inner = untag_ptr(val);
81809         val_conv.is_owned = ptr_is_owned(val);
81810         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81811         val_conv = ChannelDerivationParameters_clone(&val_conv);
81812         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
81813 }
81814
81815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1commitment_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
81816         LDKHTLCDescriptor this_ptr_conv;
81817         this_ptr_conv.inner = untag_ptr(this_ptr);
81818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81820         this_ptr_conv.is_owned = false;
81821         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81822         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv));
81823         return ret_arr;
81824 }
81825
81826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1commitment_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
81827         LDKHTLCDescriptor this_ptr_conv;
81828         this_ptr_conv.inner = untag_ptr(this_ptr);
81829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81831         this_ptr_conv.is_owned = false;
81832         LDKThirtyTwoBytes val_ref;
81833         CHECK((*env)->GetArrayLength(env, val) == 32);
81834         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
81835         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
81836 }
81837
81838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
81839         LDKHTLCDescriptor this_ptr_conv;
81840         this_ptr_conv.inner = untag_ptr(this_ptr);
81841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81843         this_ptr_conv.is_owned = false;
81844         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
81845         return ret_conv;
81846 }
81847
81848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81849         LDKHTLCDescriptor this_ptr_conv;
81850         this_ptr_conv.inner = untag_ptr(this_ptr);
81851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81853         this_ptr_conv.is_owned = false;
81854         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
81855 }
81856
81857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
81858         LDKHTLCDescriptor this_ptr_conv;
81859         this_ptr_conv.inner = untag_ptr(this_ptr);
81860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81862         this_ptr_conv.is_owned = false;
81863         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81864         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
81865         return ret_arr;
81866 }
81867
81868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
81869         LDKHTLCDescriptor this_ptr_conv;
81870         this_ptr_conv.inner = untag_ptr(this_ptr);
81871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81873         this_ptr_conv.is_owned = false;
81874         LDKPublicKey val_ref;
81875         CHECK((*env)->GetArrayLength(env, val) == 33);
81876         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
81877         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
81878 }
81879
81880 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
81881         LDKHTLCDescriptor this_ptr_conv;
81882         this_ptr_conv.inner = untag_ptr(this_ptr);
81883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81885         this_ptr_conv.is_owned = false;
81886         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
81887         return ret_conv;
81888 }
81889
81890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
81891         LDKHTLCDescriptor this_ptr_conv;
81892         this_ptr_conv.inner = untag_ptr(this_ptr);
81893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81895         this_ptr_conv.is_owned = false;
81896         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
81897 }
81898
81899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
81900         LDKHTLCDescriptor this_ptr_conv;
81901         this_ptr_conv.inner = untag_ptr(this_ptr);
81902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81904         this_ptr_conv.is_owned = false;
81905         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
81906         int64_t ret_ref = 0;
81907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81909         return ret_ref;
81910 }
81911
81912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81913         LDKHTLCDescriptor this_ptr_conv;
81914         this_ptr_conv.inner = untag_ptr(this_ptr);
81915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81917         this_ptr_conv.is_owned = false;
81918         LDKHTLCOutputInCommitment val_conv;
81919         val_conv.inner = untag_ptr(val);
81920         val_conv.is_owned = ptr_is_owned(val);
81921         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81922         val_conv = HTLCOutputInCommitment_clone(&val_conv);
81923         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
81924 }
81925
81926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
81927         LDKHTLCDescriptor this_ptr_conv;
81928         this_ptr_conv.inner = untag_ptr(this_ptr);
81929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81931         this_ptr_conv.is_owned = false;
81932         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
81933         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
81934         int64_t ret_ref = tag_ptr(ret_copy, true);
81935         return ret_ref;
81936 }
81937
81938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81939         LDKHTLCDescriptor this_ptr_conv;
81940         this_ptr_conv.inner = untag_ptr(this_ptr);
81941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81943         this_ptr_conv.is_owned = false;
81944         void* val_ptr = untag_ptr(val);
81945         CHECK_ACCESS(val_ptr);
81946         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
81947         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
81948         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
81949 }
81950
81951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
81952         LDKHTLCDescriptor this_ptr_conv;
81953         this_ptr_conv.inner = untag_ptr(this_ptr);
81954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81956         this_ptr_conv.is_owned = false;
81957         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
81958         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
81959         return ret_arr;
81960 }
81961
81962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
81963         LDKHTLCDescriptor this_ptr_conv;
81964         this_ptr_conv.inner = untag_ptr(this_ptr);
81965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81967         this_ptr_conv.is_owned = false;
81968         LDKECDSASignature val_ref;
81969         CHECK((*env)->GetArrayLength(env, val) == 64);
81970         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
81971         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
81972 }
81973
81974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1new(JNIEnv *env, jclass clz, int64_t channel_derivation_parameters_arg, int8_tArray commitment_txid_arg, int64_t per_commitment_number_arg, int8_tArray per_commitment_point_arg, int32_t feerate_per_kw_arg, int64_t htlc_arg, int64_t preimage_arg, int8_tArray counterparty_sig_arg) {
81975         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
81976         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
81977         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
81978         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
81979         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
81980         LDKThirtyTwoBytes commitment_txid_arg_ref;
81981         CHECK((*env)->GetArrayLength(env, commitment_txid_arg) == 32);
81982         (*env)->GetByteArrayRegion(env, commitment_txid_arg, 0, 32, commitment_txid_arg_ref.data);
81983         LDKPublicKey per_commitment_point_arg_ref;
81984         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
81985         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
81986         LDKHTLCOutputInCommitment htlc_arg_conv;
81987         htlc_arg_conv.inner = untag_ptr(htlc_arg);
81988         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
81989         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
81990         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
81991         void* preimage_arg_ptr = untag_ptr(preimage_arg);
81992         CHECK_ACCESS(preimage_arg_ptr);
81993         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
81994         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
81995         LDKECDSASignature counterparty_sig_arg_ref;
81996         CHECK((*env)->GetArrayLength(env, counterparty_sig_arg) == 64);
81997         (*env)->GetByteArrayRegion(env, counterparty_sig_arg, 0, 64, counterparty_sig_arg_ref.compact_form);
81998         LDKHTLCDescriptor ret_var = HTLCDescriptor_new(channel_derivation_parameters_arg_conv, commitment_txid_arg_ref, per_commitment_number_arg, per_commitment_point_arg_ref, feerate_per_kw_arg, htlc_arg_conv, preimage_arg_conv, counterparty_sig_arg_ref);
81999         int64_t ret_ref = 0;
82000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82002         return ret_ref;
82003 }
82004
82005 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
82006         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
82007         int64_t ret_ref = 0;
82008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82010         return ret_ref;
82011 }
82012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82013         LDKHTLCDescriptor arg_conv;
82014         arg_conv.inner = untag_ptr(arg);
82015         arg_conv.is_owned = ptr_is_owned(arg);
82016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82017         arg_conv.is_owned = false;
82018         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
82019         return ret_conv;
82020 }
82021
82022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82023         LDKHTLCDescriptor orig_conv;
82024         orig_conv.inner = untag_ptr(orig);
82025         orig_conv.is_owned = ptr_is_owned(orig);
82026         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82027         orig_conv.is_owned = false;
82028         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
82029         int64_t ret_ref = 0;
82030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82032         return ret_ref;
82033 }
82034
82035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82036         LDKHTLCDescriptor a_conv;
82037         a_conv.inner = untag_ptr(a);
82038         a_conv.is_owned = ptr_is_owned(a);
82039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82040         a_conv.is_owned = false;
82041         LDKHTLCDescriptor b_conv;
82042         b_conv.inner = untag_ptr(b);
82043         b_conv.is_owned = ptr_is_owned(b);
82044         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82045         b_conv.is_owned = false;
82046         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
82047         return ret_conv;
82048 }
82049
82050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
82051         LDKHTLCDescriptor obj_conv;
82052         obj_conv.inner = untag_ptr(obj);
82053         obj_conv.is_owned = ptr_is_owned(obj);
82054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
82055         obj_conv.is_owned = false;
82056         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
82057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82059         CVec_u8Z_free(ret_var);
82060         return ret_arr;
82061 }
82062
82063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
82064         LDKu8slice ser_ref;
82065         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
82066         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
82067         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
82068         *ret_conv = HTLCDescriptor_read(ser_ref);
82069         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
82070         return tag_ptr(ret_conv, true);
82071 }
82072
82073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
82074         LDKHTLCDescriptor this_arg_conv;
82075         this_arg_conv.inner = untag_ptr(this_arg);
82076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82078         this_arg_conv.is_owned = false;
82079         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
82080         int64_t ret_ref = 0;
82081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82083         return ret_ref;
82084 }
82085
82086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
82087         LDKHTLCDescriptor this_arg_conv;
82088         this_arg_conv.inner = untag_ptr(this_arg);
82089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82091         this_arg_conv.is_owned = false;
82092         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
82093         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
82094         return tag_ptr(ret_ref, true);
82095 }
82096
82097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
82098         LDKHTLCDescriptor this_arg_conv;
82099         this_arg_conv.inner = untag_ptr(this_arg);
82100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82102         this_arg_conv.is_owned = false;
82103         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
82104         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
82105         return tag_ptr(ret_ref, true);
82106 }
82107
82108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
82109         LDKHTLCDescriptor this_arg_conv;
82110         this_arg_conv.inner = untag_ptr(this_arg);
82111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82113         this_arg_conv.is_owned = false;
82114         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
82115         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
82116         return tag_ptr(ret_ref, true);
82117 }
82118
82119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
82120         LDKHTLCDescriptor this_arg_conv;
82121         this_arg_conv.inner = untag_ptr(this_arg);
82122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82124         this_arg_conv.is_owned = false;
82125         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
82126         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82127         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82128         CVec_u8Z_free(ret_var);
82129         return ret_arr;
82130 }
82131
82132 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) {
82133         LDKHTLCDescriptor this_arg_conv;
82134         this_arg_conv.inner = untag_ptr(this_arg);
82135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82137         this_arg_conv.is_owned = false;
82138         LDKECDSASignature signature_ref;
82139         CHECK((*env)->GetArrayLength(env, signature) == 64);
82140         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
82141         LDKu8slice witness_script_ref;
82142         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
82143         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
82144         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
82145         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82146         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82147         Witness_free(ret_var);
82148         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
82149         return ret_arr;
82150 }
82151
82152 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) {
82153         LDKHTLCDescriptor this_arg_conv;
82154         this_arg_conv.inner = untag_ptr(this_arg);
82155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82157         this_arg_conv.is_owned = false;
82158         void* signer_provider_ptr = untag_ptr(signer_provider);
82159         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
82160         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
82161         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
82162         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
82163         return tag_ptr(ret_ret, true);
82164 }
82165
82166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82167         if (!ptr_is_owned(this_ptr)) return;
82168         void* this_ptr_ptr = untag_ptr(this_ptr);
82169         CHECK_ACCESS(this_ptr_ptr);
82170         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
82171         FREE(untag_ptr(this_ptr));
82172         ChannelSigner_free(this_ptr_conv);
82173 }
82174
82175 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82176         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
82177         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
82178         return ret_conv;
82179 }
82180
82181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
82182         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
82183         return ret_conv;
82184 }
82185
82186 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
82187         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
82188         return ret_conv;
82189 }
82190
82191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82192         if (!ptr_is_owned(this_ptr)) return;
82193         void* this_ptr_ptr = untag_ptr(this_ptr);
82194         CHECK_ACCESS(this_ptr_ptr);
82195         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
82196         FREE(untag_ptr(this_ptr));
82197         EntropySource_free(this_ptr_conv);
82198 }
82199
82200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82201         if (!ptr_is_owned(this_ptr)) return;
82202         void* this_ptr_ptr = untag_ptr(this_ptr);
82203         CHECK_ACCESS(this_ptr_ptr);
82204         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
82205         FREE(untag_ptr(this_ptr));
82206         NodeSigner_free(this_ptr_conv);
82207 }
82208
82209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSpender_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82210         if (!ptr_is_owned(this_ptr)) return;
82211         void* this_ptr_ptr = untag_ptr(this_ptr);
82212         CHECK_ACCESS(this_ptr_ptr);
82213         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
82214         FREE(untag_ptr(this_ptr));
82215         OutputSpender_free(this_ptr_conv);
82216 }
82217
82218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82219         if (!ptr_is_owned(this_ptr)) return;
82220         void* this_ptr_ptr = untag_ptr(this_ptr);
82221         CHECK_ACCESS(this_ptr_ptr);
82222         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
82223         FREE(untag_ptr(this_ptr));
82224         SignerProvider_free(this_ptr_conv);
82225 }
82226
82227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChangeDestinationSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82228         if (!ptr_is_owned(this_ptr)) return;
82229         void* this_ptr_ptr = untag_ptr(this_ptr);
82230         CHECK_ACCESS(this_ptr_ptr);
82231         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
82232         FREE(untag_ptr(this_ptr));
82233         ChangeDestinationSource_free(this_ptr_conv);
82234 }
82235
82236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82237         LDKInMemorySigner this_obj_conv;
82238         this_obj_conv.inner = untag_ptr(this_obj);
82239         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82241         InMemorySigner_free(this_obj_conv);
82242 }
82243
82244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82245         LDKInMemorySigner this_ptr_conv;
82246         this_ptr_conv.inner = untag_ptr(this_ptr);
82247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82249         this_ptr_conv.is_owned = false;
82250         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82251         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
82252         return ret_arr;
82253 }
82254
82255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82256         LDKInMemorySigner this_ptr_conv;
82257         this_ptr_conv.inner = untag_ptr(this_ptr);
82258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82260         this_ptr_conv.is_owned = false;
82261         LDKSecretKey val_ref;
82262         CHECK((*env)->GetArrayLength(env, val) == 32);
82263         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
82264         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
82265 }
82266
82267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82268         LDKInMemorySigner this_ptr_conv;
82269         this_ptr_conv.inner = untag_ptr(this_ptr);
82270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82272         this_ptr_conv.is_owned = false;
82273         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82274         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
82275         return ret_arr;
82276 }
82277
82278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82279         LDKInMemorySigner this_ptr_conv;
82280         this_ptr_conv.inner = untag_ptr(this_ptr);
82281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82283         this_ptr_conv.is_owned = false;
82284         LDKSecretKey val_ref;
82285         CHECK((*env)->GetArrayLength(env, val) == 32);
82286         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
82287         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
82288 }
82289
82290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82291         LDKInMemorySigner this_ptr_conv;
82292         this_ptr_conv.inner = untag_ptr(this_ptr);
82293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82295         this_ptr_conv.is_owned = false;
82296         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82297         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
82298         return ret_arr;
82299 }
82300
82301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82302         LDKInMemorySigner this_ptr_conv;
82303         this_ptr_conv.inner = untag_ptr(this_ptr);
82304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82306         this_ptr_conv.is_owned = false;
82307         LDKSecretKey val_ref;
82308         CHECK((*env)->GetArrayLength(env, val) == 32);
82309         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
82310         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
82311 }
82312
82313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82314         LDKInMemorySigner this_ptr_conv;
82315         this_ptr_conv.inner = untag_ptr(this_ptr);
82316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82318         this_ptr_conv.is_owned = false;
82319         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
82321         return ret_arr;
82322 }
82323
82324 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) {
82325         LDKInMemorySigner this_ptr_conv;
82326         this_ptr_conv.inner = untag_ptr(this_ptr);
82327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82329         this_ptr_conv.is_owned = false;
82330         LDKSecretKey val_ref;
82331         CHECK((*env)->GetArrayLength(env, val) == 32);
82332         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
82333         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
82334 }
82335
82336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82337         LDKInMemorySigner this_ptr_conv;
82338         this_ptr_conv.inner = untag_ptr(this_ptr);
82339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82341         this_ptr_conv.is_owned = false;
82342         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82343         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
82344         return ret_arr;
82345 }
82346
82347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82348         LDKInMemorySigner this_ptr_conv;
82349         this_ptr_conv.inner = untag_ptr(this_ptr);
82350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82352         this_ptr_conv.is_owned = false;
82353         LDKSecretKey val_ref;
82354         CHECK((*env)->GetArrayLength(env, val) == 32);
82355         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
82356         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
82357 }
82358
82359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
82360         LDKInMemorySigner this_ptr_conv;
82361         this_ptr_conv.inner = untag_ptr(this_ptr);
82362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82364         this_ptr_conv.is_owned = false;
82365         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82366         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
82367         return ret_arr;
82368 }
82369
82370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82371         LDKInMemorySigner this_ptr_conv;
82372         this_ptr_conv.inner = untag_ptr(this_ptr);
82373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82375         this_ptr_conv.is_owned = false;
82376         LDKThirtyTwoBytes val_ref;
82377         CHECK((*env)->GetArrayLength(env, val) == 32);
82378         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
82379         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
82380 }
82381
82382 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
82383         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
82384         int64_t ret_ref = 0;
82385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82387         return ret_ref;
82388 }
82389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82390         LDKInMemorySigner arg_conv;
82391         arg_conv.inner = untag_ptr(arg);
82392         arg_conv.is_owned = ptr_is_owned(arg);
82393         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82394         arg_conv.is_owned = false;
82395         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
82396         return ret_conv;
82397 }
82398
82399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82400         LDKInMemorySigner orig_conv;
82401         orig_conv.inner = untag_ptr(orig);
82402         orig_conv.is_owned = ptr_is_owned(orig);
82403         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82404         orig_conv.is_owned = false;
82405         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
82406         int64_t ret_ref = 0;
82407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82409         return ret_ref;
82410 }
82411
82412 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) {
82413         LDKSecretKey funding_key_ref;
82414         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
82415         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
82416         LDKSecretKey revocation_base_key_ref;
82417         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
82418         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
82419         LDKSecretKey payment_key_ref;
82420         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
82421         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
82422         LDKSecretKey delayed_payment_base_key_ref;
82423         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
82424         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
82425         LDKSecretKey htlc_base_key_ref;
82426         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
82427         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
82428         LDKThirtyTwoBytes commitment_seed_ref;
82429         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
82430         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
82431         LDKThirtyTwoBytes channel_keys_id_ref;
82432         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
82433         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
82434         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
82435         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
82436         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
82437         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);
82438         int64_t ret_ref = 0;
82439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82441         return ret_ref;
82442 }
82443
82444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
82445         LDKInMemorySigner this_arg_conv;
82446         this_arg_conv.inner = untag_ptr(this_arg);
82447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82449         this_arg_conv.is_owned = false;
82450         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
82451         int64_t ret_ref = 0;
82452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82454         return ret_ref;
82455 }
82456
82457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
82458         LDKInMemorySigner this_arg_conv;
82459         this_arg_conv.inner = untag_ptr(this_arg);
82460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82462         this_arg_conv.is_owned = false;
82463         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
82464         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
82465         int64_t ret_ref = tag_ptr(ret_copy, true);
82466         return ret_ref;
82467 }
82468
82469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
82470         LDKInMemorySigner this_arg_conv;
82471         this_arg_conv.inner = untag_ptr(this_arg);
82472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82474         this_arg_conv.is_owned = false;
82475         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
82476         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
82477         int64_t ret_ref = tag_ptr(ret_copy, true);
82478         return ret_ref;
82479 }
82480
82481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
82482         LDKInMemorySigner this_arg_conv;
82483         this_arg_conv.inner = untag_ptr(this_arg);
82484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82486         this_arg_conv.is_owned = false;
82487         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
82488         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
82489         int64_t ret_ref = tag_ptr(ret_copy, true);
82490         return ret_ref;
82491 }
82492
82493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
82494         LDKInMemorySigner this_arg_conv;
82495         this_arg_conv.inner = untag_ptr(this_arg);
82496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82498         this_arg_conv.is_owned = false;
82499         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
82500         int64_t ret_ref = 0;
82501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82503         return ret_ref;
82504 }
82505
82506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
82507         LDKInMemorySigner this_arg_conv;
82508         this_arg_conv.inner = untag_ptr(this_arg);
82509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82511         this_arg_conv.is_owned = false;
82512         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
82513         int64_t ret_ref = 0;
82514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82516         return ret_ref;
82517 }
82518
82519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
82520         LDKInMemorySigner this_arg_conv;
82521         this_arg_conv.inner = untag_ptr(this_arg);
82522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82524         this_arg_conv.is_owned = false;
82525         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
82526         int64_t ret_ref = 0;
82527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82529         return ret_ref;
82530 }
82531
82532 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) {
82533         LDKInMemorySigner this_arg_conv;
82534         this_arg_conv.inner = untag_ptr(this_arg);
82535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82537         this_arg_conv.is_owned = false;
82538         LDKTransaction spend_tx_ref;
82539         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
82540         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
82541         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
82542         spend_tx_ref.data_is_owned = true;
82543         LDKStaticPaymentOutputDescriptor descriptor_conv;
82544         descriptor_conv.inner = untag_ptr(descriptor);
82545         descriptor_conv.is_owned = ptr_is_owned(descriptor);
82546         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
82547         descriptor_conv.is_owned = false;
82548         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
82549         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
82550         return tag_ptr(ret_conv, true);
82551 }
82552
82553 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) {
82554         LDKInMemorySigner this_arg_conv;
82555         this_arg_conv.inner = untag_ptr(this_arg);
82556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82558         this_arg_conv.is_owned = false;
82559         LDKTransaction spend_tx_ref;
82560         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
82561         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
82562         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
82563         spend_tx_ref.data_is_owned = true;
82564         LDKDelayedPaymentOutputDescriptor descriptor_conv;
82565         descriptor_conv.inner = untag_ptr(descriptor);
82566         descriptor_conv.is_owned = ptr_is_owned(descriptor);
82567         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
82568         descriptor_conv.is_owned = false;
82569         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
82570         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
82571         return tag_ptr(ret_conv, true);
82572 }
82573
82574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
82575         LDKInMemorySigner this_arg_conv;
82576         this_arg_conv.inner = untag_ptr(this_arg);
82577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82579         this_arg_conv.is_owned = false;
82580         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
82581         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
82582         return tag_ptr(ret_ret, true);
82583 }
82584
82585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
82586         LDKInMemorySigner this_arg_conv;
82587         this_arg_conv.inner = untag_ptr(this_arg);
82588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82590         this_arg_conv.is_owned = false;
82591         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
82592         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
82593         return tag_ptr(ret_ret, true);
82594 }
82595
82596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
82597         LDKInMemorySigner this_arg_conv;
82598         this_arg_conv.inner = untag_ptr(this_arg);
82599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82601         this_arg_conv.is_owned = false;
82602         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
82603         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
82604         return tag_ptr(ret_ret, true);
82605 }
82606
82607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
82608         LDKInMemorySigner this_arg_conv;
82609         this_arg_conv.inner = untag_ptr(this_arg);
82610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82612         this_arg_conv.is_owned = false;
82613         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
82614         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
82615         return tag_ptr(ret_ret, true);
82616 }
82617
82618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
82619         LDKInMemorySigner obj_conv;
82620         obj_conv.inner = untag_ptr(obj);
82621         obj_conv.is_owned = ptr_is_owned(obj);
82622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
82623         obj_conv.is_owned = false;
82624         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
82625         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82626         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82627         CVec_u8Z_free(ret_var);
82628         return ret_arr;
82629 }
82630
82631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
82632         LDKu8slice ser_ref;
82633         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
82634         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
82635         void* arg_ptr = untag_ptr(arg);
82636         CHECK_ACCESS(arg_ptr);
82637         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
82638         if (arg_conv.free == LDKEntropySource_JCalls_free) {
82639                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82640                 LDKEntropySource_JCalls_cloned(&arg_conv);
82641         }
82642         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
82643         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
82644         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
82645         return tag_ptr(ret_conv, true);
82646 }
82647
82648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82649         LDKKeysManager this_obj_conv;
82650         this_obj_conv.inner = untag_ptr(this_obj);
82651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82653         KeysManager_free(this_obj_conv);
82654 }
82655
82656 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) {
82657         uint8_t seed_arr[32];
82658         CHECK((*env)->GetArrayLength(env, seed) == 32);
82659         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
82660         uint8_t (*seed_ref)[32] = &seed_arr;
82661         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
82662         int64_t ret_ref = 0;
82663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82665         return ret_ref;
82666 }
82667
82668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
82669         LDKKeysManager this_arg_conv;
82670         this_arg_conv.inner = untag_ptr(this_arg);
82671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82673         this_arg_conv.is_owned = false;
82674         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82675         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
82676         return ret_arr;
82677 }
82678
82679 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) {
82680         LDKKeysManager this_arg_conv;
82681         this_arg_conv.inner = untag_ptr(this_arg);
82682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82684         this_arg_conv.is_owned = false;
82685         uint8_t params_arr[32];
82686         CHECK((*env)->GetArrayLength(env, params) == 32);
82687         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
82688         uint8_t (*params_ref)[32] = &params_arr;
82689         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
82690         int64_t ret_ref = 0;
82691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82693         return ret_ref;
82694 }
82695
82696 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) {
82697         LDKKeysManager this_arg_conv;
82698         this_arg_conv.inner = untag_ptr(this_arg);
82699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82701         this_arg_conv.is_owned = false;
82702         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
82703         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
82704         if (descriptors_constr.datalen > 0)
82705                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
82706         else
82707                 descriptors_constr.data = NULL;
82708         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
82709         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
82710                 int64_t descriptors_conv_27 = descriptors_vals[b];
82711                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
82712                 CHECK_ACCESS(descriptors_conv_27_ptr);
82713                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
82714                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
82715                 descriptors_constr.data[b] = descriptors_conv_27_conv;
82716         }
82717         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
82718         LDKCVec_u8Z psbt_ref;
82719         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
82720         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
82721         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
82722         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
82723         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
82724         return tag_ptr(ret_conv, true);
82725 }
82726
82727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
82728         LDKKeysManager this_arg_conv;
82729         this_arg_conv.inner = untag_ptr(this_arg);
82730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82732         this_arg_conv.is_owned = false;
82733         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
82734         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
82735         return tag_ptr(ret_ret, true);
82736 }
82737
82738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
82739         LDKKeysManager this_arg_conv;
82740         this_arg_conv.inner = untag_ptr(this_arg);
82741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82743         this_arg_conv.is_owned = false;
82744         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
82745         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
82746         return tag_ptr(ret_ret, true);
82747 }
82748
82749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1OutputSpender(JNIEnv *env, jclass clz, int64_t this_arg) {
82750         LDKKeysManager this_arg_conv;
82751         this_arg_conv.inner = untag_ptr(this_arg);
82752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82754         this_arg_conv.is_owned = false;
82755         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
82756         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
82757         return tag_ptr(ret_ret, true);
82758 }
82759
82760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
82761         LDKKeysManager this_arg_conv;
82762         this_arg_conv.inner = untag_ptr(this_arg);
82763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82765         this_arg_conv.is_owned = false;
82766         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
82767         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
82768         return tag_ptr(ret_ret, true);
82769 }
82770
82771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82772         LDKPhantomKeysManager this_obj_conv;
82773         this_obj_conv.inner = untag_ptr(this_obj);
82774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82776         PhantomKeysManager_free(this_obj_conv);
82777 }
82778
82779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
82780         LDKPhantomKeysManager this_arg_conv;
82781         this_arg_conv.inner = untag_ptr(this_arg);
82782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82784         this_arg_conv.is_owned = false;
82785         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
82786         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
82787         return tag_ptr(ret_ret, true);
82788 }
82789
82790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
82791         LDKPhantomKeysManager this_arg_conv;
82792         this_arg_conv.inner = untag_ptr(this_arg);
82793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82795         this_arg_conv.is_owned = false;
82796         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
82797         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
82798         return tag_ptr(ret_ret, true);
82799 }
82800
82801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1OutputSpender(JNIEnv *env, jclass clz, int64_t this_arg) {
82802         LDKPhantomKeysManager this_arg_conv;
82803         this_arg_conv.inner = untag_ptr(this_arg);
82804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82806         this_arg_conv.is_owned = false;
82807         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
82808         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
82809         return tag_ptr(ret_ret, true);
82810 }
82811
82812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
82813         LDKPhantomKeysManager this_arg_conv;
82814         this_arg_conv.inner = untag_ptr(this_arg);
82815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82817         this_arg_conv.is_owned = false;
82818         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
82819         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
82820         return tag_ptr(ret_ret, true);
82821 }
82822
82823 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) {
82824         uint8_t seed_arr[32];
82825         CHECK((*env)->GetArrayLength(env, seed) == 32);
82826         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
82827         uint8_t (*seed_ref)[32] = &seed_arr;
82828         uint8_t cross_node_seed_arr[32];
82829         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
82830         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
82831         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
82832         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
82833         int64_t ret_ref = 0;
82834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82836         return ret_ref;
82837 }
82838
82839 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) {
82840         LDKPhantomKeysManager this_arg_conv;
82841         this_arg_conv.inner = untag_ptr(this_arg);
82842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82844         this_arg_conv.is_owned = false;
82845         uint8_t params_arr[32];
82846         CHECK((*env)->GetArrayLength(env, params) == 32);
82847         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
82848         uint8_t (*params_ref)[32] = &params_arr;
82849         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
82850         int64_t ret_ref = 0;
82851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82853         return ret_ref;
82854 }
82855
82856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
82857         LDKPhantomKeysManager this_arg_conv;
82858         this_arg_conv.inner = untag_ptr(this_arg);
82859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82861         this_arg_conv.is_owned = false;
82862         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82863         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
82864         return ret_arr;
82865 }
82866
82867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
82868         LDKPhantomKeysManager this_arg_conv;
82869         this_arg_conv.inner = untag_ptr(this_arg);
82870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82872         this_arg_conv.is_owned = false;
82873         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82874         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
82875         return ret_arr;
82876 }
82877
82878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RandomBytes_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82879         LDKRandomBytes this_obj_conv;
82880         this_obj_conv.inner = untag_ptr(this_obj);
82881         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82883         RandomBytes_free(this_obj_conv);
82884 }
82885
82886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RandomBytes_1new(JNIEnv *env, jclass clz, int8_tArray seed) {
82887         LDKThirtyTwoBytes seed_ref;
82888         CHECK((*env)->GetArrayLength(env, seed) == 32);
82889         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_ref.data);
82890         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
82891         int64_t ret_ref = 0;
82892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82894         return ret_ref;
82895 }
82896
82897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RandomBytes_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
82898         LDKRandomBytes this_arg_conv;
82899         this_arg_conv.inner = untag_ptr(this_arg);
82900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82902         this_arg_conv.is_owned = false;
82903         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
82904         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
82905         return tag_ptr(ret_ret, true);
82906 }
82907
82908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82909         if (!ptr_is_owned(this_ptr)) return;
82910         void* this_ptr_ptr = untag_ptr(this_ptr);
82911         CHECK_ACCESS(this_ptr_ptr);
82912         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
82913         FREE(untag_ptr(this_ptr));
82914         EcdsaChannelSigner_free(this_ptr_conv);
82915 }
82916
82917 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
82918         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
82919         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
82920         return tag_ptr(ret_ret, true);
82921 }
82922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82923         void* arg_ptr = untag_ptr(arg);
82924         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
82925         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
82926         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
82927         return ret_conv;
82928 }
82929
82930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82931         void* orig_ptr = untag_ptr(orig);
82932         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
82933         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
82934         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
82935         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
82936         return tag_ptr(ret_ret, true);
82937 }
82938
82939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82940         if (!ptr_is_owned(this_ptr)) return;
82941         void* this_ptr_ptr = untag_ptr(this_ptr);
82942         CHECK_ACCESS(this_ptr_ptr);
82943         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
82944         FREE(untag_ptr(this_ptr));
82945         WriteableEcdsaChannelSigner_free(this_ptr_conv);
82946 }
82947
82948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82949         LDKOnionMessenger this_obj_conv;
82950         this_obj_conv.inner = untag_ptr(this_obj);
82951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82953         OnionMessenger_free(this_obj_conv);
82954 }
82955
82956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82957         if (!ptr_is_owned(this_ptr)) return;
82958         void* this_ptr_ptr = untag_ptr(this_ptr);
82959         CHECK_ACCESS(this_ptr_ptr);
82960         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
82961         FREE(untag_ptr(this_ptr));
82962         MessageRouter_free(this_ptr_conv);
82963 }
82964
82965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82966         LDKDefaultMessageRouter this_obj_conv;
82967         this_obj_conv.inner = untag_ptr(this_obj);
82968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82970         DefaultMessageRouter_free(this_obj_conv);
82971 }
82972
82973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t entropy_source) {
82974         LDKNetworkGraph network_graph_conv;
82975         network_graph_conv.inner = untag_ptr(network_graph);
82976         network_graph_conv.is_owned = ptr_is_owned(network_graph);
82977         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
82978         network_graph_conv.is_owned = false;
82979         void* entropy_source_ptr = untag_ptr(entropy_source);
82980         CHECK_ACCESS(entropy_source_ptr);
82981         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82982         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82983                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82984                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82985         }
82986         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
82987         int64_t ret_ref = 0;
82988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82990         return ret_ref;
82991 }
82992
82993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
82994         LDKDefaultMessageRouter this_arg_conv;
82995         this_arg_conv.inner = untag_ptr(this_arg);
82996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82998         this_arg_conv.is_owned = false;
82999         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
83000         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
83001         return tag_ptr(ret_ret, true);
83002 }
83003
83004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83005         LDKOnionMessagePath this_obj_conv;
83006         this_obj_conv.inner = untag_ptr(this_obj);
83007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83009         OnionMessagePath_free(this_obj_conv);
83010 }
83011
83012 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
83013         LDKOnionMessagePath this_ptr_conv;
83014         this_ptr_conv.inner = untag_ptr(this_ptr);
83015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83017         this_ptr_conv.is_owned = false;
83018         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
83019         jobjectArray ret_arr = NULL;
83020         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
83021         ;
83022         for (size_t i = 0; i < ret_var.datalen; i++) {
83023                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
83024                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
83025                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
83026         }
83027         
83028         FREE(ret_var.data);
83029         return ret_arr;
83030 }
83031
83032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
83033         LDKOnionMessagePath this_ptr_conv;
83034         this_ptr_conv.inner = untag_ptr(this_ptr);
83035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83037         this_ptr_conv.is_owned = false;
83038         LDKCVec_PublicKeyZ val_constr;
83039         val_constr.datalen = (*env)->GetArrayLength(env, val);
83040         if (val_constr.datalen > 0)
83041                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
83042         else
83043                 val_constr.data = NULL;
83044         for (size_t i = 0; i < val_constr.datalen; i++) {
83045                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
83046                 LDKPublicKey val_conv_8_ref;
83047                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
83048                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
83049                 val_constr.data[i] = val_conv_8_ref;
83050         }
83051         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
83052 }
83053
83054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
83055         LDKOnionMessagePath this_ptr_conv;
83056         this_ptr_conv.inner = untag_ptr(this_ptr);
83057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83059         this_ptr_conv.is_owned = false;
83060         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
83061         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
83062         int64_t ret_ref = tag_ptr(ret_copy, true);
83063         return ret_ref;
83064 }
83065
83066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83067         LDKOnionMessagePath this_ptr_conv;
83068         this_ptr_conv.inner = untag_ptr(this_ptr);
83069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83071         this_ptr_conv.is_owned = false;
83072         void* val_ptr = untag_ptr(val);
83073         CHECK_ACCESS(val_ptr);
83074         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
83075         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
83076         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
83077 }
83078
83079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
83080         LDKOnionMessagePath this_ptr_conv;
83081         this_ptr_conv.inner = untag_ptr(this_ptr);
83082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83084         this_ptr_conv.is_owned = false;
83085         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
83086         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
83087         int64_t ret_ref = tag_ptr(ret_copy, true);
83088         return ret_ref;
83089 }
83090
83091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83092         LDKOnionMessagePath this_ptr_conv;
83093         this_ptr_conv.inner = untag_ptr(this_ptr);
83094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83096         this_ptr_conv.is_owned = false;
83097         void* val_ptr = untag_ptr(val);
83098         CHECK_ACCESS(val_ptr);
83099         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
83100         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
83101         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
83102 }
83103
83104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
83105         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
83106         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
83107         if (intermediate_nodes_arg_constr.datalen > 0)
83108                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
83109         else
83110                 intermediate_nodes_arg_constr.data = NULL;
83111         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
83112                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
83113                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
83114                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
83115                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
83116                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
83117         }
83118         void* destination_arg_ptr = untag_ptr(destination_arg);
83119         CHECK_ACCESS(destination_arg_ptr);
83120         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
83121         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
83122         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
83123         CHECK_ACCESS(first_node_addresses_arg_ptr);
83124         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
83125         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
83126         int64_t ret_ref = 0;
83127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83129         return ret_ref;
83130 }
83131
83132 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
83133         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
83134         int64_t ret_ref = 0;
83135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83137         return ret_ref;
83138 }
83139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83140         LDKOnionMessagePath arg_conv;
83141         arg_conv.inner = untag_ptr(arg);
83142         arg_conv.is_owned = ptr_is_owned(arg);
83143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83144         arg_conv.is_owned = false;
83145         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
83146         return ret_conv;
83147 }
83148
83149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83150         LDKOnionMessagePath orig_conv;
83151         orig_conv.inner = untag_ptr(orig);
83152         orig_conv.is_owned = ptr_is_owned(orig);
83153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83154         orig_conv.is_owned = false;
83155         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
83156         int64_t ret_ref = 0;
83157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83159         return ret_ref;
83160 }
83161
83162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1first_1node(JNIEnv *env, jclass clz, int64_t this_arg) {
83163         LDKOnionMessagePath this_arg_conv;
83164         this_arg_conv.inner = untag_ptr(this_arg);
83165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83167         this_arg_conv.is_owned = false;
83168         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
83169         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessagePath_first_node(&this_arg_conv).compressed_form);
83170         return ret_arr;
83171 }
83172
83173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83174         if (!ptr_is_owned(this_ptr)) return;
83175         void* this_ptr_ptr = untag_ptr(this_ptr);
83176         CHECK_ACCESS(this_ptr_ptr);
83177         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
83178         FREE(untag_ptr(this_ptr));
83179         Destination_free(this_ptr_conv);
83180 }
83181
83182 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
83183         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
83184         *ret_copy = Destination_clone(arg);
83185         int64_t ret_ref = tag_ptr(ret_copy, true);
83186         return ret_ref;
83187 }
83188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83189         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
83190         int64_t ret_conv = Destination_clone_ptr(arg_conv);
83191         return ret_conv;
83192 }
83193
83194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83195         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
83196         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
83197         *ret_copy = Destination_clone(orig_conv);
83198         int64_t ret_ref = tag_ptr(ret_copy, true);
83199         return ret_ref;
83200 }
83201
83202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
83203         LDKPublicKey a_ref;
83204         CHECK((*env)->GetArrayLength(env, a) == 33);
83205         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
83206         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
83207         *ret_copy = Destination_node(a_ref);
83208         int64_t ret_ref = tag_ptr(ret_copy, true);
83209         return ret_ref;
83210 }
83211
83212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
83213         LDKBlindedPath a_conv;
83214         a_conv.inner = untag_ptr(a);
83215         a_conv.is_owned = ptr_is_owned(a);
83216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83217         a_conv = BlindedPath_clone(&a_conv);
83218         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
83219         *ret_copy = Destination_blinded_path(a_conv);
83220         int64_t ret_ref = tag_ptr(ret_copy, true);
83221         return ret_ref;
83222 }
83223
83224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1hash(JNIEnv *env, jclass clz, int64_t o) {
83225         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
83226         int64_t ret_conv = Destination_hash(o_conv);
83227         return ret_conv;
83228 }
83229
83230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Destination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83231         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
83232         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
83233         jboolean ret_conv = Destination_eq(a_conv, b_conv);
83234         return ret_conv;
83235 }
83236
83237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
83238         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
83239         LDKReadOnlyNetworkGraph network_graph_conv;
83240         network_graph_conv.inner = untag_ptr(network_graph);
83241         network_graph_conv.is_owned = ptr_is_owned(network_graph);
83242         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
83243         network_graph_conv.is_owned = false;
83244         Destination_resolve(this_arg_conv, &network_graph_conv);
83245 }
83246
83247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendSuccess_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83248         if (!ptr_is_owned(this_ptr)) return;
83249         void* this_ptr_ptr = untag_ptr(this_ptr);
83250         CHECK_ACCESS(this_ptr_ptr);
83251         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
83252         FREE(untag_ptr(this_ptr));
83253         SendSuccess_free(this_ptr_conv);
83254 }
83255
83256 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
83257         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
83258         *ret_copy = SendSuccess_clone(arg);
83259         int64_t ret_ref = tag_ptr(ret_copy, true);
83260         return ret_ref;
83261 }
83262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83263         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
83264         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
83265         return ret_conv;
83266 }
83267
83268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83269         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
83270         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
83271         *ret_copy = SendSuccess_clone(orig_conv);
83272         int64_t ret_ref = tag_ptr(ret_copy, true);
83273         return ret_ref;
83274 }
83275
83276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered(JNIEnv *env, jclass clz) {
83277         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
83278         *ret_copy = SendSuccess_buffered();
83279         int64_t ret_ref = tag_ptr(ret_copy, true);
83280         return ret_ref;
83281 }
83282
83283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered_1awaiting_1connection(JNIEnv *env, jclass clz, int8_tArray a) {
83284         LDKPublicKey a_ref;
83285         CHECK((*env)->GetArrayLength(env, a) == 33);
83286         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
83287         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
83288         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
83289         int64_t ret_ref = tag_ptr(ret_copy, true);
83290         return ret_ref;
83291 }
83292
83293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1hash(JNIEnv *env, jclass clz, int64_t o) {
83294         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
83295         int64_t ret_conv = SendSuccess_hash(o_conv);
83296         return ret_conv;
83297 }
83298
83299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendSuccess_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83300         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
83301         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
83302         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
83303         return ret_conv;
83304 }
83305
83306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83307         if (!ptr_is_owned(this_ptr)) return;
83308         void* this_ptr_ptr = untag_ptr(this_ptr);
83309         CHECK_ACCESS(this_ptr_ptr);
83310         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
83311         FREE(untag_ptr(this_ptr));
83312         SendError_free(this_ptr_conv);
83313 }
83314
83315 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
83316         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83317         *ret_copy = SendError_clone(arg);
83318         int64_t ret_ref = tag_ptr(ret_copy, true);
83319         return ret_ref;
83320 }
83321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83322         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
83323         int64_t ret_conv = SendError_clone_ptr(arg_conv);
83324         return ret_conv;
83325 }
83326
83327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83328         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
83329         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83330         *ret_copy = SendError_clone(orig_conv);
83331         int64_t ret_ref = tag_ptr(ret_copy, true);
83332         return ret_ref;
83333 }
83334
83335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
83336         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
83337         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83338         *ret_copy = SendError_secp256k1(a_conv);
83339         int64_t ret_ref = tag_ptr(ret_copy, true);
83340         return ret_ref;
83341 }
83342
83343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
83344         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83345         *ret_copy = SendError_too_big_packet();
83346         int64_t ret_ref = tag_ptr(ret_copy, true);
83347         return ret_ref;
83348 }
83349
83350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
83351         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83352         *ret_copy = SendError_too_few_blinded_hops();
83353         int64_t ret_ref = tag_ptr(ret_copy, true);
83354         return ret_ref;
83355 }
83356
83357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz, int8_tArray a) {
83358         LDKPublicKey a_ref;
83359         CHECK((*env)->GetArrayLength(env, a) == 33);
83360         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
83361         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83362         *ret_copy = SendError_invalid_first_hop(a_ref);
83363         int64_t ret_ref = tag_ptr(ret_copy, true);
83364         return ret_ref;
83365 }
83366
83367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1path_1not_1found(JNIEnv *env, jclass clz) {
83368         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83369         *ret_copy = SendError_path_not_found();
83370         int64_t ret_ref = tag_ptr(ret_copy, true);
83371         return ret_ref;
83372 }
83373
83374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
83375         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83376         *ret_copy = SendError_invalid_message();
83377         int64_t ret_ref = tag_ptr(ret_copy, true);
83378         return ret_ref;
83379 }
83380
83381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
83382         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83383         *ret_copy = SendError_buffer_full();
83384         int64_t ret_ref = tag_ptr(ret_copy, true);
83385         return ret_ref;
83386 }
83387
83388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
83389         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83390         *ret_copy = SendError_get_node_id_failed();
83391         int64_t ret_ref = tag_ptr(ret_copy, true);
83392         return ret_ref;
83393 }
83394
83395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1unresolved_1introduction_1node(JNIEnv *env, jclass clz) {
83396         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83397         *ret_copy = SendError_unresolved_introduction_node();
83398         int64_t ret_ref = tag_ptr(ret_copy, true);
83399         return ret_ref;
83400 }
83401
83402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
83403         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
83404         *ret_copy = SendError_blinded_path_advance_failed();
83405         int64_t ret_ref = tag_ptr(ret_copy, true);
83406         return ret_ref;
83407 }
83408
83409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1hash(JNIEnv *env, jclass clz, int64_t o) {
83410         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
83411         int64_t ret_conv = SendError_hash(o_conv);
83412         return ret_conv;
83413 }
83414
83415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83416         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
83417         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
83418         jboolean ret_conv = SendError_eq(a_conv, b_conv);
83419         return ret_conv;
83420 }
83421
83422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83423         if (!ptr_is_owned(this_ptr)) return;
83424         void* this_ptr_ptr = untag_ptr(this_ptr);
83425         CHECK_ACCESS(this_ptr_ptr);
83426         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
83427         FREE(untag_ptr(this_ptr));
83428         CustomOnionMessageHandler_free(this_ptr_conv);
83429 }
83430
83431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83432         if (!ptr_is_owned(this_ptr)) return;
83433         void* this_ptr_ptr = untag_ptr(this_ptr);
83434         CHECK_ACCESS(this_ptr_ptr);
83435         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
83436         FREE(untag_ptr(this_ptr));
83437         PeeledOnion_free(this_ptr_conv);
83438 }
83439
83440 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
83441         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
83442         *ret_copy = PeeledOnion_clone(arg);
83443         int64_t ret_ref = tag_ptr(ret_copy, true);
83444         return ret_ref;
83445 }
83446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83447         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
83448         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
83449         return ret_conv;
83450 }
83451
83452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83453         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
83454         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
83455         *ret_copy = PeeledOnion_clone(orig_conv);
83456         int64_t ret_ref = tag_ptr(ret_copy, true);
83457         return ret_ref;
83458 }
83459
83460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83461         void* a_ptr = untag_ptr(a);
83462         CHECK_ACCESS(a_ptr);
83463         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
83464         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
83465         LDKOnionMessage b_conv;
83466         b_conv.inner = untag_ptr(b);
83467         b_conv.is_owned = ptr_is_owned(b);
83468         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83469         b_conv = OnionMessage_clone(&b_conv);
83470         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
83471         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
83472         int64_t ret_ref = tag_ptr(ret_copy, true);
83473         return ret_ref;
83474 }
83475
83476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
83477         void* a_ptr = untag_ptr(a);
83478         CHECK_ACCESS(a_ptr);
83479         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
83480         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
83481         LDKThirtyTwoBytes b_ref;
83482         CHECK((*env)->GetArrayLength(env, b) == 32);
83483         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
83484         LDKBlindedPath c_conv;
83485         c_conv.inner = untag_ptr(c);
83486         c_conv.is_owned = ptr_is_owned(c);
83487         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
83488         c_conv = BlindedPath_clone(&c_conv);
83489         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
83490         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
83491         int64_t ret_ref = tag_ptr(ret_copy, true);
83492         return ret_ref;
83493 }
83494
83495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message_1resolving_1destination(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t network_graph, int64_t path, int64_t contents, int64_t reply_path) {
83496         void* entropy_source_ptr = untag_ptr(entropy_source);
83497         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
83498         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
83499         void* node_signer_ptr = untag_ptr(node_signer);
83500         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
83501         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
83502         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
83503         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
83504         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
83505         LDKReadOnlyNetworkGraph network_graph_conv;
83506         network_graph_conv.inner = untag_ptr(network_graph);
83507         network_graph_conv.is_owned = ptr_is_owned(network_graph);
83508         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
83509         network_graph_conv.is_owned = false;
83510         LDKOnionMessagePath path_conv;
83511         path_conv.inner = untag_ptr(path);
83512         path_conv.is_owned = ptr_is_owned(path);
83513         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
83514         path_conv = OnionMessagePath_clone(&path_conv);
83515         void* contents_ptr = untag_ptr(contents);
83516         CHECK_ACCESS(contents_ptr);
83517         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
83518         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
83519                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83520                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
83521         }
83522         LDKBlindedPath reply_path_conv;
83523         reply_path_conv.inner = untag_ptr(reply_path);
83524         reply_path_conv.is_owned = ptr_is_owned(reply_path);
83525         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
83526         reply_path_conv = BlindedPath_clone(&reply_path_conv);
83527         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
83528         *ret_conv = create_onion_message_resolving_destination(entropy_source_conv, node_signer_conv, node_id_lookup_conv, &network_graph_conv, path_conv, contents_conv, reply_path_conv);
83529         return tag_ptr(ret_conv, true);
83530 }
83531
83532 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 node_id_lookup, int64_t path, int64_t contents, int64_t reply_path) {
83533         void* entropy_source_ptr = untag_ptr(entropy_source);
83534         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
83535         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
83536         void* node_signer_ptr = untag_ptr(node_signer);
83537         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
83538         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
83539         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
83540         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
83541         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
83542         LDKOnionMessagePath path_conv;
83543         path_conv.inner = untag_ptr(path);
83544         path_conv.is_owned = ptr_is_owned(path);
83545         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
83546         path_conv = OnionMessagePath_clone(&path_conv);
83547         void* contents_ptr = untag_ptr(contents);
83548         CHECK_ACCESS(contents_ptr);
83549         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
83550         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
83551                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83552                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
83553         }
83554         LDKBlindedPath reply_path_conv;
83555         reply_path_conv.inner = untag_ptr(reply_path);
83556         reply_path_conv.is_owned = ptr_is_owned(reply_path);
83557         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
83558         reply_path_conv = BlindedPath_clone(&reply_path_conv);
83559         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
83560         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
83561         return tag_ptr(ret_conv, true);
83562 }
83563
83564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1onion_1message(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
83565         LDKOnionMessage msg_conv;
83566         msg_conv.inner = untag_ptr(msg);
83567         msg_conv.is_owned = ptr_is_owned(msg);
83568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
83569         msg_conv.is_owned = false;
83570         void* node_signer_ptr = untag_ptr(node_signer);
83571         CHECK_ACCESS(node_signer_ptr);
83572         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83573         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83574                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83575                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83576         }
83577         void* logger_ptr = untag_ptr(logger);
83578         CHECK_ACCESS(logger_ptr);
83579         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83580         if (logger_conv.free == LDKLogger_JCalls_free) {
83581                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83582                 LDKLogger_JCalls_cloned(&logger_conv);
83583         }
83584         void* custom_handler_ptr = untag_ptr(custom_handler);
83585         CHECK_ACCESS(custom_handler_ptr);
83586         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
83587         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
83588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83589                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
83590         }
83591         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
83592         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
83593         return tag_ptr(ret_conv, true);
83594 }
83595
83596 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 node_id_lookup, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
83597         void* entropy_source_ptr = untag_ptr(entropy_source);
83598         CHECK_ACCESS(entropy_source_ptr);
83599         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83600         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83601                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83602                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83603         }
83604         void* node_signer_ptr = untag_ptr(node_signer);
83605         CHECK_ACCESS(node_signer_ptr);
83606         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83607         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83608                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83609                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83610         }
83611         void* logger_ptr = untag_ptr(logger);
83612         CHECK_ACCESS(logger_ptr);
83613         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83614         if (logger_conv.free == LDKLogger_JCalls_free) {
83615                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83616                 LDKLogger_JCalls_cloned(&logger_conv);
83617         }
83618         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
83619         CHECK_ACCESS(node_id_lookup_ptr);
83620         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
83621         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
83622                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83623                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
83624         }
83625         void* message_router_ptr = untag_ptr(message_router);
83626         CHECK_ACCESS(message_router_ptr);
83627         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
83628         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
83629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83630                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
83631         }
83632         void* offers_handler_ptr = untag_ptr(offers_handler);
83633         CHECK_ACCESS(offers_handler_ptr);
83634         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
83635         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
83636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83637                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
83638         }
83639         void* custom_handler_ptr = untag_ptr(custom_handler);
83640         CHECK_ACCESS(custom_handler_ptr);
83641         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
83642         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
83643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83644                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
83645         }
83646         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, node_id_lookup_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
83647         int64_t ret_ref = 0;
83648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83650         return ret_ref;
83651 }
83652
83653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
83654         LDKOnionMessenger this_arg_conv;
83655         this_arg_conv.inner = untag_ptr(this_arg);
83656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83658         this_arg_conv.is_owned = false;
83659         void* contents_ptr = untag_ptr(contents);
83660         CHECK_ACCESS(contents_ptr);
83661         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
83662         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
83663                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83664                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
83665         }
83666         void* destination_ptr = untag_ptr(destination);
83667         CHECK_ACCESS(destination_ptr);
83668         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
83669         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
83670         LDKBlindedPath reply_path_conv;
83671         reply_path_conv.inner = untag_ptr(reply_path);
83672         reply_path_conv.is_owned = ptr_is_owned(reply_path);
83673         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
83674         reply_path_conv = BlindedPath_clone(&reply_path_conv);
83675         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
83676         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
83677         return tag_ptr(ret_conv, true);
83678 }
83679
83680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
83681         LDKOnionMessenger this_arg_conv;
83682         this_arg_conv.inner = untag_ptr(this_arg);
83683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83685         this_arg_conv.is_owned = false;
83686         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
83687         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
83688         return tag_ptr(ret_ret, true);
83689 }
83690
83691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83692         if (!ptr_is_owned(this_ptr)) return;
83693         void* this_ptr_ptr = untag_ptr(this_ptr);
83694         CHECK_ACCESS(this_ptr_ptr);
83695         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
83696         FREE(untag_ptr(this_ptr));
83697         OffersMessageHandler_free(this_ptr_conv);
83698 }
83699
83700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83701         if (!ptr_is_owned(this_ptr)) return;
83702         void* this_ptr_ptr = untag_ptr(this_ptr);
83703         CHECK_ACCESS(this_ptr_ptr);
83704         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
83705         FREE(untag_ptr(this_ptr));
83706         OffersMessage_free(this_ptr_conv);
83707 }
83708
83709 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
83710         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
83711         *ret_copy = OffersMessage_clone(arg);
83712         int64_t ret_ref = tag_ptr(ret_copy, true);
83713         return ret_ref;
83714 }
83715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83716         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
83717         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
83718         return ret_conv;
83719 }
83720
83721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83722         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
83723         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
83724         *ret_copy = OffersMessage_clone(orig_conv);
83725         int64_t ret_ref = tag_ptr(ret_copy, true);
83726         return ret_ref;
83727 }
83728
83729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
83730         LDKInvoiceRequest a_conv;
83731         a_conv.inner = untag_ptr(a);
83732         a_conv.is_owned = ptr_is_owned(a);
83733         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83734         a_conv = InvoiceRequest_clone(&a_conv);
83735         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
83736         *ret_copy = OffersMessage_invoice_request(a_conv);
83737         int64_t ret_ref = tag_ptr(ret_copy, true);
83738         return ret_ref;
83739 }
83740
83741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
83742         LDKBolt12Invoice a_conv;
83743         a_conv.inner = untag_ptr(a);
83744         a_conv.is_owned = ptr_is_owned(a);
83745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83746         a_conv = Bolt12Invoice_clone(&a_conv);
83747         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
83748         *ret_copy = OffersMessage_invoice(a_conv);
83749         int64_t ret_ref = tag_ptr(ret_copy, true);
83750         return ret_ref;
83751 }
83752
83753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
83754         LDKInvoiceError a_conv;
83755         a_conv.inner = untag_ptr(a);
83756         a_conv.is_owned = ptr_is_owned(a);
83757         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83758         a_conv = InvoiceError_clone(&a_conv);
83759         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
83760         *ret_copy = OffersMessage_invoice_error(a_conv);
83761         int64_t ret_ref = tag_ptr(ret_copy, true);
83762         return ret_ref;
83763 }
83764
83765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
83766         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
83767         return ret_conv;
83768 }
83769
83770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
83771         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
83772         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
83773         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
83774         return tag_ptr(ret_ret, true);
83775 }
83776
83777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
83778         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
83779         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
83780         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83781         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83782         CVec_u8Z_free(ret_var);
83783         return ret_arr;
83784 }
83785
83786 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) {
83787         LDKu8slice ser_ref;
83788         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
83789         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
83790         void* arg_b_ptr = untag_ptr(arg_b);
83791         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
83792         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
83793         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
83794         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
83795         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
83796         return tag_ptr(ret_conv, true);
83797 }
83798
83799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83800         LDKPacket this_obj_conv;
83801         this_obj_conv.inner = untag_ptr(this_obj);
83802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83804         Packet_free(this_obj_conv);
83805 }
83806
83807 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
83808         LDKPacket this_ptr_conv;
83809         this_ptr_conv.inner = untag_ptr(this_ptr);
83810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83812         this_ptr_conv.is_owned = false;
83813         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
83814         return ret_conv;
83815 }
83816
83817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
83818         LDKPacket this_ptr_conv;
83819         this_ptr_conv.inner = untag_ptr(this_ptr);
83820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83822         this_ptr_conv.is_owned = false;
83823         Packet_set_version(&this_ptr_conv, val);
83824 }
83825
83826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
83827         LDKPacket this_ptr_conv;
83828         this_ptr_conv.inner = untag_ptr(this_ptr);
83829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83831         this_ptr_conv.is_owned = false;
83832         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
83833         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
83834         return ret_arr;
83835 }
83836
83837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83838         LDKPacket this_ptr_conv;
83839         this_ptr_conv.inner = untag_ptr(this_ptr);
83840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83842         this_ptr_conv.is_owned = false;
83843         LDKPublicKey val_ref;
83844         CHECK((*env)->GetArrayLength(env, val) == 33);
83845         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
83846         Packet_set_public_key(&this_ptr_conv, val_ref);
83847 }
83848
83849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
83850         LDKPacket this_ptr_conv;
83851         this_ptr_conv.inner = untag_ptr(this_ptr);
83852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83854         this_ptr_conv.is_owned = false;
83855         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
83856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83858         CVec_u8Z_free(ret_var);
83859         return ret_arr;
83860 }
83861
83862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83863         LDKPacket this_ptr_conv;
83864         this_ptr_conv.inner = untag_ptr(this_ptr);
83865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83867         this_ptr_conv.is_owned = false;
83868         LDKCVec_u8Z val_ref;
83869         val_ref.datalen = (*env)->GetArrayLength(env, val);
83870         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
83871         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
83872         Packet_set_hop_data(&this_ptr_conv, val_ref);
83873 }
83874
83875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
83876         LDKPacket this_ptr_conv;
83877         this_ptr_conv.inner = untag_ptr(this_ptr);
83878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83880         this_ptr_conv.is_owned = false;
83881         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
83882         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
83883         return ret_arr;
83884 }
83885
83886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83887         LDKPacket this_ptr_conv;
83888         this_ptr_conv.inner = untag_ptr(this_ptr);
83889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83891         this_ptr_conv.is_owned = false;
83892         LDKThirtyTwoBytes val_ref;
83893         CHECK((*env)->GetArrayLength(env, val) == 32);
83894         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
83895         Packet_set_hmac(&this_ptr_conv, val_ref);
83896 }
83897
83898 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) {
83899         LDKPublicKey public_key_arg_ref;
83900         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
83901         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
83902         LDKCVec_u8Z hop_data_arg_ref;
83903         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
83904         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
83905         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
83906         LDKThirtyTwoBytes hmac_arg_ref;
83907         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
83908         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
83909         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
83910         int64_t ret_ref = 0;
83911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83913         return ret_ref;
83914 }
83915
83916 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
83917         LDKPacket ret_var = Packet_clone(arg);
83918         int64_t ret_ref = 0;
83919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83921         return ret_ref;
83922 }
83923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83924         LDKPacket arg_conv;
83925         arg_conv.inner = untag_ptr(arg);
83926         arg_conv.is_owned = ptr_is_owned(arg);
83927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83928         arg_conv.is_owned = false;
83929         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
83930         return ret_conv;
83931 }
83932
83933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83934         LDKPacket orig_conv;
83935         orig_conv.inner = untag_ptr(orig);
83936         orig_conv.is_owned = ptr_is_owned(orig);
83937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83938         orig_conv.is_owned = false;
83939         LDKPacket ret_var = Packet_clone(&orig_conv);
83940         int64_t ret_ref = 0;
83941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83943         return ret_ref;
83944 }
83945
83946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1hash(JNIEnv *env, jclass clz, int64_t o) {
83947         LDKPacket o_conv;
83948         o_conv.inner = untag_ptr(o);
83949         o_conv.is_owned = ptr_is_owned(o);
83950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83951         o_conv.is_owned = false;
83952         int64_t ret_conv = Packet_hash(&o_conv);
83953         return ret_conv;
83954 }
83955
83956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83957         LDKPacket a_conv;
83958         a_conv.inner = untag_ptr(a);
83959         a_conv.is_owned = ptr_is_owned(a);
83960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83961         a_conv.is_owned = false;
83962         LDKPacket b_conv;
83963         b_conv.inner = untag_ptr(b);
83964         b_conv.is_owned = ptr_is_owned(b);
83965         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83966         b_conv.is_owned = false;
83967         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
83968         return ret_conv;
83969 }
83970
83971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
83972         LDKPacket obj_conv;
83973         obj_conv.inner = untag_ptr(obj);
83974         obj_conv.is_owned = ptr_is_owned(obj);
83975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
83976         obj_conv.is_owned = false;
83977         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
83978         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83979         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83980         CVec_u8Z_free(ret_var);
83981         return ret_arr;
83982 }
83983
83984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83985         if (!ptr_is_owned(this_ptr)) return;
83986         void* this_ptr_ptr = untag_ptr(this_ptr);
83987         CHECK_ACCESS(this_ptr_ptr);
83988         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
83989         FREE(untag_ptr(this_ptr));
83990         ParsedOnionMessageContents_free(this_ptr_conv);
83991 }
83992
83993 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
83994         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
83995         *ret_copy = ParsedOnionMessageContents_clone(arg);
83996         int64_t ret_ref = tag_ptr(ret_copy, true);
83997         return ret_ref;
83998 }
83999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84000         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
84001         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
84002         return ret_conv;
84003 }
84004
84005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84006         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
84007         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
84008         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
84009         int64_t ret_ref = tag_ptr(ret_copy, true);
84010         return ret_ref;
84011 }
84012
84013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
84014         void* a_ptr = untag_ptr(a);
84015         CHECK_ACCESS(a_ptr);
84016         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
84017         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
84018         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
84019         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
84020         int64_t ret_ref = tag_ptr(ret_copy, true);
84021         return ret_ref;
84022 }
84023
84024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
84025         void* a_ptr = untag_ptr(a);
84026         CHECK_ACCESS(a_ptr);
84027         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
84028         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
84029                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84030                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
84031         }
84032         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
84033         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
84034         int64_t ret_ref = tag_ptr(ret_copy, true);
84035         return ret_ref;
84036 }
84037
84038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
84039         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
84040         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
84041         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
84042         return tag_ptr(ret_ret, true);
84043 }
84044
84045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
84046         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
84047         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
84048         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84049         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84050         CVec_u8Z_free(ret_var);
84051         return ret_arr;
84052 }
84053
84054 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
84055         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
84056         *ret_ret = OnionMessageContents_clone(arg);
84057         return tag_ptr(ret_ret, true);
84058 }
84059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84060         void* arg_ptr = untag_ptr(arg);
84061         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
84062         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
84063         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
84064         return ret_conv;
84065 }
84066
84067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84068         void* orig_ptr = untag_ptr(orig);
84069         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
84070         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
84071         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
84072         *ret_ret = OnionMessageContents_clone(orig_conv);
84073         return tag_ptr(ret_ret, true);
84074 }
84075
84076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84077         if (!ptr_is_owned(this_ptr)) return;
84078         void* this_ptr_ptr = untag_ptr(this_ptr);
84079         CHECK_ACCESS(this_ptr_ptr);
84080         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
84081         FREE(untag_ptr(this_ptr));
84082         OnionMessageContents_free(this_ptr_conv);
84083 }
84084
84085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84086         if (!ptr_is_owned(this_ptr)) return;
84087         void* this_ptr_ptr = untag_ptr(this_ptr);
84088         CHECK_ACCESS(this_ptr_ptr);
84089         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
84090         FREE(untag_ptr(this_ptr));
84091         NextMessageHop_free(this_ptr_conv);
84092 }
84093
84094 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
84095         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
84096         *ret_copy = NextMessageHop_clone(arg);
84097         int64_t ret_ref = tag_ptr(ret_copy, true);
84098         return ret_ref;
84099 }
84100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84101         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
84102         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
84103         return ret_conv;
84104 }
84105
84106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84107         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
84108         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
84109         *ret_copy = NextMessageHop_clone(orig_conv);
84110         int64_t ret_ref = tag_ptr(ret_copy, true);
84111         return ret_ref;
84112 }
84113
84114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1node_1id(JNIEnv *env, jclass clz, int8_tArray a) {
84115         LDKPublicKey a_ref;
84116         CHECK((*env)->GetArrayLength(env, a) == 33);
84117         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
84118         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
84119         *ret_copy = NextMessageHop_node_id(a_ref);
84120         int64_t ret_ref = tag_ptr(ret_copy, true);
84121         return ret_ref;
84122 }
84123
84124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t a) {
84125         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
84126         *ret_copy = NextMessageHop_short_channel_id(a);
84127         int64_t ret_ref = tag_ptr(ret_copy, true);
84128         return ret_ref;
84129 }
84130
84131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
84132         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
84133         int64_t ret_conv = NextMessageHop_hash(o_conv);
84134         return ret_conv;
84135 }
84136
84137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84138         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
84139         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
84140         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
84141         return ret_conv;
84142 }
84143
84144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84145         LDKBlindedPath this_obj_conv;
84146         this_obj_conv.inner = untag_ptr(this_obj);
84147         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84149         BlindedPath_free(this_obj_conv);
84150 }
84151
84152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node(JNIEnv *env, jclass clz, int64_t this_ptr) {
84153         LDKBlindedPath this_ptr_conv;
84154         this_ptr_conv.inner = untag_ptr(this_ptr);
84155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84157         this_ptr_conv.is_owned = false;
84158         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
84159         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
84160         int64_t ret_ref = tag_ptr(ret_copy, true);
84161         return ret_ref;
84162 }
84163
84164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84165         LDKBlindedPath this_ptr_conv;
84166         this_ptr_conv.inner = untag_ptr(this_ptr);
84167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84169         this_ptr_conv.is_owned = false;
84170         void* val_ptr = untag_ptr(val);
84171         CHECK_ACCESS(val_ptr);
84172         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
84173         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
84174         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
84175 }
84176
84177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
84178         LDKBlindedPath this_ptr_conv;
84179         this_ptr_conv.inner = untag_ptr(this_ptr);
84180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84182         this_ptr_conv.is_owned = false;
84183         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
84184         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
84185         return ret_arr;
84186 }
84187
84188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
84189         LDKBlindedPath this_ptr_conv;
84190         this_ptr_conv.inner = untag_ptr(this_ptr);
84191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84193         this_ptr_conv.is_owned = false;
84194         LDKPublicKey val_ref;
84195         CHECK((*env)->GetArrayLength(env, val) == 33);
84196         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
84197         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
84198 }
84199
84200 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
84201         LDKBlindedPath this_ptr_conv;
84202         this_ptr_conv.inner = untag_ptr(this_ptr);
84203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84205         this_ptr_conv.is_owned = false;
84206         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
84207         int64_tArray ret_arr = NULL;
84208         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
84209         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
84210         for (size_t m = 0; m < ret_var.datalen; m++) {
84211                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
84212                 int64_t ret_conv_12_ref = 0;
84213                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
84214                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
84215                 ret_arr_ptr[m] = ret_conv_12_ref;
84216         }
84217         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
84218         FREE(ret_var.data);
84219         return ret_arr;
84220 }
84221
84222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
84223         LDKBlindedPath this_ptr_conv;
84224         this_ptr_conv.inner = untag_ptr(this_ptr);
84225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84227         this_ptr_conv.is_owned = false;
84228         LDKCVec_BlindedHopZ val_constr;
84229         val_constr.datalen = (*env)->GetArrayLength(env, val);
84230         if (val_constr.datalen > 0)
84231                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
84232         else
84233                 val_constr.data = NULL;
84234         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
84235         for (size_t m = 0; m < val_constr.datalen; m++) {
84236                 int64_t val_conv_12 = val_vals[m];
84237                 LDKBlindedHop val_conv_12_conv;
84238                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
84239                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
84240                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
84241                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
84242                 val_constr.data[m] = val_conv_12_conv;
84243         }
84244         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
84245         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
84246 }
84247
84248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int64_t introduction_node_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
84249         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
84250         CHECK_ACCESS(introduction_node_arg_ptr);
84251         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
84252         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
84253         LDKPublicKey blinding_point_arg_ref;
84254         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
84255         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
84256         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
84257         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
84258         if (blinded_hops_arg_constr.datalen > 0)
84259                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
84260         else
84261                 blinded_hops_arg_constr.data = NULL;
84262         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
84263         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
84264                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
84265                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
84266                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
84267                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
84268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
84269                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
84270                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
84271         }
84272         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
84273         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
84274         int64_t ret_ref = 0;
84275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84277         return ret_ref;
84278 }
84279
84280 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
84281         LDKBlindedPath ret_var = BlindedPath_clone(arg);
84282         int64_t ret_ref = 0;
84283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84285         return ret_ref;
84286 }
84287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84288         LDKBlindedPath arg_conv;
84289         arg_conv.inner = untag_ptr(arg);
84290         arg_conv.is_owned = ptr_is_owned(arg);
84291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84292         arg_conv.is_owned = false;
84293         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
84294         return ret_conv;
84295 }
84296
84297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84298         LDKBlindedPath orig_conv;
84299         orig_conv.inner = untag_ptr(orig);
84300         orig_conv.is_owned = ptr_is_owned(orig);
84301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84302         orig_conv.is_owned = false;
84303         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
84304         int64_t ret_ref = 0;
84305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84307         return ret_ref;
84308 }
84309
84310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
84311         LDKBlindedPath o_conv;
84312         o_conv.inner = untag_ptr(o);
84313         o_conv.is_owned = ptr_is_owned(o);
84314         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84315         o_conv.is_owned = false;
84316         int64_t ret_conv = BlindedPath_hash(&o_conv);
84317         return ret_conv;
84318 }
84319
84320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84321         LDKBlindedPath a_conv;
84322         a_conv.inner = untag_ptr(a);
84323         a_conv.is_owned = ptr_is_owned(a);
84324         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84325         a_conv.is_owned = false;
84326         LDKBlindedPath b_conv;
84327         b_conv.inner = untag_ptr(b);
84328         b_conv.is_owned = ptr_is_owned(b);
84329         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84330         b_conv.is_owned = false;
84331         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
84332         return ret_conv;
84333 }
84334
84335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84336         if (!ptr_is_owned(this_ptr)) return;
84337         void* this_ptr_ptr = untag_ptr(this_ptr);
84338         CHECK_ACCESS(this_ptr_ptr);
84339         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
84340         FREE(untag_ptr(this_ptr));
84341         IntroductionNode_free(this_ptr_conv);
84342 }
84343
84344 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
84345         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
84346         *ret_copy = IntroductionNode_clone(arg);
84347         int64_t ret_ref = tag_ptr(ret_copy, true);
84348         return ret_ref;
84349 }
84350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84351         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
84352         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
84353         return ret_conv;
84354 }
84355
84356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84357         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
84358         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
84359         *ret_copy = IntroductionNode_clone(orig_conv);
84360         int64_t ret_ref = tag_ptr(ret_copy, true);
84361         return ret_ref;
84362 }
84363
84364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1node_1id(JNIEnv *env, jclass clz, int8_tArray a) {
84365         LDKPublicKey a_ref;
84366         CHECK((*env)->GetArrayLength(env, a) == 33);
84367         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
84368         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
84369         *ret_copy = IntroductionNode_node_id(a_ref);
84370         int64_t ret_ref = tag_ptr(ret_copy, true);
84371         return ret_ref;
84372 }
84373
84374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1directed_1short_1channel_1id(JNIEnv *env, jclass clz, jclass a, int64_t b) {
84375         LDKDirection a_conv = LDKDirection_from_java(env, a);
84376         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
84377         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
84378         int64_t ret_ref = tag_ptr(ret_copy, true);
84379         return ret_ref;
84380 }
84381
84382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1hash(JNIEnv *env, jclass clz, int64_t o) {
84383         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
84384         int64_t ret_conv = IntroductionNode_hash(o_conv);
84385         return ret_conv;
84386 }
84387
84388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84389         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
84390         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
84391         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
84392         return ret_conv;
84393 }
84394
84395 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84396         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
84397         jclass ret_conv = LDKDirection_to_java(env, Direction_clone(orig_conv));
84398         return ret_conv;
84399 }
84400
84401 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1node_1one(JNIEnv *env, jclass clz) {
84402         jclass ret_conv = LDKDirection_to_java(env, Direction_node_one());
84403         return ret_conv;
84404 }
84405
84406 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1node_1two(JNIEnv *env, jclass clz) {
84407         jclass ret_conv = LDKDirection_to_java(env, Direction_node_two());
84408         return ret_conv;
84409 }
84410
84411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Direction_1hash(JNIEnv *env, jclass clz, int64_t o) {
84412         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
84413         int64_t ret_conv = Direction_hash(o_conv);
84414         return ret_conv;
84415 }
84416
84417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Direction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84418         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
84419         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
84420         jboolean ret_conv = Direction_eq(a_conv, b_conv);
84421         return ret_conv;
84422 }
84423
84424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeIdLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84425         if (!ptr_is_owned(this_ptr)) return;
84426         void* this_ptr_ptr = untag_ptr(this_ptr);
84427         CHECK_ACCESS(this_ptr_ptr);
84428         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
84429         FREE(untag_ptr(this_ptr));
84430         NodeIdLookUp_free(this_ptr_conv);
84431 }
84432
84433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84434         LDKEmptyNodeIdLookUp this_obj_conv;
84435         this_obj_conv.inner = untag_ptr(this_obj);
84436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84438         EmptyNodeIdLookUp_free(this_obj_conv);
84439 }
84440
84441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1new(JNIEnv *env, jclass clz) {
84442         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
84443         int64_t ret_ref = 0;
84444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84446         return ret_ref;
84447 }
84448
84449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1as_1NodeIdLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
84450         LDKEmptyNodeIdLookUp this_arg_conv;
84451         this_arg_conv.inner = untag_ptr(this_arg);
84452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84454         this_arg_conv.is_owned = false;
84455         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
84456         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
84457         return tag_ptr(ret_ret, true);
84458 }
84459
84460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84461         LDKBlindedHop this_obj_conv;
84462         this_obj_conv.inner = untag_ptr(this_obj);
84463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84465         BlindedHop_free(this_obj_conv);
84466 }
84467
84468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84469         LDKBlindedHop this_ptr_conv;
84470         this_ptr_conv.inner = untag_ptr(this_ptr);
84471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84473         this_ptr_conv.is_owned = false;
84474         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
84475         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
84476         return ret_arr;
84477 }
84478
84479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
84480         LDKBlindedHop this_ptr_conv;
84481         this_ptr_conv.inner = untag_ptr(this_ptr);
84482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84484         this_ptr_conv.is_owned = false;
84485         LDKPublicKey val_ref;
84486         CHECK((*env)->GetArrayLength(env, val) == 33);
84487         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
84488         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
84489 }
84490
84491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
84492         LDKBlindedHop this_ptr_conv;
84493         this_ptr_conv.inner = untag_ptr(this_ptr);
84494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84496         this_ptr_conv.is_owned = false;
84497         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
84498         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84499         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84500         CVec_u8Z_free(ret_var);
84501         return ret_arr;
84502 }
84503
84504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
84505         LDKBlindedHop this_ptr_conv;
84506         this_ptr_conv.inner = untag_ptr(this_ptr);
84507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84509         this_ptr_conv.is_owned = false;
84510         LDKCVec_u8Z val_ref;
84511         val_ref.datalen = (*env)->GetArrayLength(env, val);
84512         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
84513         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
84514         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
84515 }
84516
84517 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) {
84518         LDKPublicKey blinded_node_id_arg_ref;
84519         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
84520         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
84521         LDKCVec_u8Z encrypted_payload_arg_ref;
84522         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
84523         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
84524         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
84525         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
84526         int64_t ret_ref = 0;
84527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84529         return ret_ref;
84530 }
84531
84532 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
84533         LDKBlindedHop ret_var = BlindedHop_clone(arg);
84534         int64_t ret_ref = 0;
84535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84537         return ret_ref;
84538 }
84539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84540         LDKBlindedHop arg_conv;
84541         arg_conv.inner = untag_ptr(arg);
84542         arg_conv.is_owned = ptr_is_owned(arg);
84543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84544         arg_conv.is_owned = false;
84545         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
84546         return ret_conv;
84547 }
84548
84549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84550         LDKBlindedHop orig_conv;
84551         orig_conv.inner = untag_ptr(orig);
84552         orig_conv.is_owned = ptr_is_owned(orig);
84553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84554         orig_conv.is_owned = false;
84555         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
84556         int64_t ret_ref = 0;
84557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84559         return ret_ref;
84560 }
84561
84562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
84563         LDKBlindedHop o_conv;
84564         o_conv.inner = untag_ptr(o);
84565         o_conv.is_owned = ptr_is_owned(o);
84566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84567         o_conv.is_owned = false;
84568         int64_t ret_conv = BlindedHop_hash(&o_conv);
84569         return ret_conv;
84570 }
84571
84572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84573         LDKBlindedHop a_conv;
84574         a_conv.inner = untag_ptr(a);
84575         a_conv.is_owned = ptr_is_owned(a);
84576         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84577         a_conv.is_owned = false;
84578         LDKBlindedHop b_conv;
84579         b_conv.inner = untag_ptr(b);
84580         b_conv.is_owned = ptr_is_owned(b);
84581         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84582         b_conv.is_owned = false;
84583         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
84584         return ret_conv;
84585 }
84586
84587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1message(JNIEnv *env, jclass clz, int8_tArray recipient_node_id, int64_t entropy_source) {
84588         LDKPublicKey recipient_node_id_ref;
84589         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
84590         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
84591         void* entropy_source_ptr = untag_ptr(entropy_source);
84592         CHECK_ACCESS(entropy_source_ptr);
84593         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
84594         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
84595                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84596                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
84597         }
84598         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
84599         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
84600         return tag_ptr(ret_conv, true);
84601 }
84602
84603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
84604         LDKCVec_PublicKeyZ node_pks_constr;
84605         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
84606         if (node_pks_constr.datalen > 0)
84607                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
84608         else
84609                 node_pks_constr.data = NULL;
84610         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
84611                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
84612                 LDKPublicKey node_pks_conv_8_ref;
84613                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
84614                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
84615                 node_pks_constr.data[i] = node_pks_conv_8_ref;
84616         }
84617         void* entropy_source_ptr = untag_ptr(entropy_source);
84618         CHECK_ACCESS(entropy_source_ptr);
84619         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
84620         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
84621                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84622                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
84623         }
84624         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
84625         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
84626         return tag_ptr(ret_conv, true);
84627 }
84628
84629 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, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
84630         LDKPublicKey payee_node_id_ref;
84631         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
84632         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
84633         LDKReceiveTlvs payee_tlvs_conv;
84634         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
84635         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
84636         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
84637         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
84638         void* entropy_source_ptr = untag_ptr(entropy_source);
84639         CHECK_ACCESS(entropy_source_ptr);
84640         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
84641         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
84642                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84643                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
84644         }
84645         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
84646         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
84647         return tag_ptr(ret_conv, true);
84648 }
84649
84650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1payment(JNIEnv *env, jclass clz, int64_tArray intermediate_nodes, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t htlc_maximum_msat, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
84651         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
84652         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
84653         if (intermediate_nodes_constr.datalen > 0)
84654                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
84655         else
84656                 intermediate_nodes_constr.data = NULL;
84657         int64_t* intermediate_nodes_vals = (*env)->GetLongArrayElements (env, intermediate_nodes, NULL);
84658         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
84659                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
84660                 LDKForwardNode intermediate_nodes_conv_13_conv;
84661                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
84662                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
84663                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
84664                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
84665                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
84666         }
84667         (*env)->ReleaseLongArrayElements(env, intermediate_nodes, intermediate_nodes_vals, 0);
84668         LDKPublicKey payee_node_id_ref;
84669         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
84670         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
84671         LDKReceiveTlvs payee_tlvs_conv;
84672         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
84673         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
84674         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
84675         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
84676         void* entropy_source_ptr = untag_ptr(entropy_source);
84677         CHECK_ACCESS(entropy_source_ptr);
84678         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
84679         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
84680                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84681                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
84682         }
84683         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
84684         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, min_final_cltv_expiry_delta, entropy_source_conv);
84685         return tag_ptr(ret_conv, true);
84686 }
84687
84688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1public_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
84689         LDKBlindedPath this_arg_conv;
84690         this_arg_conv.inner = untag_ptr(this_arg);
84691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84693         this_arg_conv.is_owned = false;
84694         LDKReadOnlyNetworkGraph network_graph_conv;
84695         network_graph_conv.inner = untag_ptr(network_graph);
84696         network_graph_conv.is_owned = ptr_is_owned(network_graph);
84697         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
84698         network_graph_conv.is_owned = false;
84699         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
84700         int64_t ret_ref = 0;
84701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84703         return ret_ref;
84704 }
84705
84706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
84707         LDKBlindedPath obj_conv;
84708         obj_conv.inner = untag_ptr(obj);
84709         obj_conv.is_owned = ptr_is_owned(obj);
84710         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84711         obj_conv.is_owned = false;
84712         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
84713         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84714         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84715         CVec_u8Z_free(ret_var);
84716         return ret_arr;
84717 }
84718
84719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84720         LDKu8slice ser_ref;
84721         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84722         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84723         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
84724         *ret_conv = BlindedPath_read(ser_ref);
84725         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84726         return tag_ptr(ret_conv, true);
84727 }
84728
84729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
84730         LDKBlindedHop obj_conv;
84731         obj_conv.inner = untag_ptr(obj);
84732         obj_conv.is_owned = ptr_is_owned(obj);
84733         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84734         obj_conv.is_owned = false;
84735         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
84736         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84737         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84738         CVec_u8Z_free(ret_var);
84739         return ret_arr;
84740 }
84741
84742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84743         LDKu8slice ser_ref;
84744         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84745         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84746         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
84747         *ret_conv = BlindedHop_read(ser_ref);
84748         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84749         return tag_ptr(ret_conv, true);
84750 }
84751
84752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84753         LDKForwardNode this_obj_conv;
84754         this_obj_conv.inner = untag_ptr(this_obj);
84755         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84757         ForwardNode_free(this_obj_conv);
84758 }
84759
84760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
84761         LDKForwardNode this_ptr_conv;
84762         this_ptr_conv.inner = untag_ptr(this_ptr);
84763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84765         this_ptr_conv.is_owned = false;
84766         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
84767         int64_t ret_ref = 0;
84768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84770         return ret_ref;
84771 }
84772
84773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84774         LDKForwardNode this_ptr_conv;
84775         this_ptr_conv.inner = untag_ptr(this_ptr);
84776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84778         this_ptr_conv.is_owned = false;
84779         LDKForwardTlvs val_conv;
84780         val_conv.inner = untag_ptr(val);
84781         val_conv.is_owned = ptr_is_owned(val);
84782         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
84783         val_conv = ForwardTlvs_clone(&val_conv);
84784         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
84785 }
84786
84787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84788         LDKForwardNode this_ptr_conv;
84789         this_ptr_conv.inner = untag_ptr(this_ptr);
84790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84792         this_ptr_conv.is_owned = false;
84793         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
84794         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
84795         return ret_arr;
84796 }
84797
84798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
84799         LDKForwardNode this_ptr_conv;
84800         this_ptr_conv.inner = untag_ptr(this_ptr);
84801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84803         this_ptr_conv.is_owned = false;
84804         LDKPublicKey val_ref;
84805         CHECK((*env)->GetArrayLength(env, val) == 33);
84806         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
84807         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
84808 }
84809
84810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
84811         LDKForwardNode this_ptr_conv;
84812         this_ptr_conv.inner = untag_ptr(this_ptr);
84813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84815         this_ptr_conv.is_owned = false;
84816         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
84817         return ret_conv;
84818 }
84819
84820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84821         LDKForwardNode this_ptr_conv;
84822         this_ptr_conv.inner = untag_ptr(this_ptr);
84823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84825         this_ptr_conv.is_owned = false;
84826         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
84827 }
84828
84829 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) {
84830         LDKForwardTlvs tlvs_arg_conv;
84831         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
84832         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
84833         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
84834         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
84835         LDKPublicKey node_id_arg_ref;
84836         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
84837         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
84838         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
84839         int64_t ret_ref = 0;
84840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84842         return ret_ref;
84843 }
84844
84845 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
84846         LDKForwardNode ret_var = ForwardNode_clone(arg);
84847         int64_t ret_ref = 0;
84848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84850         return ret_ref;
84851 }
84852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84853         LDKForwardNode arg_conv;
84854         arg_conv.inner = untag_ptr(arg);
84855         arg_conv.is_owned = ptr_is_owned(arg);
84856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84857         arg_conv.is_owned = false;
84858         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
84859         return ret_conv;
84860 }
84861
84862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84863         LDKForwardNode orig_conv;
84864         orig_conv.inner = untag_ptr(orig);
84865         orig_conv.is_owned = ptr_is_owned(orig);
84866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84867         orig_conv.is_owned = false;
84868         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
84869         int64_t ret_ref = 0;
84870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84872         return ret_ref;
84873 }
84874
84875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84876         LDKForwardTlvs this_obj_conv;
84877         this_obj_conv.inner = untag_ptr(this_obj);
84878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84880         ForwardTlvs_free(this_obj_conv);
84881 }
84882
84883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84884         LDKForwardTlvs this_ptr_conv;
84885         this_ptr_conv.inner = untag_ptr(this_ptr);
84886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84888         this_ptr_conv.is_owned = false;
84889         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
84890         return ret_conv;
84891 }
84892
84893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84894         LDKForwardTlvs this_ptr_conv;
84895         this_ptr_conv.inner = untag_ptr(this_ptr);
84896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84898         this_ptr_conv.is_owned = false;
84899         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
84900 }
84901
84902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
84903         LDKForwardTlvs this_ptr_conv;
84904         this_ptr_conv.inner = untag_ptr(this_ptr);
84905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84907         this_ptr_conv.is_owned = false;
84908         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
84909         int64_t ret_ref = 0;
84910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84912         return ret_ref;
84913 }
84914
84915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84916         LDKForwardTlvs this_ptr_conv;
84917         this_ptr_conv.inner = untag_ptr(this_ptr);
84918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84920         this_ptr_conv.is_owned = false;
84921         LDKPaymentRelay val_conv;
84922         val_conv.inner = untag_ptr(val);
84923         val_conv.is_owned = ptr_is_owned(val);
84924         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
84925         val_conv = PaymentRelay_clone(&val_conv);
84926         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
84927 }
84928
84929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
84930         LDKForwardTlvs this_ptr_conv;
84931         this_ptr_conv.inner = untag_ptr(this_ptr);
84932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84934         this_ptr_conv.is_owned = false;
84935         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
84936         int64_t ret_ref = 0;
84937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84939         return ret_ref;
84940 }
84941
84942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84943         LDKForwardTlvs this_ptr_conv;
84944         this_ptr_conv.inner = untag_ptr(this_ptr);
84945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84947         this_ptr_conv.is_owned = false;
84948         LDKPaymentConstraints val_conv;
84949         val_conv.inner = untag_ptr(val);
84950         val_conv.is_owned = ptr_is_owned(val);
84951         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
84952         val_conv = PaymentConstraints_clone(&val_conv);
84953         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
84954 }
84955
84956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
84957         LDKForwardTlvs this_ptr_conv;
84958         this_ptr_conv.inner = untag_ptr(this_ptr);
84959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84961         this_ptr_conv.is_owned = false;
84962         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
84963         int64_t ret_ref = 0;
84964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84966         return ret_ref;
84967 }
84968
84969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84970         LDKForwardTlvs this_ptr_conv;
84971         this_ptr_conv.inner = untag_ptr(this_ptr);
84972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84974         this_ptr_conv.is_owned = false;
84975         LDKBlindedHopFeatures val_conv;
84976         val_conv.inner = untag_ptr(val);
84977         val_conv.is_owned = ptr_is_owned(val);
84978         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
84979         val_conv = BlindedHopFeatures_clone(&val_conv);
84980         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
84981 }
84982
84983 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) {
84984         LDKPaymentRelay payment_relay_arg_conv;
84985         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
84986         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
84987         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
84988         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
84989         LDKPaymentConstraints payment_constraints_arg_conv;
84990         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
84991         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
84992         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
84993         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
84994         LDKBlindedHopFeatures features_arg_conv;
84995         features_arg_conv.inner = untag_ptr(features_arg);
84996         features_arg_conv.is_owned = ptr_is_owned(features_arg);
84997         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
84998         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
84999         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
85000         int64_t ret_ref = 0;
85001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85003         return ret_ref;
85004 }
85005
85006 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
85007         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
85008         int64_t ret_ref = 0;
85009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85011         return ret_ref;
85012 }
85013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85014         LDKForwardTlvs arg_conv;
85015         arg_conv.inner = untag_ptr(arg);
85016         arg_conv.is_owned = ptr_is_owned(arg);
85017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85018         arg_conv.is_owned = false;
85019         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
85020         return ret_conv;
85021 }
85022
85023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85024         LDKForwardTlvs orig_conv;
85025         orig_conv.inner = untag_ptr(orig);
85026         orig_conv.is_owned = ptr_is_owned(orig);
85027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85028         orig_conv.is_owned = false;
85029         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
85030         int64_t ret_ref = 0;
85031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85033         return ret_ref;
85034 }
85035
85036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85037         LDKReceiveTlvs this_obj_conv;
85038         this_obj_conv.inner = untag_ptr(this_obj);
85039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85041         ReceiveTlvs_free(this_obj_conv);
85042 }
85043
85044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
85045         LDKReceiveTlvs this_ptr_conv;
85046         this_ptr_conv.inner = untag_ptr(this_ptr);
85047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85049         this_ptr_conv.is_owned = false;
85050         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
85051         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
85052         return ret_arr;
85053 }
85054
85055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
85056         LDKReceiveTlvs this_ptr_conv;
85057         this_ptr_conv.inner = untag_ptr(this_ptr);
85058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85060         this_ptr_conv.is_owned = false;
85061         LDKThirtyTwoBytes val_ref;
85062         CHECK((*env)->GetArrayLength(env, val) == 32);
85063         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
85064         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
85065 }
85066
85067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
85068         LDKReceiveTlvs this_ptr_conv;
85069         this_ptr_conv.inner = untag_ptr(this_ptr);
85070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85072         this_ptr_conv.is_owned = false;
85073         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
85074         int64_t ret_ref = 0;
85075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85077         return ret_ref;
85078 }
85079
85080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
85081         LDKReceiveTlvs this_ptr_conv;
85082         this_ptr_conv.inner = untag_ptr(this_ptr);
85083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85085         this_ptr_conv.is_owned = false;
85086         LDKPaymentConstraints val_conv;
85087         val_conv.inner = untag_ptr(val);
85088         val_conv.is_owned = ptr_is_owned(val);
85089         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
85090         val_conv = PaymentConstraints_clone(&val_conv);
85091         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
85092 }
85093
85094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1context(JNIEnv *env, jclass clz, int64_t this_ptr) {
85095         LDKReceiveTlvs this_ptr_conv;
85096         this_ptr_conv.inner = untag_ptr(this_ptr);
85097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85099         this_ptr_conv.is_owned = false;
85100         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
85101         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
85102         int64_t ret_ref = tag_ptr(ret_copy, true);
85103         return ret_ref;
85104 }
85105
85106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1context(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
85107         LDKReceiveTlvs this_ptr_conv;
85108         this_ptr_conv.inner = untag_ptr(this_ptr);
85109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85111         this_ptr_conv.is_owned = false;
85112         void* val_ptr = untag_ptr(val);
85113         CHECK_ACCESS(val_ptr);
85114         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
85115         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
85116         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
85117 }
85118
85119 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, int64_t payment_context_arg) {
85120         LDKThirtyTwoBytes payment_secret_arg_ref;
85121         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
85122         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
85123         LDKPaymentConstraints payment_constraints_arg_conv;
85124         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
85125         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
85126         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
85127         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
85128         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
85129         CHECK_ACCESS(payment_context_arg_ptr);
85130         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
85131         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
85132         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
85133         int64_t ret_ref = 0;
85134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85136         return ret_ref;
85137 }
85138
85139 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
85140         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
85141         int64_t ret_ref = 0;
85142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85144         return ret_ref;
85145 }
85146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85147         LDKReceiveTlvs arg_conv;
85148         arg_conv.inner = untag_ptr(arg);
85149         arg_conv.is_owned = ptr_is_owned(arg);
85150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85151         arg_conv.is_owned = false;
85152         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
85153         return ret_conv;
85154 }
85155
85156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85157         LDKReceiveTlvs orig_conv;
85158         orig_conv.inner = untag_ptr(orig);
85159         orig_conv.is_owned = ptr_is_owned(orig);
85160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85161         orig_conv.is_owned = false;
85162         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
85163         int64_t ret_ref = 0;
85164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85166         return ret_ref;
85167 }
85168
85169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85170         LDKPaymentRelay this_obj_conv;
85171         this_obj_conv.inner = untag_ptr(this_obj);
85172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85174         PaymentRelay_free(this_obj_conv);
85175 }
85176
85177 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
85178         LDKPaymentRelay this_ptr_conv;
85179         this_ptr_conv.inner = untag_ptr(this_ptr);
85180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85182         this_ptr_conv.is_owned = false;
85183         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
85184         return ret_conv;
85185 }
85186
85187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
85188         LDKPaymentRelay this_ptr_conv;
85189         this_ptr_conv.inner = untag_ptr(this_ptr);
85190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85192         this_ptr_conv.is_owned = false;
85193         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
85194 }
85195
85196 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
85197         LDKPaymentRelay this_ptr_conv;
85198         this_ptr_conv.inner = untag_ptr(this_ptr);
85199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85201         this_ptr_conv.is_owned = false;
85202         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
85203         return ret_conv;
85204 }
85205
85206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
85207         LDKPaymentRelay this_ptr_conv;
85208         this_ptr_conv.inner = untag_ptr(this_ptr);
85209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85211         this_ptr_conv.is_owned = false;
85212         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
85213 }
85214
85215 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
85216         LDKPaymentRelay this_ptr_conv;
85217         this_ptr_conv.inner = untag_ptr(this_ptr);
85218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85220         this_ptr_conv.is_owned = false;
85221         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
85222         return ret_conv;
85223 }
85224
85225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
85226         LDKPaymentRelay this_ptr_conv;
85227         this_ptr_conv.inner = untag_ptr(this_ptr);
85228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85230         this_ptr_conv.is_owned = false;
85231         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
85232 }
85233
85234 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) {
85235         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
85236         int64_t ret_ref = 0;
85237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85239         return ret_ref;
85240 }
85241
85242 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
85243         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
85244         int64_t ret_ref = 0;
85245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85247         return ret_ref;
85248 }
85249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85250         LDKPaymentRelay arg_conv;
85251         arg_conv.inner = untag_ptr(arg);
85252         arg_conv.is_owned = ptr_is_owned(arg);
85253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85254         arg_conv.is_owned = false;
85255         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
85256         return ret_conv;
85257 }
85258
85259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85260         LDKPaymentRelay orig_conv;
85261         orig_conv.inner = untag_ptr(orig);
85262         orig_conv.is_owned = ptr_is_owned(orig);
85263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85264         orig_conv.is_owned = false;
85265         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
85266         int64_t ret_ref = 0;
85267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85269         return ret_ref;
85270 }
85271
85272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85273         LDKPaymentConstraints this_obj_conv;
85274         this_obj_conv.inner = untag_ptr(this_obj);
85275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85277         PaymentConstraints_free(this_obj_conv);
85278 }
85279
85280 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
85281         LDKPaymentConstraints this_ptr_conv;
85282         this_ptr_conv.inner = untag_ptr(this_ptr);
85283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85285         this_ptr_conv.is_owned = false;
85286         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
85287         return ret_conv;
85288 }
85289
85290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
85291         LDKPaymentConstraints this_ptr_conv;
85292         this_ptr_conv.inner = untag_ptr(this_ptr);
85293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85295         this_ptr_conv.is_owned = false;
85296         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
85297 }
85298
85299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
85300         LDKPaymentConstraints this_ptr_conv;
85301         this_ptr_conv.inner = untag_ptr(this_ptr);
85302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85304         this_ptr_conv.is_owned = false;
85305         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
85306         return ret_conv;
85307 }
85308
85309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
85310         LDKPaymentConstraints this_ptr_conv;
85311         this_ptr_conv.inner = untag_ptr(this_ptr);
85312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85314         this_ptr_conv.is_owned = false;
85315         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
85316 }
85317
85318 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) {
85319         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
85320         int64_t ret_ref = 0;
85321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85323         return ret_ref;
85324 }
85325
85326 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
85327         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
85328         int64_t ret_ref = 0;
85329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85331         return ret_ref;
85332 }
85333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85334         LDKPaymentConstraints arg_conv;
85335         arg_conv.inner = untag_ptr(arg);
85336         arg_conv.is_owned = ptr_is_owned(arg);
85337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85338         arg_conv.is_owned = false;
85339         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
85340         return ret_conv;
85341 }
85342
85343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85344         LDKPaymentConstraints orig_conv;
85345         orig_conv.inner = untag_ptr(orig);
85346         orig_conv.is_owned = ptr_is_owned(orig);
85347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85348         orig_conv.is_owned = false;
85349         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
85350         int64_t ret_ref = 0;
85351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85353         return ret_ref;
85354 }
85355
85356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentContext_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
85357         if (!ptr_is_owned(this_ptr)) return;
85358         void* this_ptr_ptr = untag_ptr(this_ptr);
85359         CHECK_ACCESS(this_ptr_ptr);
85360         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
85361         FREE(untag_ptr(this_ptr));
85362         PaymentContext_free(this_ptr_conv);
85363 }
85364
85365 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
85366         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
85367         *ret_copy = PaymentContext_clone(arg);
85368         int64_t ret_ref = tag_ptr(ret_copy, true);
85369         return ret_ref;
85370 }
85371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85372         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
85373         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
85374         return ret_conv;
85375 }
85376
85377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85378         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
85379         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
85380         *ret_copy = PaymentContext_clone(orig_conv);
85381         int64_t ret_ref = tag_ptr(ret_copy, true);
85382         return ret_ref;
85383 }
85384
85385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1unknown(JNIEnv *env, jclass clz, int64_t a) {
85386         LDKUnknownPaymentContext a_conv;
85387         a_conv.inner = untag_ptr(a);
85388         a_conv.is_owned = ptr_is_owned(a);
85389         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85390         a_conv = UnknownPaymentContext_clone(&a_conv);
85391         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
85392         *ret_copy = PaymentContext_unknown(a_conv);
85393         int64_t ret_ref = tag_ptr(ret_copy, true);
85394         return ret_ref;
85395 }
85396
85397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1bolt12_1offer(JNIEnv *env, jclass clz, int64_t a) {
85398         LDKBolt12OfferContext a_conv;
85399         a_conv.inner = untag_ptr(a);
85400         a_conv.is_owned = ptr_is_owned(a);
85401         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85402         a_conv = Bolt12OfferContext_clone(&a_conv);
85403         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
85404         *ret_copy = PaymentContext_bolt12_offer(a_conv);
85405         int64_t ret_ref = tag_ptr(ret_copy, true);
85406         return ret_ref;
85407 }
85408
85409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1bolt12_1refund(JNIEnv *env, jclass clz, int64_t a) {
85410         LDKBolt12RefundContext a_conv;
85411         a_conv.inner = untag_ptr(a);
85412         a_conv.is_owned = ptr_is_owned(a);
85413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85414         a_conv = Bolt12RefundContext_clone(&a_conv);
85415         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
85416         *ret_copy = PaymentContext_bolt12_refund(a_conv);
85417         int64_t ret_ref = tag_ptr(ret_copy, true);
85418         return ret_ref;
85419 }
85420
85421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85422         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
85423         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
85424         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
85425         return ret_conv;
85426 }
85427
85428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85429         LDKUnknownPaymentContext this_obj_conv;
85430         this_obj_conv.inner = untag_ptr(this_obj);
85431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85433         UnknownPaymentContext_free(this_obj_conv);
85434 }
85435
85436 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
85437         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
85438         int64_t ret_ref = 0;
85439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85441         return ret_ref;
85442 }
85443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85444         LDKUnknownPaymentContext arg_conv;
85445         arg_conv.inner = untag_ptr(arg);
85446         arg_conv.is_owned = ptr_is_owned(arg);
85447         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85448         arg_conv.is_owned = false;
85449         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
85450         return ret_conv;
85451 }
85452
85453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85454         LDKUnknownPaymentContext orig_conv;
85455         orig_conv.inner = untag_ptr(orig);
85456         orig_conv.is_owned = ptr_is_owned(orig);
85457         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85458         orig_conv.is_owned = false;
85459         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
85460         int64_t ret_ref = 0;
85461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85463         return ret_ref;
85464 }
85465
85466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85467         LDKUnknownPaymentContext a_conv;
85468         a_conv.inner = untag_ptr(a);
85469         a_conv.is_owned = ptr_is_owned(a);
85470         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85471         a_conv.is_owned = false;
85472         LDKUnknownPaymentContext b_conv;
85473         b_conv.inner = untag_ptr(b);
85474         b_conv.is_owned = ptr_is_owned(b);
85475         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
85476         b_conv.is_owned = false;
85477         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
85478         return ret_conv;
85479 }
85480
85481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85482         LDKBolt12OfferContext this_obj_conv;
85483         this_obj_conv.inner = untag_ptr(this_obj);
85484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85486         Bolt12OfferContext_free(this_obj_conv);
85487 }
85488
85489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1get_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
85490         LDKBolt12OfferContext this_ptr_conv;
85491         this_ptr_conv.inner = untag_ptr(this_ptr);
85492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85494         this_ptr_conv.is_owned = false;
85495         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
85496         int64_t ret_ref = 0;
85497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85499         return ret_ref;
85500 }
85501
85502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1set_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
85503         LDKBolt12OfferContext this_ptr_conv;
85504         this_ptr_conv.inner = untag_ptr(this_ptr);
85505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85507         this_ptr_conv.is_owned = false;
85508         LDKOfferId val_conv;
85509         val_conv.inner = untag_ptr(val);
85510         val_conv.is_owned = ptr_is_owned(val);
85511         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
85512         val_conv = OfferId_clone(&val_conv);
85513         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
85514 }
85515
85516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1get_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_ptr) {
85517         LDKBolt12OfferContext this_ptr_conv;
85518         this_ptr_conv.inner = untag_ptr(this_ptr);
85519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85521         this_ptr_conv.is_owned = false;
85522         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
85523         int64_t ret_ref = 0;
85524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85526         return ret_ref;
85527 }
85528
85529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1set_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
85530         LDKBolt12OfferContext this_ptr_conv;
85531         this_ptr_conv.inner = untag_ptr(this_ptr);
85532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85534         this_ptr_conv.is_owned = false;
85535         LDKInvoiceRequestFields val_conv;
85536         val_conv.inner = untag_ptr(val);
85537         val_conv.is_owned = ptr_is_owned(val);
85538         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
85539         val_conv = InvoiceRequestFields_clone(&val_conv);
85540         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
85541 }
85542
85543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1new(JNIEnv *env, jclass clz, int64_t offer_id_arg, int64_t invoice_request_arg) {
85544         LDKOfferId offer_id_arg_conv;
85545         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
85546         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
85547         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
85548         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
85549         LDKInvoiceRequestFields invoice_request_arg_conv;
85550         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
85551         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
85552         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
85553         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
85554         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
85555         int64_t ret_ref = 0;
85556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85558         return ret_ref;
85559 }
85560
85561 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
85562         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
85563         int64_t ret_ref = 0;
85564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85566         return ret_ref;
85567 }
85568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85569         LDKBolt12OfferContext arg_conv;
85570         arg_conv.inner = untag_ptr(arg);
85571         arg_conv.is_owned = ptr_is_owned(arg);
85572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85573         arg_conv.is_owned = false;
85574         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
85575         return ret_conv;
85576 }
85577
85578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85579         LDKBolt12OfferContext orig_conv;
85580         orig_conv.inner = untag_ptr(orig);
85581         orig_conv.is_owned = ptr_is_owned(orig);
85582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85583         orig_conv.is_owned = false;
85584         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
85585         int64_t ret_ref = 0;
85586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85588         return ret_ref;
85589 }
85590
85591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85592         LDKBolt12OfferContext a_conv;
85593         a_conv.inner = untag_ptr(a);
85594         a_conv.is_owned = ptr_is_owned(a);
85595         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85596         a_conv.is_owned = false;
85597         LDKBolt12OfferContext b_conv;
85598         b_conv.inner = untag_ptr(b);
85599         b_conv.is_owned = ptr_is_owned(b);
85600         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
85601         b_conv.is_owned = false;
85602         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
85603         return ret_conv;
85604 }
85605
85606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85607         LDKBolt12RefundContext this_obj_conv;
85608         this_obj_conv.inner = untag_ptr(this_obj);
85609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85611         Bolt12RefundContext_free(this_obj_conv);
85612 }
85613
85614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1new(JNIEnv *env, jclass clz) {
85615         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
85616         int64_t ret_ref = 0;
85617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85619         return ret_ref;
85620 }
85621
85622 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
85623         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
85624         int64_t ret_ref = 0;
85625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85627         return ret_ref;
85628 }
85629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85630         LDKBolt12RefundContext arg_conv;
85631         arg_conv.inner = untag_ptr(arg);
85632         arg_conv.is_owned = ptr_is_owned(arg);
85633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
85634         arg_conv.is_owned = false;
85635         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
85636         return ret_conv;
85637 }
85638
85639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85640         LDKBolt12RefundContext orig_conv;
85641         orig_conv.inner = untag_ptr(orig);
85642         orig_conv.is_owned = ptr_is_owned(orig);
85643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
85644         orig_conv.is_owned = false;
85645         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
85646         int64_t ret_ref = 0;
85647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85649         return ret_ref;
85650 }
85651
85652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85653         LDKBolt12RefundContext a_conv;
85654         a_conv.inner = untag_ptr(a);
85655         a_conv.is_owned = ptr_is_owned(a);
85656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85657         a_conv.is_owned = false;
85658         LDKBolt12RefundContext b_conv;
85659         b_conv.inner = untag_ptr(b);
85660         b_conv.is_owned = ptr_is_owned(b);
85661         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
85662         b_conv.is_owned = false;
85663         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
85664         return ret_conv;
85665 }
85666
85667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
85668         LDKForwardTlvs obj_conv;
85669         obj_conv.inner = untag_ptr(obj);
85670         obj_conv.is_owned = ptr_is_owned(obj);
85671         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85672         obj_conv.is_owned = false;
85673         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
85674         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85675         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85676         CVec_u8Z_free(ret_var);
85677         return ret_arr;
85678 }
85679
85680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
85681         LDKReceiveTlvs obj_conv;
85682         obj_conv.inner = untag_ptr(obj);
85683         obj_conv.is_owned = ptr_is_owned(obj);
85684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85685         obj_conv.is_owned = false;
85686         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
85687         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85688         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85689         CVec_u8Z_free(ret_var);
85690         return ret_arr;
85691 }
85692
85693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
85694         LDKPaymentRelay obj_conv;
85695         obj_conv.inner = untag_ptr(obj);
85696         obj_conv.is_owned = ptr_is_owned(obj);
85697         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85698         obj_conv.is_owned = false;
85699         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
85700         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85701         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85702         CVec_u8Z_free(ret_var);
85703         return ret_arr;
85704 }
85705
85706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85707         LDKu8slice ser_ref;
85708         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85709         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85710         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
85711         *ret_conv = PaymentRelay_read(ser_ref);
85712         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85713         return tag_ptr(ret_conv, true);
85714 }
85715
85716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
85717         LDKPaymentConstraints obj_conv;
85718         obj_conv.inner = untag_ptr(obj);
85719         obj_conv.is_owned = ptr_is_owned(obj);
85720         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85721         obj_conv.is_owned = false;
85722         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
85723         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85724         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85725         CVec_u8Z_free(ret_var);
85726         return ret_arr;
85727 }
85728
85729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85730         LDKu8slice ser_ref;
85731         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85732         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85733         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
85734         *ret_conv = PaymentConstraints_read(ser_ref);
85735         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85736         return tag_ptr(ret_conv, true);
85737 }
85738
85739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
85740         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
85741         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
85742         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85743         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85744         CVec_u8Z_free(ret_var);
85745         return ret_arr;
85746 }
85747
85748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85749         LDKu8slice ser_ref;
85750         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85751         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85752         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
85753         *ret_conv = PaymentContext_read(ser_ref);
85754         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85755         return tag_ptr(ret_conv, true);
85756 }
85757
85758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
85759         LDKUnknownPaymentContext obj_conv;
85760         obj_conv.inner = untag_ptr(obj);
85761         obj_conv.is_owned = ptr_is_owned(obj);
85762         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85763         obj_conv.is_owned = false;
85764         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
85765         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85766         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85767         CVec_u8Z_free(ret_var);
85768         return ret_arr;
85769 }
85770
85771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85772         LDKu8slice ser_ref;
85773         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85774         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85775         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
85776         *ret_conv = UnknownPaymentContext_read(ser_ref);
85777         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85778         return tag_ptr(ret_conv, true);
85779 }
85780
85781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
85782         LDKBolt12OfferContext obj_conv;
85783         obj_conv.inner = untag_ptr(obj);
85784         obj_conv.is_owned = ptr_is_owned(obj);
85785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85786         obj_conv.is_owned = false;
85787         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
85788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85790         CVec_u8Z_free(ret_var);
85791         return ret_arr;
85792 }
85793
85794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85795         LDKu8slice ser_ref;
85796         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85797         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85798         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
85799         *ret_conv = Bolt12OfferContext_read(ser_ref);
85800         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85801         return tag_ptr(ret_conv, true);
85802 }
85803
85804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
85805         LDKBolt12RefundContext obj_conv;
85806         obj_conv.inner = untag_ptr(obj);
85807         obj_conv.is_owned = ptr_is_owned(obj);
85808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
85809         obj_conv.is_owned = false;
85810         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
85811         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85812         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85813         CVec_u8Z_free(ret_var);
85814         return ret_arr;
85815 }
85816
85817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85818         LDKu8slice ser_ref;
85819         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85820         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85821         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
85822         *ret_conv = Bolt12RefundContext_read(ser_ref);
85823         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85824         return tag_ptr(ret_conv, true);
85825 }
85826
85827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
85828         if (!ptr_is_owned(this_ptr)) return;
85829         void* this_ptr_ptr = untag_ptr(this_ptr);
85830         CHECK_ACCESS(this_ptr_ptr);
85831         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
85832         FREE(untag_ptr(this_ptr));
85833         PaymentPurpose_free(this_ptr_conv);
85834 }
85835
85836 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
85837         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
85838         *ret_copy = PaymentPurpose_clone(arg);
85839         int64_t ret_ref = tag_ptr(ret_copy, true);
85840         return ret_ref;
85841 }
85842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85843         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
85844         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
85845         return ret_conv;
85846 }
85847
85848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85849         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
85850         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
85851         *ret_copy = PaymentPurpose_clone(orig_conv);
85852         int64_t ret_ref = tag_ptr(ret_copy, true);
85853         return ret_ref;
85854 }
85855
85856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt11_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
85857         void* payment_preimage_ptr = untag_ptr(payment_preimage);
85858         CHECK_ACCESS(payment_preimage_ptr);
85859         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
85860         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
85861         LDKThirtyTwoBytes payment_secret_ref;
85862         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
85863         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
85864         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
85865         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
85866         int64_t ret_ref = tag_ptr(ret_copy, true);
85867         return ret_ref;
85868 }
85869
85870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt12_1offer_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
85871         void* payment_preimage_ptr = untag_ptr(payment_preimage);
85872         CHECK_ACCESS(payment_preimage_ptr);
85873         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
85874         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
85875         LDKThirtyTwoBytes payment_secret_ref;
85876         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
85877         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
85878         LDKBolt12OfferContext payment_context_conv;
85879         payment_context_conv.inner = untag_ptr(payment_context);
85880         payment_context_conv.is_owned = ptr_is_owned(payment_context);
85881         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
85882         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
85883         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
85884         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
85885         int64_t ret_ref = tag_ptr(ret_copy, true);
85886         return ret_ref;
85887 }
85888
85889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt12_1refund_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
85890         void* payment_preimage_ptr = untag_ptr(payment_preimage);
85891         CHECK_ACCESS(payment_preimage_ptr);
85892         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
85893         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
85894         LDKThirtyTwoBytes payment_secret_ref;
85895         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
85896         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
85897         LDKBolt12RefundContext payment_context_conv;
85898         payment_context_conv.inner = untag_ptr(payment_context);
85899         payment_context_conv.is_owned = ptr_is_owned(payment_context);
85900         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
85901         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
85902         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
85903         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
85904         int64_t ret_ref = tag_ptr(ret_copy, true);
85905         return ret_ref;
85906 }
85907
85908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
85909         LDKThirtyTwoBytes a_ref;
85910         CHECK((*env)->GetArrayLength(env, a) == 32);
85911         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
85912         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
85913         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
85914         int64_t ret_ref = tag_ptr(ret_copy, true);
85915         return ret_ref;
85916 }
85917
85918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85919         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
85920         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
85921         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
85922         return ret_conv;
85923 }
85924
85925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1preimage(JNIEnv *env, jclass clz, int64_t this_arg) {
85926         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
85927         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
85928         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
85929         int64_t ret_ref = tag_ptr(ret_copy, true);
85930         return ret_ref;
85931 }
85932
85933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
85934         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
85935         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
85936         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85937         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85938         CVec_u8Z_free(ret_var);
85939         return ret_arr;
85940 }
85941
85942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85943         LDKu8slice ser_ref;
85944         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85945         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85946         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
85947         *ret_conv = PaymentPurpose_read(ser_ref);
85948         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85949         return tag_ptr(ret_conv, true);
85950 }
85951
85952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
85953         LDKClaimedHTLC this_obj_conv;
85954         this_obj_conv.inner = untag_ptr(this_obj);
85955         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85957         ClaimedHTLC_free(this_obj_conv);
85958 }
85959
85960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
85961         LDKClaimedHTLC this_ptr_conv;
85962         this_ptr_conv.inner = untag_ptr(this_ptr);
85963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85965         this_ptr_conv.is_owned = false;
85966         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
85967         int64_t ret_ref = 0;
85968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85970         return ret_ref;
85971 }
85972
85973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
85974         LDKClaimedHTLC this_ptr_conv;
85975         this_ptr_conv.inner = untag_ptr(this_ptr);
85976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85978         this_ptr_conv.is_owned = false;
85979         LDKChannelId val_conv;
85980         val_conv.inner = untag_ptr(val);
85981         val_conv.is_owned = ptr_is_owned(val);
85982         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
85983         val_conv = ChannelId_clone(&val_conv);
85984         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
85985 }
85986
85987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
85988         LDKClaimedHTLC this_ptr_conv;
85989         this_ptr_conv.inner = untag_ptr(this_ptr);
85990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
85991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
85992         this_ptr_conv.is_owned = false;
85993         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
85994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
85995         return ret_arr;
85996 }
85997
85998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
85999         LDKClaimedHTLC this_ptr_conv;
86000         this_ptr_conv.inner = untag_ptr(this_ptr);
86001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86003         this_ptr_conv.is_owned = false;
86004         LDKU128 val_ref;
86005         CHECK((*env)->GetArrayLength(env, val) == 16);
86006         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
86007         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
86008 }
86009
86010 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
86011         LDKClaimedHTLC this_ptr_conv;
86012         this_ptr_conv.inner = untag_ptr(this_ptr);
86013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86015         this_ptr_conv.is_owned = false;
86016         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
86017         return ret_conv;
86018 }
86019
86020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
86021         LDKClaimedHTLC this_ptr_conv;
86022         this_ptr_conv.inner = untag_ptr(this_ptr);
86023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86025         this_ptr_conv.is_owned = false;
86026         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
86027 }
86028
86029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
86030         LDKClaimedHTLC this_ptr_conv;
86031         this_ptr_conv.inner = untag_ptr(this_ptr);
86032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86034         this_ptr_conv.is_owned = false;
86035         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
86036         return ret_conv;
86037 }
86038
86039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86040         LDKClaimedHTLC this_ptr_conv;
86041         this_ptr_conv.inner = untag_ptr(this_ptr);
86042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86044         this_ptr_conv.is_owned = false;
86045         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
86046 }
86047
86048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
86049         LDKClaimedHTLC this_ptr_conv;
86050         this_ptr_conv.inner = untag_ptr(this_ptr);
86051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86053         this_ptr_conv.is_owned = false;
86054         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
86055         return ret_conv;
86056 }
86057
86058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86059         LDKClaimedHTLC this_ptr_conv;
86060         this_ptr_conv.inner = untag_ptr(this_ptr);
86061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86063         this_ptr_conv.is_owned = false;
86064         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
86065 }
86066
86067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
86068         LDKChannelId channel_id_arg_conv;
86069         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
86070         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
86071         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
86072         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
86073         LDKU128 user_channel_id_arg_ref;
86074         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
86075         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
86076         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_conv, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
86077         int64_t ret_ref = 0;
86078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86080         return ret_ref;
86081 }
86082
86083 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
86084         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
86085         int64_t ret_ref = 0;
86086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86088         return ret_ref;
86089 }
86090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86091         LDKClaimedHTLC arg_conv;
86092         arg_conv.inner = untag_ptr(arg);
86093         arg_conv.is_owned = ptr_is_owned(arg);
86094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86095         arg_conv.is_owned = false;
86096         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
86097         return ret_conv;
86098 }
86099
86100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86101         LDKClaimedHTLC orig_conv;
86102         orig_conv.inner = untag_ptr(orig);
86103         orig_conv.is_owned = ptr_is_owned(orig);
86104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86105         orig_conv.is_owned = false;
86106         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
86107         int64_t ret_ref = 0;
86108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86110         return ret_ref;
86111 }
86112
86113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86114         LDKClaimedHTLC a_conv;
86115         a_conv.inner = untag_ptr(a);
86116         a_conv.is_owned = ptr_is_owned(a);
86117         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86118         a_conv.is_owned = false;
86119         LDKClaimedHTLC b_conv;
86120         b_conv.inner = untag_ptr(b);
86121         b_conv.is_owned = ptr_is_owned(b);
86122         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86123         b_conv.is_owned = false;
86124         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
86125         return ret_conv;
86126 }
86127
86128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
86129         LDKClaimedHTLC obj_conv;
86130         obj_conv.inner = untag_ptr(obj);
86131         obj_conv.is_owned = ptr_is_owned(obj);
86132         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
86133         obj_conv.is_owned = false;
86134         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
86135         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86136         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86137         CVec_u8Z_free(ret_var);
86138         return ret_arr;
86139 }
86140
86141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
86142         LDKu8slice ser_ref;
86143         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
86144         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
86145         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
86146         *ret_conv = ClaimedHTLC_read(ser_ref);
86147         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
86148         return tag_ptr(ret_conv, true);
86149 }
86150
86151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86152         if (!ptr_is_owned(this_ptr)) return;
86153         void* this_ptr_ptr = untag_ptr(this_ptr);
86154         CHECK_ACCESS(this_ptr_ptr);
86155         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
86156         FREE(untag_ptr(this_ptr));
86157         PathFailure_free(this_ptr_conv);
86158 }
86159
86160 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
86161         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
86162         *ret_copy = PathFailure_clone(arg);
86163         int64_t ret_ref = tag_ptr(ret_copy, true);
86164         return ret_ref;
86165 }
86166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86167         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
86168         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
86169         return ret_conv;
86170 }
86171
86172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86173         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
86174         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
86175         *ret_copy = PathFailure_clone(orig_conv);
86176         int64_t ret_ref = tag_ptr(ret_copy, true);
86177         return ret_ref;
86178 }
86179
86180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
86181         void* err_ptr = untag_ptr(err);
86182         CHECK_ACCESS(err_ptr);
86183         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
86184         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
86185         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
86186         *ret_copy = PathFailure_initial_send(err_conv);
86187         int64_t ret_ref = tag_ptr(ret_copy, true);
86188         return ret_ref;
86189 }
86190
86191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
86192         void* network_update_ptr = untag_ptr(network_update);
86193         CHECK_ACCESS(network_update_ptr);
86194         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
86195         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
86196         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
86197         *ret_copy = PathFailure_on_path(network_update_conv);
86198         int64_t ret_ref = tag_ptr(ret_copy, true);
86199         return ret_ref;
86200 }
86201
86202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86203         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
86204         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
86205         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
86206         return ret_conv;
86207 }
86208
86209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
86210         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
86211         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
86212         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86213         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86214         CVec_u8Z_free(ret_var);
86215         return ret_arr;
86216 }
86217
86218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
86219         LDKu8slice ser_ref;
86220         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
86221         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
86222         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
86223         *ret_conv = PathFailure_read(ser_ref);
86224         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
86225         return tag_ptr(ret_conv, true);
86226 }
86227
86228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86229         if (!ptr_is_owned(this_ptr)) return;
86230         void* this_ptr_ptr = untag_ptr(this_ptr);
86231         CHECK_ACCESS(this_ptr_ptr);
86232         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
86233         FREE(untag_ptr(this_ptr));
86234         ClosureReason_free(this_ptr_conv);
86235 }
86236
86237 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
86238         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86239         *ret_copy = ClosureReason_clone(arg);
86240         int64_t ret_ref = tag_ptr(ret_copy, true);
86241         return ret_ref;
86242 }
86243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86244         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
86245         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
86246         return ret_conv;
86247 }
86248
86249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86250         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
86251         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86252         *ret_copy = ClosureReason_clone(orig_conv);
86253         int64_t ret_ref = tag_ptr(ret_copy, true);
86254         return ret_ref;
86255 }
86256
86257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
86258         LDKUntrustedString peer_msg_conv;
86259         peer_msg_conv.inner = untag_ptr(peer_msg);
86260         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
86261         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
86262         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
86263         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86264         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
86265         int64_t ret_ref = tag_ptr(ret_copy, true);
86266         return ret_ref;
86267 }
86268
86269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
86270         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86271         *ret_copy = ClosureReason_holder_force_closed();
86272         int64_t ret_ref = tag_ptr(ret_copy, true);
86273         return ret_ref;
86274 }
86275
86276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1legacy_1cooperative_1closure(JNIEnv *env, jclass clz) {
86277         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86278         *ret_copy = ClosureReason_legacy_cooperative_closure();
86279         int64_t ret_ref = tag_ptr(ret_copy, true);
86280         return ret_ref;
86281 }
86282
86283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1initiated_1cooperative_1closure(JNIEnv *env, jclass clz) {
86284         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86285         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
86286         int64_t ret_ref = tag_ptr(ret_copy, true);
86287         return ret_ref;
86288 }
86289
86290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1locally_1initiated_1cooperative_1closure(JNIEnv *env, jclass clz) {
86291         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86292         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
86293         int64_t ret_ref = tag_ptr(ret_copy, true);
86294         return ret_ref;
86295 }
86296
86297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
86298         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86299         *ret_copy = ClosureReason_commitment_tx_confirmed();
86300         int64_t ret_ref = tag_ptr(ret_copy, true);
86301         return ret_ref;
86302 }
86303
86304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
86305         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86306         *ret_copy = ClosureReason_funding_timed_out();
86307         int64_t ret_ref = tag_ptr(ret_copy, true);
86308         return ret_ref;
86309 }
86310
86311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
86312         LDKStr err_conv = java_to_owned_str(env, err);
86313         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86314         *ret_copy = ClosureReason_processing_error(err_conv);
86315         int64_t ret_ref = tag_ptr(ret_copy, true);
86316         return ret_ref;
86317 }
86318
86319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
86320         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86321         *ret_copy = ClosureReason_disconnected_peer();
86322         int64_t ret_ref = tag_ptr(ret_copy, true);
86323         return ret_ref;
86324 }
86325
86326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
86327         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86328         *ret_copy = ClosureReason_outdated_channel_manager();
86329         int64_t ret_ref = tag_ptr(ret_copy, true);
86330         return ret_ref;
86331 }
86332
86333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
86334         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86335         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
86336         int64_t ret_ref = tag_ptr(ret_copy, true);
86337         return ret_ref;
86338 }
86339
86340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
86341         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86342         *ret_copy = ClosureReason_funding_batch_closure();
86343         int64_t ret_ref = tag_ptr(ret_copy, true);
86344         return ret_ref;
86345 }
86346
86347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1htlcs_1timed_1out(JNIEnv *env, jclass clz) {
86348         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
86349         *ret_copy = ClosureReason_htlcs_timed_out();
86350         int64_t ret_ref = tag_ptr(ret_copy, true);
86351         return ret_ref;
86352 }
86353
86354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86355         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
86356         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
86357         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
86358         return ret_conv;
86359 }
86360
86361 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ClosureReason_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
86362         LDKClosureReason* o_conv = (LDKClosureReason*)untag_ptr(o);
86363         LDKStr ret_str = ClosureReason_to_str(o_conv);
86364         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
86365         Str_free(ret_str);
86366         return ret_conv;
86367 }
86368
86369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
86370         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
86371         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
86372         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86373         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86374         CVec_u8Z_free(ret_var);
86375         return ret_arr;
86376 }
86377
86378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
86379         LDKu8slice ser_ref;
86380         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
86381         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
86382         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
86383         *ret_conv = ClosureReason_read(ser_ref);
86384         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
86385         return tag_ptr(ret_conv, true);
86386 }
86387
86388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86389         if (!ptr_is_owned(this_ptr)) return;
86390         void* this_ptr_ptr = untag_ptr(this_ptr);
86391         CHECK_ACCESS(this_ptr_ptr);
86392         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
86393         FREE(untag_ptr(this_ptr));
86394         HTLCDestination_free(this_ptr_conv);
86395 }
86396
86397 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
86398         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86399         *ret_copy = HTLCDestination_clone(arg);
86400         int64_t ret_ref = tag_ptr(ret_copy, true);
86401         return ret_ref;
86402 }
86403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86404         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
86405         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
86406         return ret_conv;
86407 }
86408
86409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86410         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
86411         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86412         *ret_copy = HTLCDestination_clone(orig_conv);
86413         int64_t ret_ref = tag_ptr(ret_copy, true);
86414         return ret_ref;
86415 }
86416
86417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t channel_id) {
86418         LDKPublicKey node_id_ref;
86419         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86420         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86421         LDKChannelId channel_id_conv;
86422         channel_id_conv.inner = untag_ptr(channel_id);
86423         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86424         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86425         channel_id_conv = ChannelId_clone(&channel_id_conv);
86426         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86427         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
86428         int64_t ret_ref = tag_ptr(ret_copy, true);
86429         return ret_ref;
86430 }
86431
86432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
86433         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86434         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
86435         int64_t ret_ref = tag_ptr(ret_copy, true);
86436         return ret_ref;
86437 }
86438
86439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
86440         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86441         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
86442         int64_t ret_ref = tag_ptr(ret_copy, true);
86443         return ret_ref;
86444 }
86445
86446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1onion(JNIEnv *env, jclass clz) {
86447         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86448         *ret_copy = HTLCDestination_invalid_onion();
86449         int64_t ret_ref = tag_ptr(ret_copy, true);
86450         return ret_ref;
86451 }
86452
86453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
86454         LDKThirtyTwoBytes payment_hash_ref;
86455         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86456         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86457         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
86458         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
86459         int64_t ret_ref = tag_ptr(ret_copy, true);
86460         return ret_ref;
86461 }
86462
86463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86464         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
86465         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
86466         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
86467         return ret_conv;
86468 }
86469
86470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
86471         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
86472         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
86473         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86474         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86475         CVec_u8Z_free(ret_var);
86476         return ret_arr;
86477 }
86478
86479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
86480         LDKu8slice ser_ref;
86481         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
86482         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
86483         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
86484         *ret_conv = HTLCDestination_read(ser_ref);
86485         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
86486         return tag_ptr(ret_conv, true);
86487 }
86488
86489 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86490         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
86491         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
86492         return ret_conv;
86493 }
86494
86495 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
86496         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
86497         return ret_conv;
86498 }
86499
86500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
86501         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
86502         return ret_conv;
86503 }
86504
86505 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
86506         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
86507         return ret_conv;
86508 }
86509
86510 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
86511         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
86512         return ret_conv;
86513 }
86514
86515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
86516         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
86517         return ret_conv;
86518 }
86519
86520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
86521         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
86522         return ret_conv;
86523 }
86524
86525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86526         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
86527         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
86528         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
86529         return ret_conv;
86530 }
86531
86532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
86533         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
86534         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
86535         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86536         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86537         CVec_u8Z_free(ret_var);
86538         return ret_arr;
86539 }
86540
86541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
86542         LDKu8slice ser_ref;
86543         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
86544         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
86545         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
86546         *ret_conv = PaymentFailureReason_read(ser_ref);
86547         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
86548         return tag_ptr(ret_conv, true);
86549 }
86550
86551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86552         if (!ptr_is_owned(this_ptr)) return;
86553         void* this_ptr_ptr = untag_ptr(this_ptr);
86554         CHECK_ACCESS(this_ptr_ptr);
86555         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
86556         FREE(untag_ptr(this_ptr));
86557         Event_free(this_ptr_conv);
86558 }
86559
86560 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
86561         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86562         *ret_copy = Event_clone(arg);
86563         int64_t ret_ref = tag_ptr(ret_copy, true);
86564         return ret_ref;
86565 }
86566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86567         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
86568         int64_t ret_conv = Event_clone_ptr(arg_conv);
86569         return ret_conv;
86570 }
86571
86572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86573         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
86574         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86575         *ret_copy = Event_clone(orig_conv);
86576         int64_t ret_ref = tag_ptr(ret_copy, true);
86577         return ret_ref;
86578 }
86579
86580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
86581         LDKChannelId temporary_channel_id_conv;
86582         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
86583         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
86584         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
86585         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
86586         LDKPublicKey counterparty_node_id_ref;
86587         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86588         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86589         LDKCVec_u8Z output_script_ref;
86590         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
86591         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
86592         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
86593         LDKU128 user_channel_id_ref;
86594         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
86595         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
86596         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86597         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
86598         int64_t ret_ref = tag_ptr(ret_copy, true);
86599         return ret_ref;
86600 }
86601
86602 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) {
86603         LDKPublicKey receiver_node_id_ref;
86604         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
86605         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
86606         LDKThirtyTwoBytes payment_hash_ref;
86607         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86608         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86609         LDKRecipientOnionFields onion_fields_conv;
86610         onion_fields_conv.inner = untag_ptr(onion_fields);
86611         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
86612         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
86613         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
86614         void* purpose_ptr = untag_ptr(purpose);
86615         CHECK_ACCESS(purpose_ptr);
86616         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
86617         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
86618         LDKChannelId via_channel_id_conv;
86619         via_channel_id_conv.inner = untag_ptr(via_channel_id);
86620         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
86621         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
86622         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
86623         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
86624         CHECK_ACCESS(via_user_channel_id_ptr);
86625         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
86626         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
86627         void* claim_deadline_ptr = untag_ptr(claim_deadline);
86628         CHECK_ACCESS(claim_deadline_ptr);
86629         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
86630         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
86631         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86632         *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);
86633         int64_t ret_ref = tag_ptr(ret_copy, true);
86634         return ret_ref;
86635 }
86636
86637 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) {
86638         LDKPublicKey receiver_node_id_ref;
86639         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
86640         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
86641         LDKThirtyTwoBytes payment_hash_ref;
86642         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86643         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86644         void* purpose_ptr = untag_ptr(purpose);
86645         CHECK_ACCESS(purpose_ptr);
86646         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
86647         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
86648         LDKCVec_ClaimedHTLCZ htlcs_constr;
86649         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
86650         if (htlcs_constr.datalen > 0)
86651                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
86652         else
86653                 htlcs_constr.data = NULL;
86654         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
86655         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
86656                 int64_t htlcs_conv_13 = htlcs_vals[n];
86657                 LDKClaimedHTLC htlcs_conv_13_conv;
86658                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
86659                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
86660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
86661                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
86662                 htlcs_constr.data[n] = htlcs_conv_13_conv;
86663         }
86664         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
86665         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
86666         CHECK_ACCESS(sender_intended_total_msat_ptr);
86667         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
86668         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
86669         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86670         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
86671         int64_t ret_ref = tag_ptr(ret_copy, true);
86672         return ret_ref;
86673 }
86674
86675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1connection_1needed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray addresses) {
86676         LDKPublicKey node_id_ref;
86677         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86678         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86679         LDKCVec_SocketAddressZ addresses_constr;
86680         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
86681         if (addresses_constr.datalen > 0)
86682                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
86683         else
86684                 addresses_constr.data = NULL;
86685         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
86686         for (size_t p = 0; p < addresses_constr.datalen; p++) {
86687                 int64_t addresses_conv_15 = addresses_vals[p];
86688                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
86689                 CHECK_ACCESS(addresses_conv_15_ptr);
86690                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
86691                 addresses_constr.data[p] = addresses_conv_15_conv;
86692         }
86693         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
86694         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86695         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
86696         int64_t ret_ref = tag_ptr(ret_copy, true);
86697         return ret_ref;
86698 }
86699
86700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
86701         LDKThirtyTwoBytes payment_id_ref;
86702         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
86703         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
86704         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86705         *ret_copy = Event_invoice_request_failed(payment_id_ref);
86706         int64_t ret_ref = tag_ptr(ret_copy, true);
86707         return ret_ref;
86708 }
86709
86710 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) {
86711         void* payment_id_ptr = untag_ptr(payment_id);
86712         CHECK_ACCESS(payment_id_ptr);
86713         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
86714         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
86715         LDKThirtyTwoBytes payment_preimage_ref;
86716         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
86717         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
86718         LDKThirtyTwoBytes payment_hash_ref;
86719         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86720         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86721         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
86722         CHECK_ACCESS(fee_paid_msat_ptr);
86723         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
86724         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
86725         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86726         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
86727         int64_t ret_ref = tag_ptr(ret_copy, true);
86728         return ret_ref;
86729 }
86730
86731 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) {
86732         LDKThirtyTwoBytes payment_id_ref;
86733         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
86734         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
86735         LDKThirtyTwoBytes payment_hash_ref;
86736         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86737         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86738         void* reason_ptr = untag_ptr(reason);
86739         CHECK_ACCESS(reason_ptr);
86740         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
86741         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
86742         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86743         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
86744         int64_t ret_ref = tag_ptr(ret_copy, true);
86745         return ret_ref;
86746 }
86747
86748 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) {
86749         LDKThirtyTwoBytes payment_id_ref;
86750         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
86751         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
86752         void* payment_hash_ptr = untag_ptr(payment_hash);
86753         CHECK_ACCESS(payment_hash_ptr);
86754         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
86755         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
86756         LDKPath path_conv;
86757         path_conv.inner = untag_ptr(path);
86758         path_conv.is_owned = ptr_is_owned(path);
86759         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
86760         path_conv = Path_clone(&path_conv);
86761         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86762         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
86763         int64_t ret_ref = tag_ptr(ret_copy, true);
86764         return ret_ref;
86765 }
86766
86767 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) {
86768         void* payment_id_ptr = untag_ptr(payment_id);
86769         CHECK_ACCESS(payment_id_ptr);
86770         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
86771         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
86772         LDKThirtyTwoBytes payment_hash_ref;
86773         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86774         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86775         void* failure_ptr = untag_ptr(failure);
86776         CHECK_ACCESS(failure_ptr);
86777         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
86778         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
86779         LDKPath path_conv;
86780         path_conv.inner = untag_ptr(path);
86781         path_conv.is_owned = ptr_is_owned(path);
86782         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
86783         path_conv = Path_clone(&path_conv);
86784         void* short_channel_id_ptr = untag_ptr(short_channel_id);
86785         CHECK_ACCESS(short_channel_id_ptr);
86786         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
86787         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
86788         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86789         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
86790         int64_t ret_ref = tag_ptr(ret_copy, true);
86791         return ret_ref;
86792 }
86793
86794 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) {
86795         LDKThirtyTwoBytes payment_id_ref;
86796         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
86797         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
86798         LDKThirtyTwoBytes payment_hash_ref;
86799         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86800         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86801         LDKPath path_conv;
86802         path_conv.inner = untag_ptr(path);
86803         path_conv.is_owned = ptr_is_owned(path);
86804         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
86805         path_conv = Path_clone(&path_conv);
86806         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86807         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
86808         int64_t ret_ref = tag_ptr(ret_copy, true);
86809         return ret_ref;
86810 }
86811
86812 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) {
86813         LDKThirtyTwoBytes payment_id_ref;
86814         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
86815         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
86816         LDKThirtyTwoBytes payment_hash_ref;
86817         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86818         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86819         LDKPath path_conv;
86820         path_conv.inner = untag_ptr(path);
86821         path_conv.is_owned = ptr_is_owned(path);
86822         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
86823         path_conv = Path_clone(&path_conv);
86824         void* short_channel_id_ptr = untag_ptr(short_channel_id);
86825         CHECK_ACCESS(short_channel_id_ptr);
86826         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
86827         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
86828         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86829         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
86830         int64_t ret_ref = tag_ptr(ret_copy, true);
86831         return ret_ref;
86832 }
86833
86834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
86835         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86836         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
86837         int64_t ret_ref = tag_ptr(ret_copy, true);
86838         return ret_ref;
86839 }
86840
86841 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) {
86842         LDKThirtyTwoBytes intercept_id_ref;
86843         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
86844         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
86845         LDKThirtyTwoBytes payment_hash_ref;
86846         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
86847         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
86848         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86849         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
86850         int64_t ret_ref = tag_ptr(ret_copy, true);
86851         return ret_ref;
86852 }
86853
86854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
86855         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
86856         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
86857         if (outputs_constr.datalen > 0)
86858                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
86859         else
86860                 outputs_constr.data = NULL;
86861         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
86862         for (size_t b = 0; b < outputs_constr.datalen; b++) {
86863                 int64_t outputs_conv_27 = outputs_vals[b];
86864                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
86865                 CHECK_ACCESS(outputs_conv_27_ptr);
86866                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
86867                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
86868                 outputs_constr.data[b] = outputs_conv_27_conv;
86869         }
86870         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
86871         LDKChannelId channel_id_conv;
86872         channel_id_conv.inner = untag_ptr(channel_id);
86873         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86874         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86875         channel_id_conv = ChannelId_clone(&channel_id_conv);
86876         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86877         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
86878         int64_t ret_ref = tag_ptr(ret_copy, true);
86879         return ret_ref;
86880 }
86881
86882 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 prev_user_channel_id, int64_t next_user_channel_id, int64_t total_fee_earned_msat, int64_t skimmed_fee_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
86883         LDKChannelId prev_channel_id_conv;
86884         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
86885         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
86886         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
86887         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
86888         LDKChannelId next_channel_id_conv;
86889         next_channel_id_conv.inner = untag_ptr(next_channel_id);
86890         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
86891         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
86892         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
86893         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
86894         CHECK_ACCESS(prev_user_channel_id_ptr);
86895         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
86896         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
86897         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
86898         CHECK_ACCESS(next_user_channel_id_ptr);
86899         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
86900         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
86901         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
86902         CHECK_ACCESS(total_fee_earned_msat_ptr);
86903         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
86904         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
86905         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
86906         CHECK_ACCESS(skimmed_fee_msat_ptr);
86907         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
86908         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
86909         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
86910         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
86911         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
86912         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
86913         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86914         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, prev_user_channel_id_conv, next_user_channel_id_conv, total_fee_earned_msat_conv, skimmed_fee_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
86915         int64_t ret_ref = tag_ptr(ret_copy, true);
86916         return ret_ref;
86917 }
86918
86919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo, int64_t channel_type) {
86920         LDKChannelId channel_id_conv;
86921         channel_id_conv.inner = untag_ptr(channel_id);
86922         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86923         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86924         channel_id_conv = ChannelId_clone(&channel_id_conv);
86925         LDKU128 user_channel_id_ref;
86926         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
86927         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
86928         LDKChannelId former_temporary_channel_id_conv;
86929         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
86930         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
86931         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
86932         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
86933         LDKPublicKey counterparty_node_id_ref;
86934         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86935         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86936         LDKOutPoint funding_txo_conv;
86937         funding_txo_conv.inner = untag_ptr(funding_txo);
86938         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
86939         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
86940         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
86941         LDKChannelTypeFeatures channel_type_conv;
86942         channel_type_conv.inner = untag_ptr(channel_type);
86943         channel_type_conv.is_owned = ptr_is_owned(channel_type);
86944         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
86945         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
86946         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86947         *ret_copy = Event_channel_pending(channel_id_conv, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv, channel_type_conv);
86948         int64_t ret_ref = tag_ptr(ret_copy, true);
86949         return ret_ref;
86950 }
86951
86952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
86953         LDKChannelId channel_id_conv;
86954         channel_id_conv.inner = untag_ptr(channel_id);
86955         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86956         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86957         channel_id_conv = ChannelId_clone(&channel_id_conv);
86958         LDKU128 user_channel_id_ref;
86959         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
86960         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
86961         LDKPublicKey counterparty_node_id_ref;
86962         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86963         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86964         LDKChannelTypeFeatures channel_type_conv;
86965         channel_type_conv.inner = untag_ptr(channel_type);
86966         channel_type_conv.is_owned = ptr_is_owned(channel_type);
86967         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
86968         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
86969         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
86970         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
86971         int64_t ret_ref = tag_ptr(ret_copy, true);
86972         return ret_ref;
86973 }
86974
86975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats, int64_t channel_funding_txo) {
86976         LDKChannelId channel_id_conv;
86977         channel_id_conv.inner = untag_ptr(channel_id);
86978         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86979         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86980         channel_id_conv = ChannelId_clone(&channel_id_conv);
86981         LDKU128 user_channel_id_ref;
86982         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
86983         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
86984         void* reason_ptr = untag_ptr(reason);
86985         CHECK_ACCESS(reason_ptr);
86986         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
86987         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
86988         LDKPublicKey counterparty_node_id_ref;
86989         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86990         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86991         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
86992         CHECK_ACCESS(channel_capacity_sats_ptr);
86993         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
86994         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
86995         LDKOutPoint channel_funding_txo_conv;
86996         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
86997         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
86998         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
86999         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
87000         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
87001         *ret_copy = Event_channel_closed(channel_id_conv, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
87002         int64_t ret_ref = tag_ptr(ret_copy, true);
87003         return ret_ref;
87004 }
87005
87006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray transaction) {
87007         LDKChannelId channel_id_conv;
87008         channel_id_conv.inner = untag_ptr(channel_id);
87009         channel_id_conv.is_owned = ptr_is_owned(channel_id);
87010         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
87011         channel_id_conv = ChannelId_clone(&channel_id_conv);
87012         LDKTransaction transaction_ref;
87013         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
87014         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
87015         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
87016         transaction_ref.data_is_owned = true;
87017         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
87018         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
87019         int64_t ret_ref = tag_ptr(ret_copy, true);
87020         return ret_ref;
87021 }
87022
87023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
87024         LDKChannelId temporary_channel_id_conv;
87025         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
87026         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
87027         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
87028         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
87029         LDKPublicKey counterparty_node_id_ref;
87030         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
87031         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
87032         LDKChannelTypeFeatures channel_type_conv;
87033         channel_type_conv.inner = untag_ptr(channel_type);
87034         channel_type_conv.is_owned = ptr_is_owned(channel_type);
87035         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
87036         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
87037         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
87038         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
87039         int64_t ret_ref = tag_ptr(ret_copy, true);
87040         return ret_ref;
87041 }
87042
87043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t failed_next_destination) {
87044         LDKChannelId prev_channel_id_conv;
87045         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
87046         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
87047         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
87048         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
87049         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
87050         CHECK_ACCESS(failed_next_destination_ptr);
87051         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
87052         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
87053         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
87054         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
87055         int64_t ret_ref = tag_ptr(ret_copy, true);
87056         return ret_ref;
87057 }
87058
87059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
87060         void* a_ptr = untag_ptr(a);
87061         CHECK_ACCESS(a_ptr);
87062         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
87063         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
87064         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
87065         *ret_copy = Event_bump_transaction(a_conv);
87066         int64_t ret_ref = tag_ptr(ret_copy, true);
87067         return ret_ref;
87068 }
87069
87070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87071         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
87072         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
87073         jboolean ret_conv = Event_eq(a_conv, b_conv);
87074         return ret_conv;
87075 }
87076
87077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
87078         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
87079         LDKCVec_u8Z ret_var = Event_write(obj_conv);
87080         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
87081         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
87082         CVec_u8Z_free(ret_var);
87083         return ret_arr;
87084 }
87085
87086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
87087         LDKu8slice ser_ref;
87088         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
87089         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
87090         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
87091         *ret_conv = Event_read(ser_ref);
87092         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
87093         return tag_ptr(ret_conv, true);
87094 }
87095
87096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87097         if (!ptr_is_owned(this_ptr)) return;
87098         void* this_ptr_ptr = untag_ptr(this_ptr);
87099         CHECK_ACCESS(this_ptr_ptr);
87100         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
87101         FREE(untag_ptr(this_ptr));
87102         MessageSendEvent_free(this_ptr_conv);
87103 }
87104
87105 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
87106         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87107         *ret_copy = MessageSendEvent_clone(arg);
87108         int64_t ret_ref = tag_ptr(ret_copy, true);
87109         return ret_ref;
87110 }
87111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87112         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
87113         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
87114         return ret_conv;
87115 }
87116
87117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87118         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
87119         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87120         *ret_copy = MessageSendEvent_clone(orig_conv);
87121         int64_t ret_ref = tag_ptr(ret_copy, true);
87122         return ret_ref;
87123 }
87124
87125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87126         LDKPublicKey node_id_ref;
87127         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87128         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87129         LDKAcceptChannel msg_conv;
87130         msg_conv.inner = untag_ptr(msg);
87131         msg_conv.is_owned = ptr_is_owned(msg);
87132         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87133         msg_conv = AcceptChannel_clone(&msg_conv);
87134         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87135         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
87136         int64_t ret_ref = tag_ptr(ret_copy, true);
87137         return ret_ref;
87138 }
87139
87140 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) {
87141         LDKPublicKey node_id_ref;
87142         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87143         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87144         LDKAcceptChannelV2 msg_conv;
87145         msg_conv.inner = untag_ptr(msg);
87146         msg_conv.is_owned = ptr_is_owned(msg);
87147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87148         msg_conv = AcceptChannelV2_clone(&msg_conv);
87149         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87150         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
87151         int64_t ret_ref = tag_ptr(ret_copy, true);
87152         return ret_ref;
87153 }
87154
87155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87156         LDKPublicKey node_id_ref;
87157         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87158         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87159         LDKOpenChannel msg_conv;
87160         msg_conv.inner = untag_ptr(msg);
87161         msg_conv.is_owned = ptr_is_owned(msg);
87162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87163         msg_conv = OpenChannel_clone(&msg_conv);
87164         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87165         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
87166         int64_t ret_ref = tag_ptr(ret_copy, true);
87167         return ret_ref;
87168 }
87169
87170 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) {
87171         LDKPublicKey node_id_ref;
87172         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87173         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87174         LDKOpenChannelV2 msg_conv;
87175         msg_conv.inner = untag_ptr(msg);
87176         msg_conv.is_owned = ptr_is_owned(msg);
87177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87178         msg_conv = OpenChannelV2_clone(&msg_conv);
87179         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87180         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
87181         int64_t ret_ref = tag_ptr(ret_copy, true);
87182         return ret_ref;
87183 }
87184
87185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87186         LDKPublicKey node_id_ref;
87187         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87188         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87189         LDKFundingCreated msg_conv;
87190         msg_conv.inner = untag_ptr(msg);
87191         msg_conv.is_owned = ptr_is_owned(msg);
87192         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87193         msg_conv = FundingCreated_clone(&msg_conv);
87194         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87195         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
87196         int64_t ret_ref = tag_ptr(ret_copy, true);
87197         return ret_ref;
87198 }
87199
87200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87201         LDKPublicKey node_id_ref;
87202         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87203         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87204         LDKFundingSigned msg_conv;
87205         msg_conv.inner = untag_ptr(msg);
87206         msg_conv.is_owned = ptr_is_owned(msg);
87207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87208         msg_conv = FundingSigned_clone(&msg_conv);
87209         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87210         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
87211         int64_t ret_ref = tag_ptr(ret_copy, true);
87212         return ret_ref;
87213 }
87214
87215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1stfu(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87216         LDKPublicKey node_id_ref;
87217         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87218         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87219         LDKStfu msg_conv;
87220         msg_conv.inner = untag_ptr(msg);
87221         msg_conv.is_owned = ptr_is_owned(msg);
87222         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87223         msg_conv = Stfu_clone(&msg_conv);
87224         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87225         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
87226         int64_t ret_ref = tag_ptr(ret_copy, true);
87227         return ret_ref;
87228 }
87229
87230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87231         LDKPublicKey node_id_ref;
87232         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87233         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87234         LDKSplice msg_conv;
87235         msg_conv.inner = untag_ptr(msg);
87236         msg_conv.is_owned = ptr_is_owned(msg);
87237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87238         msg_conv = Splice_clone(&msg_conv);
87239         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87240         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
87241         int64_t ret_ref = tag_ptr(ret_copy, true);
87242         return ret_ref;
87243 }
87244
87245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87246         LDKPublicKey node_id_ref;
87247         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87248         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87249         LDKSpliceAck msg_conv;
87250         msg_conv.inner = untag_ptr(msg);
87251         msg_conv.is_owned = ptr_is_owned(msg);
87252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87253         msg_conv = SpliceAck_clone(&msg_conv);
87254         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87255         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
87256         int64_t ret_ref = tag_ptr(ret_copy, true);
87257         return ret_ref;
87258 }
87259
87260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87261         LDKPublicKey node_id_ref;
87262         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87263         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87264         LDKSpliceLocked msg_conv;
87265         msg_conv.inner = untag_ptr(msg);
87266         msg_conv.is_owned = ptr_is_owned(msg);
87267         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87268         msg_conv = SpliceLocked_clone(&msg_conv);
87269         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87270         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
87271         int64_t ret_ref = tag_ptr(ret_copy, true);
87272         return ret_ref;
87273 }
87274
87275 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) {
87276         LDKPublicKey node_id_ref;
87277         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87278         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87279         LDKTxAddInput msg_conv;
87280         msg_conv.inner = untag_ptr(msg);
87281         msg_conv.is_owned = ptr_is_owned(msg);
87282         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87283         msg_conv = TxAddInput_clone(&msg_conv);
87284         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87285         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
87286         int64_t ret_ref = tag_ptr(ret_copy, true);
87287         return ret_ref;
87288 }
87289
87290 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) {
87291         LDKPublicKey node_id_ref;
87292         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87293         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87294         LDKTxAddOutput msg_conv;
87295         msg_conv.inner = untag_ptr(msg);
87296         msg_conv.is_owned = ptr_is_owned(msg);
87297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87298         msg_conv = TxAddOutput_clone(&msg_conv);
87299         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87300         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
87301         int64_t ret_ref = tag_ptr(ret_copy, true);
87302         return ret_ref;
87303 }
87304
87305 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) {
87306         LDKPublicKey node_id_ref;
87307         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87308         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87309         LDKTxRemoveInput msg_conv;
87310         msg_conv.inner = untag_ptr(msg);
87311         msg_conv.is_owned = ptr_is_owned(msg);
87312         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87313         msg_conv = TxRemoveInput_clone(&msg_conv);
87314         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87315         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
87316         int64_t ret_ref = tag_ptr(ret_copy, true);
87317         return ret_ref;
87318 }
87319
87320 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) {
87321         LDKPublicKey node_id_ref;
87322         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87323         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87324         LDKTxRemoveOutput msg_conv;
87325         msg_conv.inner = untag_ptr(msg);
87326         msg_conv.is_owned = ptr_is_owned(msg);
87327         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87328         msg_conv = TxRemoveOutput_clone(&msg_conv);
87329         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87330         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
87331         int64_t ret_ref = tag_ptr(ret_copy, true);
87332         return ret_ref;
87333 }
87334
87335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87336         LDKPublicKey node_id_ref;
87337         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87338         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87339         LDKTxComplete msg_conv;
87340         msg_conv.inner = untag_ptr(msg);
87341         msg_conv.is_owned = ptr_is_owned(msg);
87342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87343         msg_conv = TxComplete_clone(&msg_conv);
87344         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87345         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
87346         int64_t ret_ref = tag_ptr(ret_copy, true);
87347         return ret_ref;
87348 }
87349
87350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87351         LDKPublicKey node_id_ref;
87352         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87353         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87354         LDKTxSignatures msg_conv;
87355         msg_conv.inner = untag_ptr(msg);
87356         msg_conv.is_owned = ptr_is_owned(msg);
87357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87358         msg_conv = TxSignatures_clone(&msg_conv);
87359         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87360         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
87361         int64_t ret_ref = tag_ptr(ret_copy, true);
87362         return ret_ref;
87363 }
87364
87365 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) {
87366         LDKPublicKey node_id_ref;
87367         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87368         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87369         LDKTxInitRbf msg_conv;
87370         msg_conv.inner = untag_ptr(msg);
87371         msg_conv.is_owned = ptr_is_owned(msg);
87372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87373         msg_conv = TxInitRbf_clone(&msg_conv);
87374         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87375         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
87376         int64_t ret_ref = tag_ptr(ret_copy, true);
87377         return ret_ref;
87378 }
87379
87380 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) {
87381         LDKPublicKey node_id_ref;
87382         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87383         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87384         LDKTxAckRbf msg_conv;
87385         msg_conv.inner = untag_ptr(msg);
87386         msg_conv.is_owned = ptr_is_owned(msg);
87387         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87388         msg_conv = TxAckRbf_clone(&msg_conv);
87389         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87390         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
87391         int64_t ret_ref = tag_ptr(ret_copy, true);
87392         return ret_ref;
87393 }
87394
87395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87396         LDKPublicKey node_id_ref;
87397         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87398         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87399         LDKTxAbort msg_conv;
87400         msg_conv.inner = untag_ptr(msg);
87401         msg_conv.is_owned = ptr_is_owned(msg);
87402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87403         msg_conv = TxAbort_clone(&msg_conv);
87404         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87405         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
87406         int64_t ret_ref = tag_ptr(ret_copy, true);
87407         return ret_ref;
87408 }
87409
87410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87411         LDKPublicKey node_id_ref;
87412         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87413         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87414         LDKChannelReady msg_conv;
87415         msg_conv.inner = untag_ptr(msg);
87416         msg_conv.is_owned = ptr_is_owned(msg);
87417         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87418         msg_conv = ChannelReady_clone(&msg_conv);
87419         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87420         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
87421         int64_t ret_ref = tag_ptr(ret_copy, true);
87422         return ret_ref;
87423 }
87424
87425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87426         LDKPublicKey node_id_ref;
87427         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87428         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87429         LDKAnnouncementSignatures msg_conv;
87430         msg_conv.inner = untag_ptr(msg);
87431         msg_conv.is_owned = ptr_is_owned(msg);
87432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87433         msg_conv = AnnouncementSignatures_clone(&msg_conv);
87434         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87435         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
87436         int64_t ret_ref = tag_ptr(ret_copy, true);
87437         return ret_ref;
87438 }
87439
87440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
87441         LDKPublicKey node_id_ref;
87442         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87443         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87444         LDKCommitmentUpdate updates_conv;
87445         updates_conv.inner = untag_ptr(updates);
87446         updates_conv.is_owned = ptr_is_owned(updates);
87447         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
87448         updates_conv = CommitmentUpdate_clone(&updates_conv);
87449         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87450         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
87451         int64_t ret_ref = tag_ptr(ret_copy, true);
87452         return ret_ref;
87453 }
87454
87455 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) {
87456         LDKPublicKey node_id_ref;
87457         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87458         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87459         LDKRevokeAndACK msg_conv;
87460         msg_conv.inner = untag_ptr(msg);
87461         msg_conv.is_owned = ptr_is_owned(msg);
87462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87463         msg_conv = RevokeAndACK_clone(&msg_conv);
87464         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87465         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
87466         int64_t ret_ref = tag_ptr(ret_copy, true);
87467         return ret_ref;
87468 }
87469
87470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87471         LDKPublicKey node_id_ref;
87472         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87473         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87474         LDKClosingSigned msg_conv;
87475         msg_conv.inner = untag_ptr(msg);
87476         msg_conv.is_owned = ptr_is_owned(msg);
87477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87478         msg_conv = ClosingSigned_clone(&msg_conv);
87479         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87480         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
87481         int64_t ret_ref = tag_ptr(ret_copy, true);
87482         return ret_ref;
87483 }
87484
87485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87486         LDKPublicKey node_id_ref;
87487         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87488         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87489         LDKShutdown msg_conv;
87490         msg_conv.inner = untag_ptr(msg);
87491         msg_conv.is_owned = ptr_is_owned(msg);
87492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87493         msg_conv = Shutdown_clone(&msg_conv);
87494         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87495         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
87496         int64_t ret_ref = tag_ptr(ret_copy, true);
87497         return ret_ref;
87498 }
87499
87500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87501         LDKPublicKey node_id_ref;
87502         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87503         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87504         LDKChannelReestablish msg_conv;
87505         msg_conv.inner = untag_ptr(msg);
87506         msg_conv.is_owned = ptr_is_owned(msg);
87507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87508         msg_conv = ChannelReestablish_clone(&msg_conv);
87509         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87510         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
87511         int64_t ret_ref = tag_ptr(ret_copy, true);
87512         return ret_ref;
87513 }
87514
87515 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) {
87516         LDKPublicKey node_id_ref;
87517         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87518         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87519         LDKChannelAnnouncement msg_conv;
87520         msg_conv.inner = untag_ptr(msg);
87521         msg_conv.is_owned = ptr_is_owned(msg);
87522         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87523         msg_conv = ChannelAnnouncement_clone(&msg_conv);
87524         LDKChannelUpdate update_msg_conv;
87525         update_msg_conv.inner = untag_ptr(update_msg);
87526         update_msg_conv.is_owned = ptr_is_owned(update_msg);
87527         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
87528         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
87529         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87530         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
87531         int64_t ret_ref = tag_ptr(ret_copy, true);
87532         return ret_ref;
87533 }
87534
87535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
87536         LDKChannelAnnouncement msg_conv;
87537         msg_conv.inner = untag_ptr(msg);
87538         msg_conv.is_owned = ptr_is_owned(msg);
87539         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87540         msg_conv = ChannelAnnouncement_clone(&msg_conv);
87541         LDKChannelUpdate update_msg_conv;
87542         update_msg_conv.inner = untag_ptr(update_msg);
87543         update_msg_conv.is_owned = ptr_is_owned(update_msg);
87544         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
87545         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
87546         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87547         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
87548         int64_t ret_ref = tag_ptr(ret_copy, true);
87549         return ret_ref;
87550 }
87551
87552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
87553         LDKChannelUpdate msg_conv;
87554         msg_conv.inner = untag_ptr(msg);
87555         msg_conv.is_owned = ptr_is_owned(msg);
87556         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87557         msg_conv = ChannelUpdate_clone(&msg_conv);
87558         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87559         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
87560         int64_t ret_ref = tag_ptr(ret_copy, true);
87561         return ret_ref;
87562 }
87563
87564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
87565         LDKNodeAnnouncement msg_conv;
87566         msg_conv.inner = untag_ptr(msg);
87567         msg_conv.is_owned = ptr_is_owned(msg);
87568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87569         msg_conv = NodeAnnouncement_clone(&msg_conv);
87570         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87571         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
87572         int64_t ret_ref = tag_ptr(ret_copy, true);
87573         return ret_ref;
87574 }
87575
87576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
87577         LDKPublicKey node_id_ref;
87578         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87579         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87580         LDKChannelUpdate msg_conv;
87581         msg_conv.inner = untag_ptr(msg);
87582         msg_conv.is_owned = ptr_is_owned(msg);
87583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87584         msg_conv = ChannelUpdate_clone(&msg_conv);
87585         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87586         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
87587         int64_t ret_ref = tag_ptr(ret_copy, true);
87588         return ret_ref;
87589 }
87590
87591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
87592         LDKPublicKey node_id_ref;
87593         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87594         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87595         void* action_ptr = untag_ptr(action);
87596         CHECK_ACCESS(action_ptr);
87597         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
87598         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
87599         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87600         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
87601         int64_t ret_ref = tag_ptr(ret_copy, true);
87602         return ret_ref;
87603 }
87604
87605 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) {
87606         LDKPublicKey node_id_ref;
87607         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87608         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87609         LDKQueryChannelRange msg_conv;
87610         msg_conv.inner = untag_ptr(msg);
87611         msg_conv.is_owned = ptr_is_owned(msg);
87612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87613         msg_conv = QueryChannelRange_clone(&msg_conv);
87614         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87615         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
87616         int64_t ret_ref = tag_ptr(ret_copy, true);
87617         return ret_ref;
87618 }
87619
87620 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) {
87621         LDKPublicKey node_id_ref;
87622         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87623         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87624         LDKQueryShortChannelIds msg_conv;
87625         msg_conv.inner = untag_ptr(msg);
87626         msg_conv.is_owned = ptr_is_owned(msg);
87627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87628         msg_conv = QueryShortChannelIds_clone(&msg_conv);
87629         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87630         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
87631         int64_t ret_ref = tag_ptr(ret_copy, true);
87632         return ret_ref;
87633 }
87634
87635 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) {
87636         LDKPublicKey node_id_ref;
87637         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87638         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87639         LDKReplyChannelRange msg_conv;
87640         msg_conv.inner = untag_ptr(msg);
87641         msg_conv.is_owned = ptr_is_owned(msg);
87642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87643         msg_conv = ReplyChannelRange_clone(&msg_conv);
87644         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87645         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
87646         int64_t ret_ref = tag_ptr(ret_copy, true);
87647         return ret_ref;
87648 }
87649
87650 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) {
87651         LDKPublicKey node_id_ref;
87652         CHECK((*env)->GetArrayLength(env, node_id) == 33);
87653         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
87654         LDKGossipTimestampFilter msg_conv;
87655         msg_conv.inner = untag_ptr(msg);
87656         msg_conv.is_owned = ptr_is_owned(msg);
87657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
87658         msg_conv = GossipTimestampFilter_clone(&msg_conv);
87659         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
87660         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
87661         int64_t ret_ref = tag_ptr(ret_copy, true);
87662         return ret_ref;
87663 }
87664
87665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87666         if (!ptr_is_owned(this_ptr)) return;
87667         void* this_ptr_ptr = untag_ptr(this_ptr);
87668         CHECK_ACCESS(this_ptr_ptr);
87669         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
87670         FREE(untag_ptr(this_ptr));
87671         MessageSendEventsProvider_free(this_ptr_conv);
87672 }
87673
87674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87675         if (!ptr_is_owned(this_ptr)) return;
87676         void* this_ptr_ptr = untag_ptr(this_ptr);
87677         CHECK_ACCESS(this_ptr_ptr);
87678         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
87679         FREE(untag_ptr(this_ptr));
87680         EventsProvider_free(this_ptr_conv);
87681 }
87682
87683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87684         if (!ptr_is_owned(this_ptr)) return;
87685         void* this_ptr_ptr = untag_ptr(this_ptr);
87686         CHECK_ACCESS(this_ptr_ptr);
87687         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
87688         FREE(untag_ptr(this_ptr));
87689         EventHandler_free(this_ptr_conv);
87690 }
87691
87692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87693         LDKAnchorDescriptor this_obj_conv;
87694         this_obj_conv.inner = untag_ptr(this_obj);
87695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87697         AnchorDescriptor_free(this_obj_conv);
87698 }
87699
87700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
87701         LDKAnchorDescriptor this_ptr_conv;
87702         this_ptr_conv.inner = untag_ptr(this_ptr);
87703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87705         this_ptr_conv.is_owned = false;
87706         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
87707         int64_t ret_ref = 0;
87708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87710         return ret_ref;
87711 }
87712
87713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
87714         LDKAnchorDescriptor this_ptr_conv;
87715         this_ptr_conv.inner = untag_ptr(this_ptr);
87716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87718         this_ptr_conv.is_owned = false;
87719         LDKChannelDerivationParameters val_conv;
87720         val_conv.inner = untag_ptr(val);
87721         val_conv.is_owned = ptr_is_owned(val);
87722         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
87723         val_conv = ChannelDerivationParameters_clone(&val_conv);
87724         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
87725 }
87726
87727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
87728         LDKAnchorDescriptor this_ptr_conv;
87729         this_ptr_conv.inner = untag_ptr(this_ptr);
87730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87732         this_ptr_conv.is_owned = false;
87733         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
87734         int64_t ret_ref = 0;
87735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87737         return ret_ref;
87738 }
87739
87740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
87741         LDKAnchorDescriptor this_ptr_conv;
87742         this_ptr_conv.inner = untag_ptr(this_ptr);
87743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87745         this_ptr_conv.is_owned = false;
87746         LDKOutPoint val_conv;
87747         val_conv.inner = untag_ptr(val);
87748         val_conv.is_owned = ptr_is_owned(val);
87749         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
87750         val_conv = OutPoint_clone(&val_conv);
87751         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
87752 }
87753
87754 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) {
87755         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
87756         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
87757         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
87758         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
87759         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
87760         LDKOutPoint outpoint_arg_conv;
87761         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
87762         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
87763         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
87764         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
87765         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
87766         int64_t ret_ref = 0;
87767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87769         return ret_ref;
87770 }
87771
87772 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
87773         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
87774         int64_t ret_ref = 0;
87775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87777         return ret_ref;
87778 }
87779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87780         LDKAnchorDescriptor arg_conv;
87781         arg_conv.inner = untag_ptr(arg);
87782         arg_conv.is_owned = ptr_is_owned(arg);
87783         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87784         arg_conv.is_owned = false;
87785         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
87786         return ret_conv;
87787 }
87788
87789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87790         LDKAnchorDescriptor orig_conv;
87791         orig_conv.inner = untag_ptr(orig);
87792         orig_conv.is_owned = ptr_is_owned(orig);
87793         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87794         orig_conv.is_owned = false;
87795         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
87796         int64_t ret_ref = 0;
87797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87799         return ret_ref;
87800 }
87801
87802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87803         LDKAnchorDescriptor a_conv;
87804         a_conv.inner = untag_ptr(a);
87805         a_conv.is_owned = ptr_is_owned(a);
87806         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87807         a_conv.is_owned = false;
87808         LDKAnchorDescriptor b_conv;
87809         b_conv.inner = untag_ptr(b);
87810         b_conv.is_owned = ptr_is_owned(b);
87811         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87812         b_conv.is_owned = false;
87813         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
87814         return ret_conv;
87815 }
87816
87817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
87818         LDKAnchorDescriptor this_arg_conv;
87819         this_arg_conv.inner = untag_ptr(this_arg);
87820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87822         this_arg_conv.is_owned = false;
87823         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
87824         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
87825         return tag_ptr(ret_ref, true);
87826 }
87827
87828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
87829         LDKAnchorDescriptor this_arg_conv;
87830         this_arg_conv.inner = untag_ptr(this_arg);
87831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87833         this_arg_conv.is_owned = false;
87834         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
87835         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
87836         return tag_ptr(ret_ref, true);
87837 }
87838
87839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
87840         LDKAnchorDescriptor this_arg_conv;
87841         this_arg_conv.inner = untag_ptr(this_arg);
87842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87844         this_arg_conv.is_owned = false;
87845         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
87846         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
87847         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
87848         CVec_u8Z_free(ret_var);
87849         return ret_arr;
87850 }
87851
87852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
87853         LDKAnchorDescriptor this_arg_conv;
87854         this_arg_conv.inner = untag_ptr(this_arg);
87855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87857         this_arg_conv.is_owned = false;
87858         LDKECDSASignature signature_ref;
87859         CHECK((*env)->GetArrayLength(env, signature) == 64);
87860         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
87861         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
87862         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
87863         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
87864         Witness_free(ret_var);
87865         return ret_arr;
87866 }
87867
87868 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) {
87869         LDKAnchorDescriptor this_arg_conv;
87870         this_arg_conv.inner = untag_ptr(this_arg);
87871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87873         this_arg_conv.is_owned = false;
87874         void* signer_provider_ptr = untag_ptr(signer_provider);
87875         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
87876         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
87877         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
87878         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
87879         return tag_ptr(ret_ret, true);
87880 }
87881
87882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87883         if (!ptr_is_owned(this_ptr)) return;
87884         void* this_ptr_ptr = untag_ptr(this_ptr);
87885         CHECK_ACCESS(this_ptr_ptr);
87886         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
87887         FREE(untag_ptr(this_ptr));
87888         BumpTransactionEvent_free(this_ptr_conv);
87889 }
87890
87891 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
87892         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
87893         *ret_copy = BumpTransactionEvent_clone(arg);
87894         int64_t ret_ref = tag_ptr(ret_copy, true);
87895         return ret_ref;
87896 }
87897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87898         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
87899         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
87900         return ret_conv;
87901 }
87902
87903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87904         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
87905         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
87906         *ret_copy = BumpTransactionEvent_clone(orig_conv);
87907         int64_t ret_ref = tag_ptr(ret_copy, true);
87908         return ret_ref;
87909 }
87910
87911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray counterparty_node_id, 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) {
87912         LDKChannelId channel_id_conv;
87913         channel_id_conv.inner = untag_ptr(channel_id);
87914         channel_id_conv.is_owned = ptr_is_owned(channel_id);
87915         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
87916         channel_id_conv = ChannelId_clone(&channel_id_conv);
87917         LDKPublicKey counterparty_node_id_ref;
87918         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
87919         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
87920         LDKThirtyTwoBytes claim_id_ref;
87921         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
87922         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
87923         LDKTransaction commitment_tx_ref;
87924         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
87925         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
87926         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
87927         commitment_tx_ref.data_is_owned = true;
87928         LDKAnchorDescriptor anchor_descriptor_conv;
87929         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
87930         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
87931         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
87932         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
87933         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
87934         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
87935         if (pending_htlcs_constr.datalen > 0)
87936                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
87937         else
87938                 pending_htlcs_constr.data = NULL;
87939         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
87940         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
87941                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
87942                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
87943                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
87944                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
87945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
87946                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
87947                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
87948         }
87949         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
87950         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
87951         *ret_copy = BumpTransactionEvent_channel_close(channel_id_conv, counterparty_node_id_ref, claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
87952         int64_t ret_ref = tag_ptr(ret_copy, true);
87953         return ret_ref;
87954 }
87955
87956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray counterparty_node_id, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
87957         LDKChannelId channel_id_conv;
87958         channel_id_conv.inner = untag_ptr(channel_id);
87959         channel_id_conv.is_owned = ptr_is_owned(channel_id);
87960         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
87961         channel_id_conv = ChannelId_clone(&channel_id_conv);
87962         LDKPublicKey counterparty_node_id_ref;
87963         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
87964         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
87965         LDKThirtyTwoBytes claim_id_ref;
87966         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
87967         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
87968         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
87969         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
87970         if (htlc_descriptors_constr.datalen > 0)
87971                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
87972         else
87973                 htlc_descriptors_constr.data = NULL;
87974         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
87975         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
87976                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
87977                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
87978                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
87979                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
87980                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
87981                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
87982                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
87983         }
87984         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
87985         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
87986         *ret_copy = BumpTransactionEvent_htlcresolution(channel_id_conv, counterparty_node_id_ref, claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
87987         int64_t ret_ref = tag_ptr(ret_copy, true);
87988         return ret_ref;
87989 }
87990
87991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87992         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
87993         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
87994         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
87995         return ret_conv;
87996 }
87997
87998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87999         LDKInput this_obj_conv;
88000         this_obj_conv.inner = untag_ptr(this_obj);
88001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88003         Input_free(this_obj_conv);
88004 }
88005
88006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
88007         LDKInput this_ptr_conv;
88008         this_ptr_conv.inner = untag_ptr(this_ptr);
88009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88011         this_ptr_conv.is_owned = false;
88012         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
88013         int64_t ret_ref = 0;
88014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88016         return ret_ref;
88017 }
88018
88019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88020         LDKInput this_ptr_conv;
88021         this_ptr_conv.inner = untag_ptr(this_ptr);
88022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88024         this_ptr_conv.is_owned = false;
88025         LDKOutPoint val_conv;
88026         val_conv.inner = untag_ptr(val);
88027         val_conv.is_owned = ptr_is_owned(val);
88028         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
88029         val_conv = OutPoint_clone(&val_conv);
88030         Input_set_outpoint(&this_ptr_conv, val_conv);
88031 }
88032
88033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
88034         LDKInput this_ptr_conv;
88035         this_ptr_conv.inner = untag_ptr(this_ptr);
88036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88038         this_ptr_conv.is_owned = false;
88039         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
88040         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
88041         return tag_ptr(ret_ref, true);
88042 }
88043
88044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88045         LDKInput this_ptr_conv;
88046         this_ptr_conv.inner = untag_ptr(this_ptr);
88047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88049         this_ptr_conv.is_owned = false;
88050         void* val_ptr = untag_ptr(val);
88051         CHECK_ACCESS(val_ptr);
88052         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
88053         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
88054         Input_set_previous_utxo(&this_ptr_conv, val_conv);
88055 }
88056
88057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
88058         LDKInput this_ptr_conv;
88059         this_ptr_conv.inner = untag_ptr(this_ptr);
88060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88062         this_ptr_conv.is_owned = false;
88063         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
88064         return ret_conv;
88065 }
88066
88067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88068         LDKInput this_ptr_conv;
88069         this_ptr_conv.inner = untag_ptr(this_ptr);
88070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88072         this_ptr_conv.is_owned = false;
88073         Input_set_satisfaction_weight(&this_ptr_conv, val);
88074 }
88075
88076 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) {
88077         LDKOutPoint outpoint_arg_conv;
88078         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
88079         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
88080         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
88081         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
88082         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
88083         CHECK_ACCESS(previous_utxo_arg_ptr);
88084         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
88085         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
88086         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
88087         int64_t ret_ref = 0;
88088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88090         return ret_ref;
88091 }
88092
88093 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
88094         LDKInput ret_var = Input_clone(arg);
88095         int64_t ret_ref = 0;
88096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88098         return ret_ref;
88099 }
88100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88101         LDKInput arg_conv;
88102         arg_conv.inner = untag_ptr(arg);
88103         arg_conv.is_owned = ptr_is_owned(arg);
88104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88105         arg_conv.is_owned = false;
88106         int64_t ret_conv = Input_clone_ptr(&arg_conv);
88107         return ret_conv;
88108 }
88109
88110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88111         LDKInput orig_conv;
88112         orig_conv.inner = untag_ptr(orig);
88113         orig_conv.is_owned = ptr_is_owned(orig);
88114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88115         orig_conv.is_owned = false;
88116         LDKInput ret_var = Input_clone(&orig_conv);
88117         int64_t ret_ref = 0;
88118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88120         return ret_ref;
88121 }
88122
88123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
88124         LDKInput o_conv;
88125         o_conv.inner = untag_ptr(o);
88126         o_conv.is_owned = ptr_is_owned(o);
88127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88128         o_conv.is_owned = false;
88129         int64_t ret_conv = Input_hash(&o_conv);
88130         return ret_conv;
88131 }
88132
88133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88134         LDKInput a_conv;
88135         a_conv.inner = untag_ptr(a);
88136         a_conv.is_owned = ptr_is_owned(a);
88137         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88138         a_conv.is_owned = false;
88139         LDKInput b_conv;
88140         b_conv.inner = untag_ptr(b);
88141         b_conv.is_owned = ptr_is_owned(b);
88142         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88143         b_conv.is_owned = false;
88144         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
88145         return ret_conv;
88146 }
88147
88148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88149         LDKUtxo this_obj_conv;
88150         this_obj_conv.inner = untag_ptr(this_obj);
88151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88153         Utxo_free(this_obj_conv);
88154 }
88155
88156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
88157         LDKUtxo this_ptr_conv;
88158         this_ptr_conv.inner = untag_ptr(this_ptr);
88159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88161         this_ptr_conv.is_owned = false;
88162         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
88163         int64_t ret_ref = 0;
88164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88166         return ret_ref;
88167 }
88168
88169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88170         LDKUtxo this_ptr_conv;
88171         this_ptr_conv.inner = untag_ptr(this_ptr);
88172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88174         this_ptr_conv.is_owned = false;
88175         LDKOutPoint val_conv;
88176         val_conv.inner = untag_ptr(val);
88177         val_conv.is_owned = ptr_is_owned(val);
88178         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
88179         val_conv = OutPoint_clone(&val_conv);
88180         Utxo_set_outpoint(&this_ptr_conv, val_conv);
88181 }
88182
88183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
88184         LDKUtxo this_ptr_conv;
88185         this_ptr_conv.inner = untag_ptr(this_ptr);
88186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88188         this_ptr_conv.is_owned = false;
88189         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
88190         *ret_ref = Utxo_get_output(&this_ptr_conv);
88191         return tag_ptr(ret_ref, true);
88192 }
88193
88194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88195         LDKUtxo this_ptr_conv;
88196         this_ptr_conv.inner = untag_ptr(this_ptr);
88197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88199         this_ptr_conv.is_owned = false;
88200         void* val_ptr = untag_ptr(val);
88201         CHECK_ACCESS(val_ptr);
88202         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
88203         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
88204         Utxo_set_output(&this_ptr_conv, val_conv);
88205 }
88206
88207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
88208         LDKUtxo this_ptr_conv;
88209         this_ptr_conv.inner = untag_ptr(this_ptr);
88210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88212         this_ptr_conv.is_owned = false;
88213         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
88214         return ret_conv;
88215 }
88216
88217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88218         LDKUtxo this_ptr_conv;
88219         this_ptr_conv.inner = untag_ptr(this_ptr);
88220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88222         this_ptr_conv.is_owned = false;
88223         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
88224 }
88225
88226 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) {
88227         LDKOutPoint outpoint_arg_conv;
88228         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
88229         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
88230         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
88231         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
88232         void* output_arg_ptr = untag_ptr(output_arg);
88233         CHECK_ACCESS(output_arg_ptr);
88234         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
88235         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
88236         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
88237         int64_t ret_ref = 0;
88238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88240         return ret_ref;
88241 }
88242
88243 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
88244         LDKUtxo ret_var = Utxo_clone(arg);
88245         int64_t ret_ref = 0;
88246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88248         return ret_ref;
88249 }
88250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88251         LDKUtxo arg_conv;
88252         arg_conv.inner = untag_ptr(arg);
88253         arg_conv.is_owned = ptr_is_owned(arg);
88254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88255         arg_conv.is_owned = false;
88256         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
88257         return ret_conv;
88258 }
88259
88260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88261         LDKUtxo orig_conv;
88262         orig_conv.inner = untag_ptr(orig);
88263         orig_conv.is_owned = ptr_is_owned(orig);
88264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88265         orig_conv.is_owned = false;
88266         LDKUtxo ret_var = Utxo_clone(&orig_conv);
88267         int64_t ret_ref = 0;
88268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88270         return ret_ref;
88271 }
88272
88273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
88274         LDKUtxo o_conv;
88275         o_conv.inner = untag_ptr(o);
88276         o_conv.is_owned = ptr_is_owned(o);
88277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88278         o_conv.is_owned = false;
88279         int64_t ret_conv = Utxo_hash(&o_conv);
88280         return ret_conv;
88281 }
88282
88283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88284         LDKUtxo a_conv;
88285         a_conv.inner = untag_ptr(a);
88286         a_conv.is_owned = ptr_is_owned(a);
88287         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88288         a_conv.is_owned = false;
88289         LDKUtxo b_conv;
88290         b_conv.inner = untag_ptr(b);
88291         b_conv.is_owned = ptr_is_owned(b);
88292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88293         b_conv.is_owned = false;
88294         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
88295         return ret_conv;
88296 }
88297
88298 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) {
88299         LDKOutPoint outpoint_conv;
88300         outpoint_conv.inner = untag_ptr(outpoint);
88301         outpoint_conv.is_owned = ptr_is_owned(outpoint);
88302         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
88303         outpoint_conv = OutPoint_clone(&outpoint_conv);
88304         uint8_t pubkey_hash_arr[20];
88305         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
88306         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
88307         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
88308         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
88309         int64_t ret_ref = 0;
88310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88312         return ret_ref;
88313 }
88314
88315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88316         LDKCoinSelection this_obj_conv;
88317         this_obj_conv.inner = untag_ptr(this_obj);
88318         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88320         CoinSelection_free(this_obj_conv);
88321 }
88322
88323 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
88324         LDKCoinSelection this_ptr_conv;
88325         this_ptr_conv.inner = untag_ptr(this_ptr);
88326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88328         this_ptr_conv.is_owned = false;
88329         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
88330         int64_tArray ret_arr = NULL;
88331         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88332         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88333         for (size_t g = 0; g < ret_var.datalen; g++) {
88334                 LDKUtxo ret_conv_6_var = ret_var.data[g];
88335                 int64_t ret_conv_6_ref = 0;
88336                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
88337                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
88338                 ret_arr_ptr[g] = ret_conv_6_ref;
88339         }
88340         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88341         FREE(ret_var.data);
88342         return ret_arr;
88343 }
88344
88345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
88346         LDKCoinSelection this_ptr_conv;
88347         this_ptr_conv.inner = untag_ptr(this_ptr);
88348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88350         this_ptr_conv.is_owned = false;
88351         LDKCVec_UtxoZ val_constr;
88352         val_constr.datalen = (*env)->GetArrayLength(env, val);
88353         if (val_constr.datalen > 0)
88354                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
88355         else
88356                 val_constr.data = NULL;
88357         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
88358         for (size_t g = 0; g < val_constr.datalen; g++) {
88359                 int64_t val_conv_6 = val_vals[g];
88360                 LDKUtxo val_conv_6_conv;
88361                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
88362                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
88363                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
88364                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
88365                 val_constr.data[g] = val_conv_6_conv;
88366         }
88367         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
88368         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
88369 }
88370
88371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
88372         LDKCoinSelection this_ptr_conv;
88373         this_ptr_conv.inner = untag_ptr(this_ptr);
88374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88376         this_ptr_conv.is_owned = false;
88377         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
88378         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
88379         int64_t ret_ref = tag_ptr(ret_copy, true);
88380         return ret_ref;
88381 }
88382
88383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88384         LDKCoinSelection this_ptr_conv;
88385         this_ptr_conv.inner = untag_ptr(this_ptr);
88386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88388         this_ptr_conv.is_owned = false;
88389         void* val_ptr = untag_ptr(val);
88390         CHECK_ACCESS(val_ptr);
88391         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
88392         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
88393         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
88394 }
88395
88396 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) {
88397         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
88398         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
88399         if (confirmed_utxos_arg_constr.datalen > 0)
88400                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
88401         else
88402                 confirmed_utxos_arg_constr.data = NULL;
88403         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
88404         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
88405                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
88406                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
88407                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
88408                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
88409                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
88410                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
88411                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
88412         }
88413         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
88414         void* change_output_arg_ptr = untag_ptr(change_output_arg);
88415         CHECK_ACCESS(change_output_arg_ptr);
88416         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
88417         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
88418         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
88419         int64_t ret_ref = 0;
88420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88422         return ret_ref;
88423 }
88424
88425 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
88426         LDKCoinSelection ret_var = CoinSelection_clone(arg);
88427         int64_t ret_ref = 0;
88428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88430         return ret_ref;
88431 }
88432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88433         LDKCoinSelection arg_conv;
88434         arg_conv.inner = untag_ptr(arg);
88435         arg_conv.is_owned = ptr_is_owned(arg);
88436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88437         arg_conv.is_owned = false;
88438         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
88439         return ret_conv;
88440 }
88441
88442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88443         LDKCoinSelection orig_conv;
88444         orig_conv.inner = untag_ptr(orig);
88445         orig_conv.is_owned = ptr_is_owned(orig);
88446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88447         orig_conv.is_owned = false;
88448         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
88449         int64_t ret_ref = 0;
88450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88452         return ret_ref;
88453 }
88454
88455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88456         if (!ptr_is_owned(this_ptr)) return;
88457         void* this_ptr_ptr = untag_ptr(this_ptr);
88458         CHECK_ACCESS(this_ptr_ptr);
88459         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
88460         FREE(untag_ptr(this_ptr));
88461         CoinSelectionSource_free(this_ptr_conv);
88462 }
88463
88464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88465         if (!ptr_is_owned(this_ptr)) return;
88466         void* this_ptr_ptr = untag_ptr(this_ptr);
88467         CHECK_ACCESS(this_ptr_ptr);
88468         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
88469         FREE(untag_ptr(this_ptr));
88470         WalletSource_free(this_ptr_conv);
88471 }
88472
88473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88474         LDKWallet this_obj_conv;
88475         this_obj_conv.inner = untag_ptr(this_obj);
88476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88478         Wallet_free(this_obj_conv);
88479 }
88480
88481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
88482         void* source_ptr = untag_ptr(source);
88483         CHECK_ACCESS(source_ptr);
88484         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
88485         if (source_conv.free == LDKWalletSource_JCalls_free) {
88486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88487                 LDKWalletSource_JCalls_cloned(&source_conv);
88488         }
88489         void* logger_ptr = untag_ptr(logger);
88490         CHECK_ACCESS(logger_ptr);
88491         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
88492         if (logger_conv.free == LDKLogger_JCalls_free) {
88493                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88494                 LDKLogger_JCalls_cloned(&logger_conv);
88495         }
88496         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
88497         int64_t ret_ref = 0;
88498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88500         return ret_ref;
88501 }
88502
88503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
88504         LDKWallet this_arg_conv;
88505         this_arg_conv.inner = untag_ptr(this_arg);
88506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88508         this_arg_conv.is_owned = false;
88509         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
88510         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
88511         return tag_ptr(ret_ret, true);
88512 }
88513
88514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88515         LDKBumpTransactionEventHandler this_obj_conv;
88516         this_obj_conv.inner = untag_ptr(this_obj);
88517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88519         BumpTransactionEventHandler_free(this_obj_conv);
88520 }
88521
88522 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) {
88523         void* broadcaster_ptr = untag_ptr(broadcaster);
88524         CHECK_ACCESS(broadcaster_ptr);
88525         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
88526         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
88527                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88528                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
88529         }
88530         void* utxo_source_ptr = untag_ptr(utxo_source);
88531         CHECK_ACCESS(utxo_source_ptr);
88532         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
88533         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
88534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88535                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
88536         }
88537         void* signer_provider_ptr = untag_ptr(signer_provider);
88538         CHECK_ACCESS(signer_provider_ptr);
88539         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
88540         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
88541                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88542                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
88543         }
88544         void* logger_ptr = untag_ptr(logger);
88545         CHECK_ACCESS(logger_ptr);
88546         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
88547         if (logger_conv.free == LDKLogger_JCalls_free) {
88548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88549                 LDKLogger_JCalls_cloned(&logger_conv);
88550         }
88551         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
88552         int64_t ret_ref = 0;
88553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88555         return ret_ref;
88556 }
88557
88558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
88559         LDKBumpTransactionEventHandler this_arg_conv;
88560         this_arg_conv.inner = untag_ptr(this_arg);
88561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88563         this_arg_conv.is_owned = false;
88564         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
88565         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
88566 }
88567
88568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88569         LDKFilesystemStore this_obj_conv;
88570         this_obj_conv.inner = untag_ptr(this_obj);
88571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88573         FilesystemStore_free(this_obj_conv);
88574 }
88575
88576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
88577         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
88578         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
88579         int64_t ret_ref = 0;
88580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88582         return ret_ref;
88583 }
88584
88585 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
88586         LDKFilesystemStore this_arg_conv;
88587         this_arg_conv.inner = untag_ptr(this_arg);
88588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88590         this_arg_conv.is_owned = false;
88591         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
88592         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
88593         Str_free(ret_str);
88594         return ret_conv;
88595 }
88596
88597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
88598         LDKFilesystemStore this_arg_conv;
88599         this_arg_conv.inner = untag_ptr(this_arg);
88600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88602         this_arg_conv.is_owned = false;
88603         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
88604         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
88605         return tag_ptr(ret_ret, true);
88606 }
88607
88608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88609         LDKBackgroundProcessor this_obj_conv;
88610         this_obj_conv.inner = untag_ptr(this_obj);
88611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88613         BackgroundProcessor_free(this_obj_conv);
88614 }
88615
88616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88617         if (!ptr_is_owned(this_ptr)) return;
88618         void* this_ptr_ptr = untag_ptr(this_ptr);
88619         CHECK_ACCESS(this_ptr_ptr);
88620         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
88621         FREE(untag_ptr(this_ptr));
88622         GossipSync_free(this_ptr_conv);
88623 }
88624
88625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
88626         LDKP2PGossipSync a_conv;
88627         a_conv.inner = untag_ptr(a);
88628         a_conv.is_owned = ptr_is_owned(a);
88629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88630         a_conv.is_owned = false;
88631         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
88632         *ret_copy = GossipSync_p2_p(&a_conv);
88633         int64_t ret_ref = tag_ptr(ret_copy, true);
88634         return ret_ref;
88635 }
88636
88637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
88638         LDKRapidGossipSync a_conv;
88639         a_conv.inner = untag_ptr(a);
88640         a_conv.is_owned = ptr_is_owned(a);
88641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88642         a_conv.is_owned = false;
88643         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
88644         *ret_copy = GossipSync_rapid(&a_conv);
88645         int64_t ret_ref = tag_ptr(ret_copy, true);
88646         return ret_ref;
88647 }
88648
88649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
88650         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
88651         *ret_copy = GossipSync_none();
88652         int64_t ret_ref = tag_ptr(ret_copy, true);
88653         return ret_ref;
88654 }
88655
88656 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) {
88657         void* persister_ptr = untag_ptr(persister);
88658         CHECK_ACCESS(persister_ptr);
88659         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
88660         if (persister_conv.free == LDKPersister_JCalls_free) {
88661                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88662                 LDKPersister_JCalls_cloned(&persister_conv);
88663         }
88664         void* event_handler_ptr = untag_ptr(event_handler);
88665         CHECK_ACCESS(event_handler_ptr);
88666         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
88667         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
88668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88669                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
88670         }
88671         LDKChainMonitor chain_monitor_conv;
88672         chain_monitor_conv.inner = untag_ptr(chain_monitor);
88673         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
88674         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
88675         chain_monitor_conv.is_owned = false;
88676         LDKChannelManager channel_manager_conv;
88677         channel_manager_conv.inner = untag_ptr(channel_manager);
88678         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
88679         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
88680         channel_manager_conv.is_owned = false;
88681         void* gossip_sync_ptr = untag_ptr(gossip_sync);
88682         CHECK_ACCESS(gossip_sync_ptr);
88683         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
88684         // WARNING: we may need a move here but no clone is available for LDKGossipSync
88685         LDKPeerManager peer_manager_conv;
88686         peer_manager_conv.inner = untag_ptr(peer_manager);
88687         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
88688         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
88689         peer_manager_conv.is_owned = false;
88690         void* logger_ptr = untag_ptr(logger);
88691         CHECK_ACCESS(logger_ptr);
88692         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
88693         if (logger_conv.free == LDKLogger_JCalls_free) {
88694                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88695                 LDKLogger_JCalls_cloned(&logger_conv);
88696         }
88697         void* scorer_ptr = untag_ptr(scorer);
88698         CHECK_ACCESS(scorer_ptr);
88699         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
88700         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
88701         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
88702                 // Manually implement clone for Java trait instances
88703                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
88704                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
88705                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
88706                 }
88707         }
88708         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);
88709         int64_t ret_ref = 0;
88710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88712         return ret_ref;
88713 }
88714
88715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
88716         LDKBackgroundProcessor this_arg_conv;
88717         this_arg_conv.inner = untag_ptr(this_arg);
88718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88720         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
88721         
88722         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
88723         *ret_conv = BackgroundProcessor_join(this_arg_conv);
88724         return tag_ptr(ret_conv, true);
88725 }
88726
88727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
88728         LDKBackgroundProcessor this_arg_conv;
88729         this_arg_conv.inner = untag_ptr(this_arg);
88730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88732         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
88733         
88734         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
88735         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
88736         return tag_ptr(ret_conv, true);
88737 }
88738
88739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88740         if (!ptr_is_owned(this_ptr)) return;
88741         void* this_ptr_ptr = untag_ptr(this_ptr);
88742         CHECK_ACCESS(this_ptr_ptr);
88743         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
88744         FREE(untag_ptr(this_ptr));
88745         Bolt11ParseError_free(this_ptr_conv);
88746 }
88747
88748 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
88749         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88750         *ret_copy = Bolt11ParseError_clone(arg);
88751         int64_t ret_ref = tag_ptr(ret_copy, true);
88752         return ret_ref;
88753 }
88754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88755         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
88756         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
88757         return ret_conv;
88758 }
88759
88760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88761         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
88762         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88763         *ret_copy = Bolt11ParseError_clone(orig_conv);
88764         int64_t ret_ref = tag_ptr(ret_copy, true);
88765         return ret_ref;
88766 }
88767
88768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
88769         void* a_ptr = untag_ptr(a);
88770         CHECK_ACCESS(a_ptr);
88771         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
88772         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
88773         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88774         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
88775         int64_t ret_ref = tag_ptr(ret_copy, true);
88776         return ret_ref;
88777 }
88778
88779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
88780         
88781         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88782         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
88783         int64_t ret_ref = tag_ptr(ret_copy, true);
88784         return ret_ref;
88785 }
88786
88787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
88788         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
88789         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88790         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
88791         int64_t ret_ref = tag_ptr(ret_copy, true);
88792         return ret_ref;
88793 }
88794
88795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
88796         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88797         *ret_copy = Bolt11ParseError_bad_prefix();
88798         int64_t ret_ref = tag_ptr(ret_copy, true);
88799         return ret_ref;
88800 }
88801
88802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
88803         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88804         *ret_copy = Bolt11ParseError_unknown_currency();
88805         int64_t ret_ref = tag_ptr(ret_copy, true);
88806         return ret_ref;
88807 }
88808
88809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
88810         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88811         *ret_copy = Bolt11ParseError_unknown_si_prefix();
88812         int64_t ret_ref = tag_ptr(ret_copy, true);
88813         return ret_ref;
88814 }
88815
88816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
88817         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88818         *ret_copy = Bolt11ParseError_malformed_hrp();
88819         int64_t ret_ref = tag_ptr(ret_copy, true);
88820         return ret_ref;
88821 }
88822
88823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
88824         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88825         *ret_copy = Bolt11ParseError_too_short_data_part();
88826         int64_t ret_ref = tag_ptr(ret_copy, true);
88827         return ret_ref;
88828 }
88829
88830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
88831         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88832         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
88833         int64_t ret_ref = tag_ptr(ret_copy, true);
88834         return ret_ref;
88835 }
88836
88837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
88838         
88839         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88840         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
88841         int64_t ret_ref = tag_ptr(ret_copy, true);
88842         return ret_ref;
88843 }
88844
88845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
88846         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88847         *ret_copy = Bolt11ParseError_padding_error();
88848         int64_t ret_ref = tag_ptr(ret_copy, true);
88849         return ret_ref;
88850 }
88851
88852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
88853         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88854         *ret_copy = Bolt11ParseError_integer_overflow_error();
88855         int64_t ret_ref = tag_ptr(ret_copy, true);
88856         return ret_ref;
88857 }
88858
88859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
88860         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88861         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
88862         int64_t ret_ref = tag_ptr(ret_copy, true);
88863         return ret_ref;
88864 }
88865
88866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
88867         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88868         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
88869         int64_t ret_ref = tag_ptr(ret_copy, true);
88870         return ret_ref;
88871 }
88872
88873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
88874         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88875         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
88876         int64_t ret_ref = tag_ptr(ret_copy, true);
88877         return ret_ref;
88878 }
88879
88880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
88881         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88882         *ret_copy = Bolt11ParseError_invalid_recovery_id();
88883         int64_t ret_ref = tag_ptr(ret_copy, true);
88884         return ret_ref;
88885 }
88886
88887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
88888         LDKStr a_conv = java_to_owned_str(env, a);
88889         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88890         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
88891         int64_t ret_ref = tag_ptr(ret_copy, true);
88892         return ret_ref;
88893 }
88894
88895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
88896         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
88897         *ret_copy = Bolt11ParseError_skip();
88898         int64_t ret_ref = tag_ptr(ret_copy, true);
88899         return ret_ref;
88900 }
88901
88902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88903         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
88904         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
88905         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
88906         return ret_conv;
88907 }
88908
88909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88910         if (!ptr_is_owned(this_ptr)) return;
88911         void* this_ptr_ptr = untag_ptr(this_ptr);
88912         CHECK_ACCESS(this_ptr_ptr);
88913         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
88914         FREE(untag_ptr(this_ptr));
88915         ParseOrSemanticError_free(this_ptr_conv);
88916 }
88917
88918 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
88919         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
88920         *ret_copy = ParseOrSemanticError_clone(arg);
88921         int64_t ret_ref = tag_ptr(ret_copy, true);
88922         return ret_ref;
88923 }
88924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88925         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
88926         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
88927         return ret_conv;
88928 }
88929
88930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88931         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
88932         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
88933         *ret_copy = ParseOrSemanticError_clone(orig_conv);
88934         int64_t ret_ref = tag_ptr(ret_copy, true);
88935         return ret_ref;
88936 }
88937
88938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
88939         void* a_ptr = untag_ptr(a);
88940         CHECK_ACCESS(a_ptr);
88941         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
88942         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
88943         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
88944         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
88945         int64_t ret_ref = tag_ptr(ret_copy, true);
88946         return ret_ref;
88947 }
88948
88949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
88950         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
88951         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
88952         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
88953         int64_t ret_ref = tag_ptr(ret_copy, true);
88954         return ret_ref;
88955 }
88956
88957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88958         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
88959         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
88960         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
88961         return ret_conv;
88962 }
88963
88964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88965         LDKBolt11Invoice this_obj_conv;
88966         this_obj_conv.inner = untag_ptr(this_obj);
88967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88969         Bolt11Invoice_free(this_obj_conv);
88970 }
88971
88972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88973         LDKBolt11Invoice a_conv;
88974         a_conv.inner = untag_ptr(a);
88975         a_conv.is_owned = ptr_is_owned(a);
88976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88977         a_conv.is_owned = false;
88978         LDKBolt11Invoice b_conv;
88979         b_conv.inner = untag_ptr(b);
88980         b_conv.is_owned = ptr_is_owned(b);
88981         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88982         b_conv.is_owned = false;
88983         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
88984         return ret_conv;
88985 }
88986
88987 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
88988         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
88989         int64_t ret_ref = 0;
88990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88992         return ret_ref;
88993 }
88994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88995         LDKBolt11Invoice arg_conv;
88996         arg_conv.inner = untag_ptr(arg);
88997         arg_conv.is_owned = ptr_is_owned(arg);
88998         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88999         arg_conv.is_owned = false;
89000         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
89001         return ret_conv;
89002 }
89003
89004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89005         LDKBolt11Invoice orig_conv;
89006         orig_conv.inner = untag_ptr(orig);
89007         orig_conv.is_owned = ptr_is_owned(orig);
89008         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89009         orig_conv.is_owned = false;
89010         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
89011         int64_t ret_ref = 0;
89012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89014         return ret_ref;
89015 }
89016
89017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
89018         LDKBolt11Invoice o_conv;
89019         o_conv.inner = untag_ptr(o);
89020         o_conv.is_owned = ptr_is_owned(o);
89021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89022         o_conv.is_owned = false;
89023         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
89024         return ret_conv;
89025 }
89026
89027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89028         LDKSignedRawBolt11Invoice this_obj_conv;
89029         this_obj_conv.inner = untag_ptr(this_obj);
89030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89032         SignedRawBolt11Invoice_free(this_obj_conv);
89033 }
89034
89035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89036         LDKSignedRawBolt11Invoice a_conv;
89037         a_conv.inner = untag_ptr(a);
89038         a_conv.is_owned = ptr_is_owned(a);
89039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89040         a_conv.is_owned = false;
89041         LDKSignedRawBolt11Invoice b_conv;
89042         b_conv.inner = untag_ptr(b);
89043         b_conv.is_owned = ptr_is_owned(b);
89044         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89045         b_conv.is_owned = false;
89046         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
89047         return ret_conv;
89048 }
89049
89050 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
89051         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
89052         int64_t ret_ref = 0;
89053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89055         return ret_ref;
89056 }
89057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89058         LDKSignedRawBolt11Invoice arg_conv;
89059         arg_conv.inner = untag_ptr(arg);
89060         arg_conv.is_owned = ptr_is_owned(arg);
89061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89062         arg_conv.is_owned = false;
89063         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
89064         return ret_conv;
89065 }
89066
89067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89068         LDKSignedRawBolt11Invoice orig_conv;
89069         orig_conv.inner = untag_ptr(orig);
89070         orig_conv.is_owned = ptr_is_owned(orig);
89071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89072         orig_conv.is_owned = false;
89073         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
89074         int64_t ret_ref = 0;
89075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89077         return ret_ref;
89078 }
89079
89080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
89081         LDKSignedRawBolt11Invoice o_conv;
89082         o_conv.inner = untag_ptr(o);
89083         o_conv.is_owned = ptr_is_owned(o);
89084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89085         o_conv.is_owned = false;
89086         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
89087         return ret_conv;
89088 }
89089
89090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89091         LDKRawBolt11Invoice this_obj_conv;
89092         this_obj_conv.inner = untag_ptr(this_obj);
89093         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89095         RawBolt11Invoice_free(this_obj_conv);
89096 }
89097
89098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
89099         LDKRawBolt11Invoice this_ptr_conv;
89100         this_ptr_conv.inner = untag_ptr(this_ptr);
89101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89103         this_ptr_conv.is_owned = false;
89104         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
89105         int64_t ret_ref = 0;
89106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89108         return ret_ref;
89109 }
89110
89111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
89112         LDKRawBolt11Invoice this_ptr_conv;
89113         this_ptr_conv.inner = untag_ptr(this_ptr);
89114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89116         this_ptr_conv.is_owned = false;
89117         LDKRawDataPart val_conv;
89118         val_conv.inner = untag_ptr(val);
89119         val_conv.is_owned = ptr_is_owned(val);
89120         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
89121         val_conv = RawDataPart_clone(&val_conv);
89122         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
89123 }
89124
89125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89126         LDKRawBolt11Invoice a_conv;
89127         a_conv.inner = untag_ptr(a);
89128         a_conv.is_owned = ptr_is_owned(a);
89129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89130         a_conv.is_owned = false;
89131         LDKRawBolt11Invoice b_conv;
89132         b_conv.inner = untag_ptr(b);
89133         b_conv.is_owned = ptr_is_owned(b);
89134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89135         b_conv.is_owned = false;
89136         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
89137         return ret_conv;
89138 }
89139
89140 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
89141         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
89142         int64_t ret_ref = 0;
89143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89145         return ret_ref;
89146 }
89147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89148         LDKRawBolt11Invoice arg_conv;
89149         arg_conv.inner = untag_ptr(arg);
89150         arg_conv.is_owned = ptr_is_owned(arg);
89151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89152         arg_conv.is_owned = false;
89153         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
89154         return ret_conv;
89155 }
89156
89157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89158         LDKRawBolt11Invoice orig_conv;
89159         orig_conv.inner = untag_ptr(orig);
89160         orig_conv.is_owned = ptr_is_owned(orig);
89161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89162         orig_conv.is_owned = false;
89163         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
89164         int64_t ret_ref = 0;
89165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89167         return ret_ref;
89168 }
89169
89170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
89171         LDKRawBolt11Invoice o_conv;
89172         o_conv.inner = untag_ptr(o);
89173         o_conv.is_owned = ptr_is_owned(o);
89174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89175         o_conv.is_owned = false;
89176         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
89177         return ret_conv;
89178 }
89179
89180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89181         LDKRawDataPart this_obj_conv;
89182         this_obj_conv.inner = untag_ptr(this_obj);
89183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89185         RawDataPart_free(this_obj_conv);
89186 }
89187
89188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
89189         LDKRawDataPart this_ptr_conv;
89190         this_ptr_conv.inner = untag_ptr(this_ptr);
89191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89193         this_ptr_conv.is_owned = false;
89194         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
89195         int64_t ret_ref = 0;
89196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89198         return ret_ref;
89199 }
89200
89201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
89202         LDKRawDataPart this_ptr_conv;
89203         this_ptr_conv.inner = untag_ptr(this_ptr);
89204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89206         this_ptr_conv.is_owned = false;
89207         LDKPositiveTimestamp val_conv;
89208         val_conv.inner = untag_ptr(val);
89209         val_conv.is_owned = ptr_is_owned(val);
89210         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
89211         val_conv = PositiveTimestamp_clone(&val_conv);
89212         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
89213 }
89214
89215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89216         LDKRawDataPart a_conv;
89217         a_conv.inner = untag_ptr(a);
89218         a_conv.is_owned = ptr_is_owned(a);
89219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89220         a_conv.is_owned = false;
89221         LDKRawDataPart b_conv;
89222         b_conv.inner = untag_ptr(b);
89223         b_conv.is_owned = ptr_is_owned(b);
89224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89225         b_conv.is_owned = false;
89226         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
89227         return ret_conv;
89228 }
89229
89230 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
89231         LDKRawDataPart ret_var = RawDataPart_clone(arg);
89232         int64_t ret_ref = 0;
89233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89235         return ret_ref;
89236 }
89237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89238         LDKRawDataPart arg_conv;
89239         arg_conv.inner = untag_ptr(arg);
89240         arg_conv.is_owned = ptr_is_owned(arg);
89241         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89242         arg_conv.is_owned = false;
89243         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
89244         return ret_conv;
89245 }
89246
89247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89248         LDKRawDataPart orig_conv;
89249         orig_conv.inner = untag_ptr(orig);
89250         orig_conv.is_owned = ptr_is_owned(orig);
89251         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89252         orig_conv.is_owned = false;
89253         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
89254         int64_t ret_ref = 0;
89255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89257         return ret_ref;
89258 }
89259
89260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
89261         LDKRawDataPart o_conv;
89262         o_conv.inner = untag_ptr(o);
89263         o_conv.is_owned = ptr_is_owned(o);
89264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89265         o_conv.is_owned = false;
89266         int64_t ret_conv = RawDataPart_hash(&o_conv);
89267         return ret_conv;
89268 }
89269
89270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89271         LDKPositiveTimestamp this_obj_conv;
89272         this_obj_conv.inner = untag_ptr(this_obj);
89273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89275         PositiveTimestamp_free(this_obj_conv);
89276 }
89277
89278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89279         LDKPositiveTimestamp a_conv;
89280         a_conv.inner = untag_ptr(a);
89281         a_conv.is_owned = ptr_is_owned(a);
89282         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89283         a_conv.is_owned = false;
89284         LDKPositiveTimestamp b_conv;
89285         b_conv.inner = untag_ptr(b);
89286         b_conv.is_owned = ptr_is_owned(b);
89287         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89288         b_conv.is_owned = false;
89289         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
89290         return ret_conv;
89291 }
89292
89293 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
89294         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
89295         int64_t ret_ref = 0;
89296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89298         return ret_ref;
89299 }
89300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89301         LDKPositiveTimestamp arg_conv;
89302         arg_conv.inner = untag_ptr(arg);
89303         arg_conv.is_owned = ptr_is_owned(arg);
89304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89305         arg_conv.is_owned = false;
89306         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
89307         return ret_conv;
89308 }
89309
89310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89311         LDKPositiveTimestamp orig_conv;
89312         orig_conv.inner = untag_ptr(orig);
89313         orig_conv.is_owned = ptr_is_owned(orig);
89314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89315         orig_conv.is_owned = false;
89316         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
89317         int64_t ret_ref = 0;
89318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89320         return ret_ref;
89321 }
89322
89323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
89324         LDKPositiveTimestamp o_conv;
89325         o_conv.inner = untag_ptr(o);
89326         o_conv.is_owned = ptr_is_owned(o);
89327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89328         o_conv.is_owned = false;
89329         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
89330         return ret_conv;
89331 }
89332
89333 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89334         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
89335         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
89336         return ret_conv;
89337 }
89338
89339 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
89340         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
89341         return ret_conv;
89342 }
89343
89344 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
89345         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
89346         return ret_conv;
89347 }
89348
89349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
89350         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
89351         return ret_conv;
89352 }
89353
89354 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
89355         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
89356         return ret_conv;
89357 }
89358
89359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89360         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
89361         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
89362         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
89363         return ret_conv;
89364 }
89365
89366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
89367         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
89368         int64_t ret_conv = SiPrefix_hash(o_conv);
89369         return ret_conv;
89370 }
89371
89372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
89373         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
89374         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
89375         return ret_conv;
89376 }
89377
89378 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89379         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
89380         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
89381         return ret_conv;
89382 }
89383
89384 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
89385         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
89386         return ret_conv;
89387 }
89388
89389 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
89390         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
89391         return ret_conv;
89392 }
89393
89394 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
89395         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
89396         return ret_conv;
89397 }
89398
89399 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
89400         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
89401         return ret_conv;
89402 }
89403
89404 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
89405         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
89406         return ret_conv;
89407 }
89408
89409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
89410         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
89411         int64_t ret_conv = Currency_hash(o_conv);
89412         return ret_conv;
89413 }
89414
89415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89416         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
89417         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
89418         jboolean ret_conv = Currency_eq(a_conv, b_conv);
89419         return ret_conv;
89420 }
89421
89422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89423         LDKSha256 this_obj_conv;
89424         this_obj_conv.inner = untag_ptr(this_obj);
89425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89427         Sha256_free(this_obj_conv);
89428 }
89429
89430 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
89431         LDKSha256 ret_var = Sha256_clone(arg);
89432         int64_t ret_ref = 0;
89433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89435         return ret_ref;
89436 }
89437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89438         LDKSha256 arg_conv;
89439         arg_conv.inner = untag_ptr(arg);
89440         arg_conv.is_owned = ptr_is_owned(arg);
89441         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89442         arg_conv.is_owned = false;
89443         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
89444         return ret_conv;
89445 }
89446
89447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89448         LDKSha256 orig_conv;
89449         orig_conv.inner = untag_ptr(orig);
89450         orig_conv.is_owned = ptr_is_owned(orig);
89451         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89452         orig_conv.is_owned = false;
89453         LDKSha256 ret_var = Sha256_clone(&orig_conv);
89454         int64_t ret_ref = 0;
89455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89457         return ret_ref;
89458 }
89459
89460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
89461         LDKSha256 o_conv;
89462         o_conv.inner = untag_ptr(o);
89463         o_conv.is_owned = ptr_is_owned(o);
89464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89465         o_conv.is_owned = false;
89466         int64_t ret_conv = Sha256_hash(&o_conv);
89467         return ret_conv;
89468 }
89469
89470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89471         LDKSha256 a_conv;
89472         a_conv.inner = untag_ptr(a);
89473         a_conv.is_owned = ptr_is_owned(a);
89474         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89475         a_conv.is_owned = false;
89476         LDKSha256 b_conv;
89477         b_conv.inner = untag_ptr(b);
89478         b_conv.is_owned = ptr_is_owned(b);
89479         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89480         b_conv.is_owned = false;
89481         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
89482         return ret_conv;
89483 }
89484
89485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
89486         uint8_t bytes_arr[32];
89487         CHECK((*env)->GetArrayLength(env, bytes) == 32);
89488         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
89489         uint8_t (*bytes_ref)[32] = &bytes_arr;
89490         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
89491         int64_t ret_ref = 0;
89492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89494         return ret_ref;
89495 }
89496
89497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89498         LDKDescription this_obj_conv;
89499         this_obj_conv.inner = untag_ptr(this_obj);
89500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89502         Description_free(this_obj_conv);
89503 }
89504
89505 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
89506         LDKDescription ret_var = Description_clone(arg);
89507         int64_t ret_ref = 0;
89508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89510         return ret_ref;
89511 }
89512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89513         LDKDescription arg_conv;
89514         arg_conv.inner = untag_ptr(arg);
89515         arg_conv.is_owned = ptr_is_owned(arg);
89516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89517         arg_conv.is_owned = false;
89518         int64_t ret_conv = Description_clone_ptr(&arg_conv);
89519         return ret_conv;
89520 }
89521
89522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89523         LDKDescription orig_conv;
89524         orig_conv.inner = untag_ptr(orig);
89525         orig_conv.is_owned = ptr_is_owned(orig);
89526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89527         orig_conv.is_owned = false;
89528         LDKDescription ret_var = Description_clone(&orig_conv);
89529         int64_t ret_ref = 0;
89530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89532         return ret_ref;
89533 }
89534
89535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
89536         LDKDescription o_conv;
89537         o_conv.inner = untag_ptr(o);
89538         o_conv.is_owned = ptr_is_owned(o);
89539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89540         o_conv.is_owned = false;
89541         int64_t ret_conv = Description_hash(&o_conv);
89542         return ret_conv;
89543 }
89544
89545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89546         LDKDescription a_conv;
89547         a_conv.inner = untag_ptr(a);
89548         a_conv.is_owned = ptr_is_owned(a);
89549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89550         a_conv.is_owned = false;
89551         LDKDescription b_conv;
89552         b_conv.inner = untag_ptr(b);
89553         b_conv.is_owned = ptr_is_owned(b);
89554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89555         b_conv.is_owned = false;
89556         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
89557         return ret_conv;
89558 }
89559
89560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89561         LDKPayeePubKey this_obj_conv;
89562         this_obj_conv.inner = untag_ptr(this_obj);
89563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89565         PayeePubKey_free(this_obj_conv);
89566 }
89567
89568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
89569         LDKPayeePubKey this_ptr_conv;
89570         this_ptr_conv.inner = untag_ptr(this_ptr);
89571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89573         this_ptr_conv.is_owned = false;
89574         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
89575         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
89576         return ret_arr;
89577 }
89578
89579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
89580         LDKPayeePubKey this_ptr_conv;
89581         this_ptr_conv.inner = untag_ptr(this_ptr);
89582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89584         this_ptr_conv.is_owned = false;
89585         LDKPublicKey val_ref;
89586         CHECK((*env)->GetArrayLength(env, val) == 33);
89587         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
89588         PayeePubKey_set_a(&this_ptr_conv, val_ref);
89589 }
89590
89591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
89592         LDKPublicKey a_arg_ref;
89593         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
89594         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
89595         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
89596         int64_t ret_ref = 0;
89597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89599         return ret_ref;
89600 }
89601
89602 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
89603         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
89604         int64_t ret_ref = 0;
89605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89607         return ret_ref;
89608 }
89609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89610         LDKPayeePubKey arg_conv;
89611         arg_conv.inner = untag_ptr(arg);
89612         arg_conv.is_owned = ptr_is_owned(arg);
89613         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89614         arg_conv.is_owned = false;
89615         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
89616         return ret_conv;
89617 }
89618
89619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89620         LDKPayeePubKey orig_conv;
89621         orig_conv.inner = untag_ptr(orig);
89622         orig_conv.is_owned = ptr_is_owned(orig);
89623         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89624         orig_conv.is_owned = false;
89625         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
89626         int64_t ret_ref = 0;
89627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89629         return ret_ref;
89630 }
89631
89632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
89633         LDKPayeePubKey o_conv;
89634         o_conv.inner = untag_ptr(o);
89635         o_conv.is_owned = ptr_is_owned(o);
89636         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89637         o_conv.is_owned = false;
89638         int64_t ret_conv = PayeePubKey_hash(&o_conv);
89639         return ret_conv;
89640 }
89641
89642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89643         LDKPayeePubKey a_conv;
89644         a_conv.inner = untag_ptr(a);
89645         a_conv.is_owned = ptr_is_owned(a);
89646         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89647         a_conv.is_owned = false;
89648         LDKPayeePubKey b_conv;
89649         b_conv.inner = untag_ptr(b);
89650         b_conv.is_owned = ptr_is_owned(b);
89651         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89652         b_conv.is_owned = false;
89653         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
89654         return ret_conv;
89655 }
89656
89657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89658         LDKExpiryTime this_obj_conv;
89659         this_obj_conv.inner = untag_ptr(this_obj);
89660         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89662         ExpiryTime_free(this_obj_conv);
89663 }
89664
89665 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
89666         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
89667         int64_t ret_ref = 0;
89668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89670         return ret_ref;
89671 }
89672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89673         LDKExpiryTime arg_conv;
89674         arg_conv.inner = untag_ptr(arg);
89675         arg_conv.is_owned = ptr_is_owned(arg);
89676         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89677         arg_conv.is_owned = false;
89678         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
89679         return ret_conv;
89680 }
89681
89682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89683         LDKExpiryTime orig_conv;
89684         orig_conv.inner = untag_ptr(orig);
89685         orig_conv.is_owned = ptr_is_owned(orig);
89686         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89687         orig_conv.is_owned = false;
89688         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
89689         int64_t ret_ref = 0;
89690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89692         return ret_ref;
89693 }
89694
89695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
89696         LDKExpiryTime o_conv;
89697         o_conv.inner = untag_ptr(o);
89698         o_conv.is_owned = ptr_is_owned(o);
89699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89700         o_conv.is_owned = false;
89701         int64_t ret_conv = ExpiryTime_hash(&o_conv);
89702         return ret_conv;
89703 }
89704
89705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89706         LDKExpiryTime a_conv;
89707         a_conv.inner = untag_ptr(a);
89708         a_conv.is_owned = ptr_is_owned(a);
89709         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89710         a_conv.is_owned = false;
89711         LDKExpiryTime b_conv;
89712         b_conv.inner = untag_ptr(b);
89713         b_conv.is_owned = ptr_is_owned(b);
89714         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89715         b_conv.is_owned = false;
89716         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
89717         return ret_conv;
89718 }
89719
89720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89721         LDKMinFinalCltvExpiryDelta this_obj_conv;
89722         this_obj_conv.inner = untag_ptr(this_obj);
89723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89725         MinFinalCltvExpiryDelta_free(this_obj_conv);
89726 }
89727
89728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
89729         LDKMinFinalCltvExpiryDelta this_ptr_conv;
89730         this_ptr_conv.inner = untag_ptr(this_ptr);
89731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89733         this_ptr_conv.is_owned = false;
89734         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
89735         return ret_conv;
89736 }
89737
89738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
89739         LDKMinFinalCltvExpiryDelta this_ptr_conv;
89740         this_ptr_conv.inner = untag_ptr(this_ptr);
89741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
89742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
89743         this_ptr_conv.is_owned = false;
89744         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
89745 }
89746
89747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
89748         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
89749         int64_t ret_ref = 0;
89750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89752         return ret_ref;
89753 }
89754
89755 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
89756         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
89757         int64_t ret_ref = 0;
89758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89760         return ret_ref;
89761 }
89762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89763         LDKMinFinalCltvExpiryDelta arg_conv;
89764         arg_conv.inner = untag_ptr(arg);
89765         arg_conv.is_owned = ptr_is_owned(arg);
89766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89767         arg_conv.is_owned = false;
89768         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
89769         return ret_conv;
89770 }
89771
89772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89773         LDKMinFinalCltvExpiryDelta orig_conv;
89774         orig_conv.inner = untag_ptr(orig);
89775         orig_conv.is_owned = ptr_is_owned(orig);
89776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89777         orig_conv.is_owned = false;
89778         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
89779         int64_t ret_ref = 0;
89780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89782         return ret_ref;
89783 }
89784
89785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
89786         LDKMinFinalCltvExpiryDelta o_conv;
89787         o_conv.inner = untag_ptr(o);
89788         o_conv.is_owned = ptr_is_owned(o);
89789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89790         o_conv.is_owned = false;
89791         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
89792         return ret_conv;
89793 }
89794
89795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89796         LDKMinFinalCltvExpiryDelta a_conv;
89797         a_conv.inner = untag_ptr(a);
89798         a_conv.is_owned = ptr_is_owned(a);
89799         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89800         a_conv.is_owned = false;
89801         LDKMinFinalCltvExpiryDelta b_conv;
89802         b_conv.inner = untag_ptr(b);
89803         b_conv.is_owned = ptr_is_owned(b);
89804         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89805         b_conv.is_owned = false;
89806         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
89807         return ret_conv;
89808 }
89809
89810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
89811         if (!ptr_is_owned(this_ptr)) return;
89812         void* this_ptr_ptr = untag_ptr(this_ptr);
89813         CHECK_ACCESS(this_ptr_ptr);
89814         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
89815         FREE(untag_ptr(this_ptr));
89816         Fallback_free(this_ptr_conv);
89817 }
89818
89819 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
89820         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
89821         *ret_copy = Fallback_clone(arg);
89822         int64_t ret_ref = tag_ptr(ret_copy, true);
89823         return ret_ref;
89824 }
89825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89826         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
89827         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
89828         return ret_conv;
89829 }
89830
89831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89832         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
89833         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
89834         *ret_copy = Fallback_clone(orig_conv);
89835         int64_t ret_ref = tag_ptr(ret_copy, true);
89836         return ret_ref;
89837 }
89838
89839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
89840         
89841         LDKCVec_u8Z program_ref;
89842         program_ref.datalen = (*env)->GetArrayLength(env, program);
89843         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
89844         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
89845         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
89846         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
89847         int64_t ret_ref = tag_ptr(ret_copy, true);
89848         return ret_ref;
89849 }
89850
89851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
89852         LDKTwentyBytes a_ref;
89853         CHECK((*env)->GetArrayLength(env, a) == 20);
89854         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
89855         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
89856         *ret_copy = Fallback_pub_key_hash(a_ref);
89857         int64_t ret_ref = tag_ptr(ret_copy, true);
89858         return ret_ref;
89859 }
89860
89861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
89862         LDKTwentyBytes a_ref;
89863         CHECK((*env)->GetArrayLength(env, a) == 20);
89864         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
89865         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
89866         *ret_copy = Fallback_script_hash(a_ref);
89867         int64_t ret_ref = tag_ptr(ret_copy, true);
89868         return ret_ref;
89869 }
89870
89871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
89872         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
89873         int64_t ret_conv = Fallback_hash(o_conv);
89874         return ret_conv;
89875 }
89876
89877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89878         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
89879         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
89880         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
89881         return ret_conv;
89882 }
89883
89884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89885         LDKBolt11InvoiceSignature this_obj_conv;
89886         this_obj_conv.inner = untag_ptr(this_obj);
89887         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89889         Bolt11InvoiceSignature_free(this_obj_conv);
89890 }
89891
89892 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
89893         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
89894         int64_t ret_ref = 0;
89895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89897         return ret_ref;
89898 }
89899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89900         LDKBolt11InvoiceSignature arg_conv;
89901         arg_conv.inner = untag_ptr(arg);
89902         arg_conv.is_owned = ptr_is_owned(arg);
89903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89904         arg_conv.is_owned = false;
89905         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
89906         return ret_conv;
89907 }
89908
89909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89910         LDKBolt11InvoiceSignature orig_conv;
89911         orig_conv.inner = untag_ptr(orig);
89912         orig_conv.is_owned = ptr_is_owned(orig);
89913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89914         orig_conv.is_owned = false;
89915         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
89916         int64_t ret_ref = 0;
89917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89919         return ret_ref;
89920 }
89921
89922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
89923         LDKBolt11InvoiceSignature o_conv;
89924         o_conv.inner = untag_ptr(o);
89925         o_conv.is_owned = ptr_is_owned(o);
89926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89927         o_conv.is_owned = false;
89928         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
89929         return ret_conv;
89930 }
89931
89932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89933         LDKBolt11InvoiceSignature a_conv;
89934         a_conv.inner = untag_ptr(a);
89935         a_conv.is_owned = ptr_is_owned(a);
89936         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89937         a_conv.is_owned = false;
89938         LDKBolt11InvoiceSignature b_conv;
89939         b_conv.inner = untag_ptr(b);
89940         b_conv.is_owned = ptr_is_owned(b);
89941         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
89942         b_conv.is_owned = false;
89943         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
89944         return ret_conv;
89945 }
89946
89947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89948         LDKPrivateRoute this_obj_conv;
89949         this_obj_conv.inner = untag_ptr(this_obj);
89950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89952         PrivateRoute_free(this_obj_conv);
89953 }
89954
89955 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
89956         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
89957         int64_t ret_ref = 0;
89958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89960         return ret_ref;
89961 }
89962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89963         LDKPrivateRoute arg_conv;
89964         arg_conv.inner = untag_ptr(arg);
89965         arg_conv.is_owned = ptr_is_owned(arg);
89966         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
89967         arg_conv.is_owned = false;
89968         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
89969         return ret_conv;
89970 }
89971
89972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89973         LDKPrivateRoute orig_conv;
89974         orig_conv.inner = untag_ptr(orig);
89975         orig_conv.is_owned = ptr_is_owned(orig);
89976         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
89977         orig_conv.is_owned = false;
89978         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
89979         int64_t ret_ref = 0;
89980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89982         return ret_ref;
89983 }
89984
89985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
89986         LDKPrivateRoute o_conv;
89987         o_conv.inner = untag_ptr(o);
89988         o_conv.is_owned = ptr_is_owned(o);
89989         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89990         o_conv.is_owned = false;
89991         int64_t ret_conv = PrivateRoute_hash(&o_conv);
89992         return ret_conv;
89993 }
89994
89995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89996         LDKPrivateRoute a_conv;
89997         a_conv.inner = untag_ptr(a);
89998         a_conv.is_owned = ptr_is_owned(a);
89999         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
90000         a_conv.is_owned = false;
90001         LDKPrivateRoute b_conv;
90002         b_conv.inner = untag_ptr(b);
90003         b_conv.is_owned = ptr_is_owned(b);
90004         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
90005         b_conv.is_owned = false;
90006         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
90007         return ret_conv;
90008 }
90009
90010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
90011         LDKSignedRawBolt11Invoice this_arg_conv;
90012         this_arg_conv.inner = untag_ptr(this_arg);
90013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90015         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
90016         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
90017         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
90018         return tag_ptr(ret_conv, true);
90019 }
90020
90021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
90022         LDKSignedRawBolt11Invoice this_arg_conv;
90023         this_arg_conv.inner = untag_ptr(this_arg);
90024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90026         this_arg_conv.is_owned = false;
90027         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
90028         int64_t ret_ref = 0;
90029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90031         return ret_ref;
90032 }
90033
90034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
90035         LDKSignedRawBolt11Invoice this_arg_conv;
90036         this_arg_conv.inner = untag_ptr(this_arg);
90037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90039         this_arg_conv.is_owned = false;
90040         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
90041         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
90042         return ret_arr;
90043 }
90044
90045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
90046         LDKSignedRawBolt11Invoice this_arg_conv;
90047         this_arg_conv.inner = untag_ptr(this_arg);
90048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90050         this_arg_conv.is_owned = false;
90051         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
90052         int64_t ret_ref = 0;
90053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90055         return ret_ref;
90056 }
90057
90058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
90059         LDKSignedRawBolt11Invoice this_arg_conv;
90060         this_arg_conv.inner = untag_ptr(this_arg);
90061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90063         this_arg_conv.is_owned = false;
90064         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
90065         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
90066         return tag_ptr(ret_conv, true);
90067 }
90068
90069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
90070         LDKSignedRawBolt11Invoice this_arg_conv;
90071         this_arg_conv.inner = untag_ptr(this_arg);
90072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90074         this_arg_conv.is_owned = false;
90075         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
90076         return ret_conv;
90077 }
90078
90079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
90080         LDKRawBolt11Invoice this_arg_conv;
90081         this_arg_conv.inner = untag_ptr(this_arg);
90082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90084         this_arg_conv.is_owned = false;
90085         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
90086         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
90087         return ret_arr;
90088 }
90089
90090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
90091         LDKRawBolt11Invoice this_arg_conv;
90092         this_arg_conv.inner = untag_ptr(this_arg);
90093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90095         this_arg_conv.is_owned = false;
90096         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
90097         int64_t ret_ref = 0;
90098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90100         return ret_ref;
90101 }
90102
90103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
90104         LDKRawBolt11Invoice this_arg_conv;
90105         this_arg_conv.inner = untag_ptr(this_arg);
90106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90108         this_arg_conv.is_owned = false;
90109         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
90110         int64_t ret_ref = 0;
90111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90113         return ret_ref;
90114 }
90115
90116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
90117         LDKRawBolt11Invoice this_arg_conv;
90118         this_arg_conv.inner = untag_ptr(this_arg);
90119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90121         this_arg_conv.is_owned = false;
90122         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
90123         int64_t ret_ref = 0;
90124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90126         return ret_ref;
90127 }
90128
90129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
90130         LDKRawBolt11Invoice this_arg_conv;
90131         this_arg_conv.inner = untag_ptr(this_arg);
90132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90134         this_arg_conv.is_owned = false;
90135         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
90136         int64_t ret_ref = 0;
90137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90139         return ret_ref;
90140 }
90141
90142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
90143         LDKRawBolt11Invoice this_arg_conv;
90144         this_arg_conv.inner = untag_ptr(this_arg);
90145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90147         this_arg_conv.is_owned = false;
90148         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
90149         int64_t ret_ref = 0;
90150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90152         return ret_ref;
90153 }
90154
90155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
90156         LDKRawBolt11Invoice this_arg_conv;
90157         this_arg_conv.inner = untag_ptr(this_arg);
90158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90160         this_arg_conv.is_owned = false;
90161         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
90162         int64_t ret_ref = 0;
90163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90165         return ret_ref;
90166 }
90167
90168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
90169         LDKRawBolt11Invoice this_arg_conv;
90170         this_arg_conv.inner = untag_ptr(this_arg);
90171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90173         this_arg_conv.is_owned = false;
90174         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
90175         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
90176         int64_t ret_ref = tag_ptr(ret_copy, true);
90177         return ret_ref;
90178 }
90179
90180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
90181         LDKRawBolt11Invoice this_arg_conv;
90182         this_arg_conv.inner = untag_ptr(this_arg);
90183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90185         this_arg_conv.is_owned = false;
90186         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
90187         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
90188         int64_t ret_ref = tag_ptr(ret_copy, true);
90189         return ret_ref;
90190 }
90191
90192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
90193         LDKRawBolt11Invoice this_arg_conv;
90194         this_arg_conv.inner = untag_ptr(this_arg);
90195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90197         this_arg_conv.is_owned = false;
90198         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
90199         int64_t ret_ref = 0;
90200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90202         return ret_ref;
90203 }
90204
90205 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
90206         LDKRawBolt11Invoice this_arg_conv;
90207         this_arg_conv.inner = untag_ptr(this_arg);
90208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90210         this_arg_conv.is_owned = false;
90211         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
90212         int64_tArray ret_arr = NULL;
90213         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
90214         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
90215         for (size_t o = 0; o < ret_var.datalen; o++) {
90216                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
90217                 int64_t ret_conv_14_ref = 0;
90218                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
90219                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
90220                 ret_arr_ptr[o] = ret_conv_14_ref;
90221         }
90222         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
90223         FREE(ret_var.data);
90224         return ret_arr;
90225 }
90226
90227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
90228         LDKRawBolt11Invoice this_arg_conv;
90229         this_arg_conv.inner = untag_ptr(this_arg);
90230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90232         this_arg_conv.is_owned = false;
90233         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
90234         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
90235         int64_t ret_ref = tag_ptr(ret_copy, true);
90236         return ret_ref;
90237 }
90238
90239 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
90240         LDKRawBolt11Invoice this_arg_conv;
90241         this_arg_conv.inner = untag_ptr(this_arg);
90242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90244         this_arg_conv.is_owned = false;
90245         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
90246         return ret_conv;
90247 }
90248
90249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
90250         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
90251         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
90252         return tag_ptr(ret_conv, true);
90253 }
90254
90255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
90256         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
90257         *ret_conv = PositiveTimestamp_from_system_time(time);
90258         return tag_ptr(ret_conv, true);
90259 }
90260
90261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
90262         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
90263         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
90264         return tag_ptr(ret_conv, true);
90265 }
90266
90267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
90268         LDKPositiveTimestamp this_arg_conv;
90269         this_arg_conv.inner = untag_ptr(this_arg);
90270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90272         this_arg_conv.is_owned = false;
90273         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
90274         return ret_conv;
90275 }
90276
90277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
90278         LDKPositiveTimestamp this_arg_conv;
90279         this_arg_conv.inner = untag_ptr(this_arg);
90280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90282         this_arg_conv.is_owned = false;
90283         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
90284         return ret_conv;
90285 }
90286
90287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
90288         LDKPositiveTimestamp this_arg_conv;
90289         this_arg_conv.inner = untag_ptr(this_arg);
90290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90292         this_arg_conv.is_owned = false;
90293         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
90294         return ret_conv;
90295 }
90296
90297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
90298         LDKBolt11Invoice this_arg_conv;
90299         this_arg_conv.inner = untag_ptr(this_arg);
90300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90302         this_arg_conv.is_owned = false;
90303         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
90304         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
90305         return ret_arr;
90306 }
90307
90308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
90309         LDKBolt11Invoice this_arg_conv;
90310         this_arg_conv.inner = untag_ptr(this_arg);
90311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90313         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
90314         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
90315         int64_t ret_ref = 0;
90316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90318         return ret_ref;
90319 }
90320
90321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
90322         LDKBolt11Invoice this_arg_conv;
90323         this_arg_conv.inner = untag_ptr(this_arg);
90324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90326         this_arg_conv.is_owned = false;
90327         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
90328         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
90329         return tag_ptr(ret_conv, true);
90330 }
90331
90332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
90333         LDKSignedRawBolt11Invoice signed_invoice_conv;
90334         signed_invoice_conv.inner = untag_ptr(signed_invoice);
90335         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
90336         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
90337         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
90338         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
90339         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
90340         return tag_ptr(ret_conv, true);
90341 }
90342
90343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
90344         LDKBolt11Invoice this_arg_conv;
90345         this_arg_conv.inner = untag_ptr(this_arg);
90346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90348         this_arg_conv.is_owned = false;
90349         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
90350         return ret_conv;
90351 }
90352
90353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
90354         LDKBolt11Invoice this_arg_conv;
90355         this_arg_conv.inner = untag_ptr(this_arg);
90356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90358         this_arg_conv.is_owned = false;
90359         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
90360         return ret_conv;
90361 }
90362
90363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
90364         LDKBolt11Invoice this_arg_conv;
90365         this_arg_conv.inner = untag_ptr(this_arg);
90366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90368         this_arg_conv.is_owned = false;
90369         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
90370         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
90371         return ret_arr;
90372 }
90373
90374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
90375         LDKBolt11Invoice this_arg_conv;
90376         this_arg_conv.inner = untag_ptr(this_arg);
90377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90379         this_arg_conv.is_owned = false;
90380         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
90381         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
90382         return ret_arr;
90383 }
90384
90385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
90386         LDKBolt11Invoice this_arg_conv;
90387         this_arg_conv.inner = untag_ptr(this_arg);
90388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90390         this_arg_conv.is_owned = false;
90391         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
90392         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
90393         return ret_arr;
90394 }
90395
90396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
90397         LDKBolt11Invoice this_arg_conv;
90398         this_arg_conv.inner = untag_ptr(this_arg);
90399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90401         this_arg_conv.is_owned = false;
90402         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
90403         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
90404         int64_t ret_ref = tag_ptr(ret_copy, true);
90405         return ret_ref;
90406 }
90407
90408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
90409         LDKBolt11Invoice this_arg_conv;
90410         this_arg_conv.inner = untag_ptr(this_arg);
90411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90413         this_arg_conv.is_owned = false;
90414         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
90415         int64_t ret_ref = 0;
90416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90418         return ret_ref;
90419 }
90420
90421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
90422         LDKBolt11Invoice this_arg_conv;
90423         this_arg_conv.inner = untag_ptr(this_arg);
90424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90426         this_arg_conv.is_owned = false;
90427         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
90428         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
90429         return ret_arr;
90430 }
90431
90432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1get_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
90433         LDKBolt11Invoice this_arg_conv;
90434         this_arg_conv.inner = untag_ptr(this_arg);
90435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90437         this_arg_conv.is_owned = false;
90438         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
90439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form);
90440         return ret_arr;
90441 }
90442
90443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
90444         LDKBolt11Invoice this_arg_conv;
90445         this_arg_conv.inner = untag_ptr(this_arg);
90446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90448         this_arg_conv.is_owned = false;
90449         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
90450         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
90451         int64_t ret_ref = tag_ptr(ret_copy, true);
90452         return ret_ref;
90453 }
90454
90455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
90456         LDKBolt11Invoice this_arg_conv;
90457         this_arg_conv.inner = untag_ptr(this_arg);
90458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90460         this_arg_conv.is_owned = false;
90461         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
90462         return ret_conv;
90463 }
90464
90465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
90466         LDKBolt11Invoice this_arg_conv;
90467         this_arg_conv.inner = untag_ptr(this_arg);
90468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90470         this_arg_conv.is_owned = false;
90471         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
90472         return ret_conv;
90473 }
90474
90475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
90476         LDKBolt11Invoice this_arg_conv;
90477         this_arg_conv.inner = untag_ptr(this_arg);
90478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90480         this_arg_conv.is_owned = false;
90481         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
90482         return ret_conv;
90483 }
90484
90485 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) {
90486         LDKBolt11Invoice this_arg_conv;
90487         this_arg_conv.inner = untag_ptr(this_arg);
90488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90490         this_arg_conv.is_owned = false;
90491         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
90492         return ret_conv;
90493 }
90494
90495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
90496         LDKBolt11Invoice this_arg_conv;
90497         this_arg_conv.inner = untag_ptr(this_arg);
90498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90500         this_arg_conv.is_owned = false;
90501         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
90502         return ret_conv;
90503 }
90504
90505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
90506         LDKBolt11Invoice this_arg_conv;
90507         this_arg_conv.inner = untag_ptr(this_arg);
90508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90510         this_arg_conv.is_owned = false;
90511         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
90512         return ret_conv;
90513 }
90514
90515 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
90516         LDKBolt11Invoice this_arg_conv;
90517         this_arg_conv.inner = untag_ptr(this_arg);
90518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90520         this_arg_conv.is_owned = false;
90521         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
90522         jobjectArray ret_arr = NULL;
90523         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
90524         ;
90525         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
90526         for (size_t i = 0; i < ret_var.datalen; i++) {
90527                 LDKStr ret_conv_8_str = ret_var.data[i];
90528                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
90529                 Str_free(ret_conv_8_str);
90530                 ret_arr_ptr[i] = ret_conv_8_conv;
90531         }
90532         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
90533         FREE(ret_var.data);
90534         return ret_arr;
90535 }
90536
90537 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
90538         LDKBolt11Invoice this_arg_conv;
90539         this_arg_conv.inner = untag_ptr(this_arg);
90540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90542         this_arg_conv.is_owned = false;
90543         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
90544         int64_tArray ret_arr = NULL;
90545         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
90546         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
90547         for (size_t o = 0; o < ret_var.datalen; o++) {
90548                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
90549                 int64_t ret_conv_14_ref = 0;
90550                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
90551                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
90552                 ret_arr_ptr[o] = ret_conv_14_ref;
90553         }
90554         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
90555         FREE(ret_var.data);
90556         return ret_arr;
90557 }
90558
90559 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
90560         LDKBolt11Invoice this_arg_conv;
90561         this_arg_conv.inner = untag_ptr(this_arg);
90562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90564         this_arg_conv.is_owned = false;
90565         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
90566         int64_tArray ret_arr = NULL;
90567         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
90568         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
90569         for (size_t l = 0; l < ret_var.datalen; l++) {
90570                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
90571                 int64_t ret_conv_11_ref = 0;
90572                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
90573                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
90574                 ret_arr_ptr[l] = ret_conv_11_ref;
90575         }
90576         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
90577         FREE(ret_var.data);
90578         return ret_arr;
90579 }
90580
90581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
90582         LDKBolt11Invoice this_arg_conv;
90583         this_arg_conv.inner = untag_ptr(this_arg);
90584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90586         this_arg_conv.is_owned = false;
90587         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
90588         return ret_conv;
90589 }
90590
90591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
90592         LDKBolt11Invoice this_arg_conv;
90593         this_arg_conv.inner = untag_ptr(this_arg);
90594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90596         this_arg_conv.is_owned = false;
90597         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
90598         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
90599         int64_t ret_ref = tag_ptr(ret_copy, true);
90600         return ret_ref;
90601 }
90602
90603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
90604         LDKStr description_conv = java_to_owned_str(env, description);
90605         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
90606         *ret_conv = Description_new(description_conv);
90607         return tag_ptr(ret_conv, true);
90608 }
90609
90610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
90611         LDKDescription this_arg_conv;
90612         this_arg_conv.inner = untag_ptr(this_arg);
90613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90615         this_arg_conv = Description_clone(&this_arg_conv);
90616         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
90617         int64_t ret_ref = 0;
90618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90620         return ret_ref;
90621 }
90622
90623 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
90624         LDKDescription o_conv;
90625         o_conv.inner = untag_ptr(o);
90626         o_conv.is_owned = ptr_is_owned(o);
90627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
90628         o_conv.is_owned = false;
90629         LDKStr ret_str = Description_to_str(&o_conv);
90630         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
90631         Str_free(ret_str);
90632         return ret_conv;
90633 }
90634
90635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
90636         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
90637         int64_t ret_ref = 0;
90638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90640         return ret_ref;
90641 }
90642
90643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
90644         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
90645         int64_t ret_ref = 0;
90646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90648         return ret_ref;
90649 }
90650
90651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
90652         LDKExpiryTime this_arg_conv;
90653         this_arg_conv.inner = untag_ptr(this_arg);
90654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90656         this_arg_conv.is_owned = false;
90657         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
90658         return ret_conv;
90659 }
90660
90661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
90662         LDKExpiryTime this_arg_conv;
90663         this_arg_conv.inner = untag_ptr(this_arg);
90664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90666         this_arg_conv.is_owned = false;
90667         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
90668         return ret_conv;
90669 }
90670
90671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
90672         LDKRouteHint hops_conv;
90673         hops_conv.inner = untag_ptr(hops);
90674         hops_conv.is_owned = ptr_is_owned(hops);
90675         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
90676         hops_conv = RouteHint_clone(&hops_conv);
90677         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
90678         *ret_conv = PrivateRoute_new(hops_conv);
90679         return tag_ptr(ret_conv, true);
90680 }
90681
90682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
90683         LDKPrivateRoute this_arg_conv;
90684         this_arg_conv.inner = untag_ptr(this_arg);
90685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
90686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
90687         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
90688         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
90689         int64_t ret_ref = 0;
90690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
90691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
90692         return ret_ref;
90693 }
90694
90695 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
90696         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
90697         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
90698         return ret_conv;
90699 }
90700
90701 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
90702         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
90703         return ret_conv;
90704 }
90705
90706 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
90707         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
90708         return ret_conv;
90709 }
90710
90711 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
90712         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
90713         return ret_conv;
90714 }
90715
90716 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
90717         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
90718         return ret_conv;
90719 }
90720
90721 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
90722         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
90723         return ret_conv;
90724 }
90725
90726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
90727         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
90728         return ret_conv;
90729 }
90730
90731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
90732         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
90733         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
90734         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
90735         return ret_conv;
90736 }
90737
90738 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
90739         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
90740         LDKStr ret_str = CreationError_to_str(o_conv);
90741         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
90742         Str_free(ret_str);
90743         return ret_conv;
90744 }
90745
90746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
90747         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
90748         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
90749         return ret_conv;
90750 }
90751
90752 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
90753         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
90754         return ret_conv;
90755 }
90756
90757 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
90758         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
90759         return ret_conv;
90760 }
90761
90762 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
90763         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
90764         return ret_conv;
90765 }
90766
90767 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
90768         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
90769         return ret_conv;
90770 }
90771
90772 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
90773         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
90774         return ret_conv;
90775 }
90776
90777 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
90778         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
90779         return ret_conv;
90780 }
90781
90782 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
90783         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
90784         return ret_conv;
90785 }
90786
90787 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
90788         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
90789         return ret_conv;
90790 }
90791
90792 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
90793         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
90794         return ret_conv;
90795 }
90796
90797 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
90798         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
90799         return ret_conv;
90800 }
90801
90802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
90803         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
90804         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
90805         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
90806         return ret_conv;
90807 }
90808
90809 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
90810         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
90811         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
90812         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
90813         Str_free(ret_str);
90814         return ret_conv;
90815 }
90816
90817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
90818         if (!ptr_is_owned(this_ptr)) return;
90819         void* this_ptr_ptr = untag_ptr(this_ptr);
90820         CHECK_ACCESS(this_ptr_ptr);
90821         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
90822         FREE(untag_ptr(this_ptr));
90823         SignOrCreationError_free(this_ptr_conv);
90824 }
90825
90826 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
90827         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
90828         *ret_copy = SignOrCreationError_clone(arg);
90829         int64_t ret_ref = tag_ptr(ret_copy, true);
90830         return ret_ref;
90831 }
90832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
90833         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
90834         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
90835         return ret_conv;
90836 }
90837
90838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
90839         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
90840         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
90841         *ret_copy = SignOrCreationError_clone(orig_conv);
90842         int64_t ret_ref = tag_ptr(ret_copy, true);
90843         return ret_ref;
90844 }
90845
90846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
90847         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
90848         *ret_copy = SignOrCreationError_sign_error();
90849         int64_t ret_ref = tag_ptr(ret_copy, true);
90850         return ret_ref;
90851 }
90852
90853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
90854         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
90855         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
90856         *ret_copy = SignOrCreationError_creation_error(a_conv);
90857         int64_t ret_ref = tag_ptr(ret_copy, true);
90858         return ret_ref;
90859 }
90860
90861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
90862         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
90863         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
90864         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
90865         return ret_conv;
90866 }
90867
90868 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
90869         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
90870         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
90871         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
90872         Str_free(ret_str);
90873         return ret_conv;
90874 }
90875
90876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1zero_1amount_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msat) {
90877         LDKBolt11Invoice invoice_conv;
90878         invoice_conv.inner = untag_ptr(invoice);
90879         invoice_conv.is_owned = ptr_is_owned(invoice);
90880         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
90881         invoice_conv.is_owned = false;
90882         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
90883         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
90884         return tag_ptr(ret_conv, true);
90885 }
90886
90887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
90888         LDKBolt11Invoice invoice_conv;
90889         invoice_conv.inner = untag_ptr(invoice);
90890         invoice_conv.is_owned = ptr_is_owned(invoice);
90891         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
90892         invoice_conv.is_owned = false;
90893         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
90894         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
90895         return tag_ptr(ret_conv, true);
90896 }
90897
90898 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) {
90899         void* amt_msat_ptr = untag_ptr(amt_msat);
90900         CHECK_ACCESS(amt_msat_ptr);
90901         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
90902         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
90903         void* payment_hash_ptr = untag_ptr(payment_hash);
90904         CHECK_ACCESS(payment_hash_ptr);
90905         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
90906         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
90907         LDKStr description_conv = java_to_owned_str(env, description);
90908         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
90909         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
90910         if (phantom_route_hints_constr.datalen > 0)
90911                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
90912         else
90913                 phantom_route_hints_constr.data = NULL;
90914         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
90915         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
90916                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
90917                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
90918                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
90919                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
90920                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
90921                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
90922                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
90923         }
90924         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
90925         void* entropy_source_ptr = untag_ptr(entropy_source);
90926         CHECK_ACCESS(entropy_source_ptr);
90927         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
90928         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
90929                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
90930                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
90931         }
90932         void* node_signer_ptr = untag_ptr(node_signer);
90933         CHECK_ACCESS(node_signer_ptr);
90934         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
90935         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
90936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
90937                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
90938         }
90939         void* logger_ptr = untag_ptr(logger);
90940         CHECK_ACCESS(logger_ptr);
90941         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
90942         if (logger_conv.free == LDKLogger_JCalls_free) {
90943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
90944                 LDKLogger_JCalls_cloned(&logger_conv);
90945         }
90946         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
90947         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
90948         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
90949         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
90950         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
90951         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
90952         *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);
90953         return tag_ptr(ret_conv, true);
90954 }
90955
90956 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) {
90957         void* amt_msat_ptr = untag_ptr(amt_msat);
90958         CHECK_ACCESS(amt_msat_ptr);
90959         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
90960         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
90961         void* payment_hash_ptr = untag_ptr(payment_hash);
90962         CHECK_ACCESS(payment_hash_ptr);
90963         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
90964         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
90965         LDKSha256 description_hash_conv;
90966         description_hash_conv.inner = untag_ptr(description_hash);
90967         description_hash_conv.is_owned = ptr_is_owned(description_hash);
90968         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
90969         description_hash_conv = Sha256_clone(&description_hash_conv);
90970         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
90971         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
90972         if (phantom_route_hints_constr.datalen > 0)
90973                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
90974         else
90975                 phantom_route_hints_constr.data = NULL;
90976         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
90977         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
90978                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
90979                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
90980                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
90981                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
90982                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
90983                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
90984                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
90985         }
90986         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
90987         void* entropy_source_ptr = untag_ptr(entropy_source);
90988         CHECK_ACCESS(entropy_source_ptr);
90989         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
90990         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
90991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
90992                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
90993         }
90994         void* node_signer_ptr = untag_ptr(node_signer);
90995         CHECK_ACCESS(node_signer_ptr);
90996         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
90997         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
90998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
90999                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
91000         }
91001         void* logger_ptr = untag_ptr(logger);
91002         CHECK_ACCESS(logger_ptr);
91003         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91004         if (logger_conv.free == LDKLogger_JCalls_free) {
91005                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91006                 LDKLogger_JCalls_cloned(&logger_conv);
91007         }
91008         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
91009         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
91010         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
91011         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
91012         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
91013         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
91014         *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);
91015         return tag_ptr(ret_conv, true);
91016 }
91017
91018 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) {
91019         LDKChannelManager channelmanager_conv;
91020         channelmanager_conv.inner = untag_ptr(channelmanager);
91021         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
91022         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
91023         channelmanager_conv.is_owned = false;
91024         void* node_signer_ptr = untag_ptr(node_signer);
91025         CHECK_ACCESS(node_signer_ptr);
91026         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
91027         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
91028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91029                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
91030         }
91031         void* logger_ptr = untag_ptr(logger);
91032         CHECK_ACCESS(logger_ptr);
91033         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91034         if (logger_conv.free == LDKLogger_JCalls_free) {
91035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91036                 LDKLogger_JCalls_cloned(&logger_conv);
91037         }
91038         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
91039         void* amt_msat_ptr = untag_ptr(amt_msat);
91040         CHECK_ACCESS(amt_msat_ptr);
91041         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
91042         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
91043         LDKStr description_conv = java_to_owned_str(env, description);
91044         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
91045         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
91046         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
91047         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
91048         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
91049         *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);
91050         return tag_ptr(ret_conv, true);
91051 }
91052
91053 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) {
91054         LDKChannelManager channelmanager_conv;
91055         channelmanager_conv.inner = untag_ptr(channelmanager);
91056         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
91057         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
91058         channelmanager_conv.is_owned = false;
91059         void* node_signer_ptr = untag_ptr(node_signer);
91060         CHECK_ACCESS(node_signer_ptr);
91061         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
91062         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
91063                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91064                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
91065         }
91066         void* logger_ptr = untag_ptr(logger);
91067         CHECK_ACCESS(logger_ptr);
91068         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91069         if (logger_conv.free == LDKLogger_JCalls_free) {
91070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91071                 LDKLogger_JCalls_cloned(&logger_conv);
91072         }
91073         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
91074         void* amt_msat_ptr = untag_ptr(amt_msat);
91075         CHECK_ACCESS(amt_msat_ptr);
91076         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
91077         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
91078         LDKSha256 description_hash_conv;
91079         description_hash_conv.inner = untag_ptr(description_hash);
91080         description_hash_conv.is_owned = ptr_is_owned(description_hash);
91081         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
91082         description_hash_conv = Sha256_clone(&description_hash_conv);
91083         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
91084         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
91085         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
91086         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
91087         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
91088         *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);
91089         return tag_ptr(ret_conv, true);
91090 }
91091
91092 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) {
91093         LDKChannelManager channelmanager_conv;
91094         channelmanager_conv.inner = untag_ptr(channelmanager);
91095         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
91096         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
91097         channelmanager_conv.is_owned = false;
91098         void* node_signer_ptr = untag_ptr(node_signer);
91099         CHECK_ACCESS(node_signer_ptr);
91100         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
91101         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
91102                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91103                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
91104         }
91105         void* logger_ptr = untag_ptr(logger);
91106         CHECK_ACCESS(logger_ptr);
91107         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91108         if (logger_conv.free == LDKLogger_JCalls_free) {
91109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91110                 LDKLogger_JCalls_cloned(&logger_conv);
91111         }
91112         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
91113         void* amt_msat_ptr = untag_ptr(amt_msat);
91114         CHECK_ACCESS(amt_msat_ptr);
91115         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
91116         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
91117         LDKSha256 description_hash_conv;
91118         description_hash_conv.inner = untag_ptr(description_hash);
91119         description_hash_conv.is_owned = ptr_is_owned(description_hash);
91120         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
91121         description_hash_conv = Sha256_clone(&description_hash_conv);
91122         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
91123         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
91124         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
91125         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
91126         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
91127         *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);
91128         return tag_ptr(ret_conv, true);
91129 }
91130
91131 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) {
91132         LDKChannelManager channelmanager_conv;
91133         channelmanager_conv.inner = untag_ptr(channelmanager);
91134         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
91135         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
91136         channelmanager_conv.is_owned = false;
91137         void* node_signer_ptr = untag_ptr(node_signer);
91138         CHECK_ACCESS(node_signer_ptr);
91139         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
91140         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
91141                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91142                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
91143         }
91144         void* logger_ptr = untag_ptr(logger);
91145         CHECK_ACCESS(logger_ptr);
91146         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91147         if (logger_conv.free == LDKLogger_JCalls_free) {
91148                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91149                 LDKLogger_JCalls_cloned(&logger_conv);
91150         }
91151         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
91152         void* amt_msat_ptr = untag_ptr(amt_msat);
91153         CHECK_ACCESS(amt_msat_ptr);
91154         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
91155         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
91156         LDKStr description_conv = java_to_owned_str(env, description);
91157         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
91158         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
91159         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
91160         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
91161         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
91162         *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);
91163         return tag_ptr(ret_conv, true);
91164 }
91165
91166 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) {
91167         LDKChannelManager channelmanager_conv;
91168         channelmanager_conv.inner = untag_ptr(channelmanager);
91169         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
91170         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
91171         channelmanager_conv.is_owned = false;
91172         void* node_signer_ptr = untag_ptr(node_signer);
91173         CHECK_ACCESS(node_signer_ptr);
91174         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
91175         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
91176                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91177                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
91178         }
91179         void* logger_ptr = untag_ptr(logger);
91180         CHECK_ACCESS(logger_ptr);
91181         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91182         if (logger_conv.free == LDKLogger_JCalls_free) {
91183                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91184                 LDKLogger_JCalls_cloned(&logger_conv);
91185         }
91186         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
91187         void* amt_msat_ptr = untag_ptr(amt_msat);
91188         CHECK_ACCESS(amt_msat_ptr);
91189         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
91190         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
91191         LDKStr description_conv = java_to_owned_str(env, description);
91192         LDKThirtyTwoBytes payment_hash_ref;
91193         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
91194         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
91195         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
91196         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
91197         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
91198         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
91199         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
91200         *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);
91201         return tag_ptr(ret_conv, true);
91202 }
91203
91204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
91205         LDKStr s_conv = java_to_owned_str(env, s);
91206         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
91207         *ret_conv = SiPrefix_from_str(s_conv);
91208         return tag_ptr(ret_conv, true);
91209 }
91210
91211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
91212         LDKStr s_conv = java_to_owned_str(env, s);
91213         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
91214         *ret_conv = Bolt11Invoice_from_str(s_conv);
91215         return tag_ptr(ret_conv, true);
91216 }
91217
91218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
91219         LDKStr s_conv = java_to_owned_str(env, s);
91220         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
91221         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
91222         return tag_ptr(ret_conv, true);
91223 }
91224
91225 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
91226         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
91227         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
91228         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
91229         Str_free(ret_str);
91230         return ret_conv;
91231 }
91232
91233 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
91234         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
91235         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
91236         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
91237         Str_free(ret_str);
91238         return ret_conv;
91239 }
91240
91241 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
91242         LDKBolt11Invoice o_conv;
91243         o_conv.inner = untag_ptr(o);
91244         o_conv.is_owned = ptr_is_owned(o);
91245         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
91246         o_conv.is_owned = false;
91247         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
91248         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
91249         Str_free(ret_str);
91250         return ret_conv;
91251 }
91252
91253 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
91254         LDKSignedRawBolt11Invoice o_conv;
91255         o_conv.inner = untag_ptr(o);
91256         o_conv.is_owned = ptr_is_owned(o);
91257         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
91258         o_conv.is_owned = false;
91259         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
91260         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
91261         Str_free(ret_str);
91262         return ret_conv;
91263 }
91264
91265 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
91266         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
91267         LDKStr ret_str = Currency_to_str(o_conv);
91268         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
91269         Str_free(ret_str);
91270         return ret_conv;
91271 }
91272
91273 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
91274         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
91275         LDKStr ret_str = SiPrefix_to_str(o_conv);
91276         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
91277         Str_free(ret_str);
91278         return ret_conv;
91279 }
91280
91281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
91282         if (!ptr_is_owned(this_ptr)) return;
91283         void* this_ptr_ptr = untag_ptr(this_ptr);
91284         CHECK_ACCESS(this_ptr_ptr);
91285         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
91286         FREE(untag_ptr(this_ptr));
91287         GraphSyncError_free(this_ptr_conv);
91288 }
91289
91290 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
91291         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
91292         *ret_copy = GraphSyncError_clone(arg);
91293         int64_t ret_ref = tag_ptr(ret_copy, true);
91294         return ret_ref;
91295 }
91296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
91297         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
91298         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
91299         return ret_conv;
91300 }
91301
91302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
91303         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
91304         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
91305         *ret_copy = GraphSyncError_clone(orig_conv);
91306         int64_t ret_ref = tag_ptr(ret_copy, true);
91307         return ret_ref;
91308 }
91309
91310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
91311         void* a_ptr = untag_ptr(a);
91312         CHECK_ACCESS(a_ptr);
91313         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
91314         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
91315         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
91316         *ret_copy = GraphSyncError_decode_error(a_conv);
91317         int64_t ret_ref = tag_ptr(ret_copy, true);
91318         return ret_ref;
91319 }
91320
91321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
91322         LDKLightningError a_conv;
91323         a_conv.inner = untag_ptr(a);
91324         a_conv.is_owned = ptr_is_owned(a);
91325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
91326         a_conv = LightningError_clone(&a_conv);
91327         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
91328         *ret_copy = GraphSyncError_lightning_error(a_conv);
91329         int64_t ret_ref = tag_ptr(ret_copy, true);
91330         return ret_ref;
91331 }
91332
91333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
91334         LDKRapidGossipSync this_obj_conv;
91335         this_obj_conv.inner = untag_ptr(this_obj);
91336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
91337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
91338         RapidGossipSync_free(this_obj_conv);
91339 }
91340
91341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
91342         LDKNetworkGraph network_graph_conv;
91343         network_graph_conv.inner = untag_ptr(network_graph);
91344         network_graph_conv.is_owned = ptr_is_owned(network_graph);
91345         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
91346         network_graph_conv.is_owned = false;
91347         void* logger_ptr = untag_ptr(logger);
91348         CHECK_ACCESS(logger_ptr);
91349         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
91350         if (logger_conv.free == LDKLogger_JCalls_free) {
91351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
91352                 LDKLogger_JCalls_cloned(&logger_conv);
91353         }
91354         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
91355         int64_t ret_ref = 0;
91356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
91357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
91358         return ret_ref;
91359 }
91360
91361 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) {
91362         LDKRapidGossipSync this_arg_conv;
91363         this_arg_conv.inner = untag_ptr(this_arg);
91364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
91365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
91366         this_arg_conv.is_owned = false;
91367         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
91368         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
91369         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
91370         return tag_ptr(ret_conv, true);
91371 }
91372
91373 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) {
91374         LDKRapidGossipSync this_arg_conv;
91375         this_arg_conv.inner = untag_ptr(this_arg);
91376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
91377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
91378         this_arg_conv.is_owned = false;
91379         LDKu8slice update_data_ref;
91380         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
91381         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
91382         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
91383         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
91384         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
91385         return tag_ptr(ret_conv, true);
91386 }
91387
91388 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) {
91389         LDKRapidGossipSync this_arg_conv;
91390         this_arg_conv.inner = untag_ptr(this_arg);
91391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
91392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
91393         this_arg_conv.is_owned = false;
91394         LDKu8slice update_data_ref;
91395         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
91396         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
91397         void* current_time_unix_ptr = untag_ptr(current_time_unix);
91398         CHECK_ACCESS(current_time_unix_ptr);
91399         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
91400         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
91401         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
91402         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
91403         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
91404         return tag_ptr(ret_conv, true);
91405 }
91406
91407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
91408         LDKRapidGossipSync this_arg_conv;
91409         this_arg_conv.inner = untag_ptr(this_arg);
91410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
91411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
91412         this_arg_conv.is_owned = false;
91413         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
91414         return ret_conv;
91415 }
91416